Tag Info

Hot answers tagged

13

You can use route to find your default route: $ route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.0 * 255.255.255.0 U 1 0 0 eth0 link-local * 255.255.0.0 U 1000 0 0 eth0 default 192.168.1.1 0.0.0.0 ...


10

Here is a similar setup from one of our routers (with some irrelevant stuff snipped). Note that this handles incoming connections as well. Note the use of variables instead of hard-coded mark numbers. So much easier to maintain! They're stored in a separate script, and sourced in. Table names are configured in /etc/iproute2/rt_tables. Interface names are ...


9

It's not the ssh client that decides through which interface TCP packets should go, it's the kernel. In short, SSH asks the kernel to open a connection to a certain IP address, and the kernel decides which interface is to be used by consulting the routing tables. (The following assumes you're on GNU/Linux; the general concept is the same for all Unices, ...


9

echo 200 isp2 >> /etc/iproute2/rt_tables ip rule add from <interface_IP> dev ppp0 table isp2 ip route add default via <gateway_IP> dev ppp0 table isp2 The above doesn't require any packet marking with ipfilter. It works because the outgoing (reply) packets will have the IP address that was originally used to connect to the 2nd interface ...


9

You're close. The actual reason that the application isn't seeing the return traffic is because of the kernel's built in IP spoofing protection. I.e., the return traffic doesn't match the routing table and is therefore dropped. You can fix this by turning off spoofing protection like this: sudo sysctl net.ipv4.conf.wlan0.rp_filter=0 But I wouldn't ...


8

"IP forwarding" is a synonym for "routing." It is called "kernel IP forwarding" because it is a feature of the Linux kernel. A router has multiple network interfaces. If traffic comes in on one interface that matches a subnet of another network interface, a router then forwards that traffic to the other network interface. So, let's say you have two NICs, ...


8

There are several possibilities, depending on how you want to decide what packets go where. Most of them will require some understanding of how TCP/IP networking works in Linux. The main tools you'll have to know to do complex things are iptables (Ubuntu: iptables ) and iproute2 (ip command) (Ubuntu: iproute , iproute-doc ). If you can discriminate fully by ...


8

No packets are received for several seconds and then ~6 are sent back in quick succession. This is symptomatic of two similar phenomena: network congestion or network discards (usually due to congestion). In the first case, a router between here and there has a burst of traffic unrelated to your activities which cause your traffic to be buffered in ...


7

After extensive study of the openvpn manual, I have found an answer for my question: I you don't want the routes to be executed automatically, but to be handled by your own tool, use the following option: --route-noexec Don't add or remove routes automatically. Instead pass routes to --route-up script using environmental variables. If you ...


6

It's pretty easy. You need to connect PC to notebook. Configure eth0 on PC (set for example ip = 192.168.2.3 and default gateway 192.168.2.2 and dns server to 8.8.8.8). That's all you need to do on PC. On notebook you need to set up the internet connection as usual and configure eth0 with the following way: set ip address to 192.168.2.2, enable net ...


6

You need to set the promote_secondaries option on the interface, or on all interfaces: echo 1 > /proc/sys/net/ipv4/conf/eth0/promote_secondaries or sysctl net.ipv4.conf.eth0.promote_secondaries=1 Change eth0 to all to have it work on all interfaces. This option has been in since 2.6.12. I tested this with a dummy interface and it worked there.


5

You'll want to use the iptables owner module and perhaps some clever packet mangling. owner This module attempts to match various characteristics of the packet creator, for locally-generated packets. It is only valid in the OUTPUT chain, and even then some packets (such as ICMP ping responses) may have no owner, and hence never match. ...


5

The Linux Advanced Routing & Traffic Control HOWTO has a section describing to solve the problem. The key step to balance traffic between the two routes is to give them both a weight. ip route add default scope global \ nexthop via 192.168.0.1 dev eth1 weight 1 \ nexthop via 192.168.1.1 dev eth0 weight 1


5

For a simple router, there are really only two steps that need to be done. Enable routing The first step is to enable routing in the kernel. By default, the kernel drops packets that it doesn't recognize; once you enable routing, it'll forward them. You need to issue either of these two commands when the computer boots: sysctl -w net.ipv4.ip_forward=1 ...


5

It maps to RTF_EXPIRES. It means the route has a non-infinite lifetime. In this case, the kernel probably learned the route dynamically from a RA (Router Advertisement). I recommend you use ip instead of route (and instead of ifconfig). Although it's Linux-specific and unportable, its syntax is much less archaic than the legacy commands. ip -6 route would ...


5

My question is: Why is it possible for a computer on the 172.16.2.0/24 subnet to ping 172.16.1.1 (ip address of eth1 interface)? Because you allowed it, and Linux does it by default. Linux uses what is called a weak host model. That mean when it receives a packet coming from eth2, it will consider the packet to be for him if the destination address is ...


5

0.0.0.0 has the specific meaning "unspecified". This roughly translates to "there is none" in the context of a gateway. Of course, this means that the network is locally connected, as there is no next hop. As a destination, 0.0.0.0/0 is special: if there are no network bits, there can't be anything in the network number either. So, it's naturally ...


5

Add the following line to /etc/dhcp/dhclient.conf on your server: prepend domain-name-servers 127.0.0.1; This makes it prepend 127.0.0.1 to whatever content of /etc/resolv.conf was forced on it by the gateway DHCP. Why option domain-name-servers x.x.x.x doesn't work From the dhclient.conf(5) man page: The option statement is used to specify the ...


4

The following commands create an alternate routing table via eth1 for packets that have the mark 1 (except packets to localhost). The ip command is from the iproute2 suite (Ubuntu: iproute , iproute-doc ). ip rule add fwmark 1 table 1 ip route add 127.0.0.0/0 table 1 dev lo ip route add 0.0.0.0/0 table 1 dev eth1 The other half of the job is recognizing ...


4

I've done something similar with real interfaces, but I can't see why it wouldn't work with VPN interfaces. The idea is that, as you have the same subnet available at different interfaces on that router, it complicates the routing. Basically, when a packet for 10.10.13.123 enters the router, it is DNATed before routing to 192.168.0.123, so you have to be ...


4

Well - this IS a routing-question. The answer is simple: The first entry that will give the best routing-entry is "the winner". So look at netstat -rn to see which interface is first. Update: The network-inferface-routing-settings normally get set up during system startup. So the startup order of network devices will be the order in that table. With ...


4

The solution is to set the Netfilter packet mark which can be used by advanced routing. There is no way to match by process id, but Netfilter allows to match on process UID or GID. In this case it seems to be the easiest solution to create a new system user especially for this task. iptables -A OUTPUT -m owner --uid-owner wlanping -j MARK --set-mark 42 ...


3

Most routers/firewalls allow to redirect traffic based on a certain port, e.g. all SMTP traffic (port 25) is redirected to 192.168.1.1. But if you have multiple servers to handle your traffic (1 server per domain). You need to install something like a reverse proxy (nginx supports this for HTTP, IMAP, POP3). For instance, all traffic to port 80 is ...


3

Running ifconfig will give you the information you need. The active interface will have an inet addr and will show a record of transmitted data, like so: RX bytes:1930741 (1.8 Mb) TX bytes:204768 (199.9 Kb) You can also use the ip addr command and any inactive interfaces will be designated as having: NO-CARRIER.


3

I have no experience of PPTP Client and haven't looked at the instructions. But the command route add -net 0.0.0.0/0 ppp0 means “route all traffic through ppp0 except the traffic that has more precise routes”. This means that the loopback interface, your local network if you have one, and the route to the VPN server (which is set up, right?) will use the ...


3

You can specify the interface through which to route traffic in the routing table: sudo route add <host.com> -interface <ppp0> Where host.com is the hostname or ip that you want to access through the interface, and ppp0 is the link identifier for your vpn shown with the ifconfig command.


3

Is the firewall on the server disabled? It maybe that there are some firewall rules that are blocking the packets. Look at the output of iptables (must be run as root) and if you see anything other than ACCEPT rules/policies then they may be blocking things. iptables -L and iptables -t nat -L


3

bahamat's solution is correct; however, please note that the only way for me to make this work was to disable the rp_filter for every interface in the system, not only the two (eth1 and wlan0 in this case) involved in the NATing. for f in /proc/sys/net/ipv4/conf/*/rp_filter; do echo 0 > $f; done echo 1 > /proc/sys/net/ipv4/route/flush (see the ...


3

First plug in the IPs of the network for which you want to act as router. Either get multiple network interface cards or configure a virtual interface. You need to enable packet forwarding from /etc/sysctl.conf and then configure iptables for NAT. Here is a brief tutorial for the same.


3

You can share the internet by configuring the Cent OS server as a NAT machine and giving private ip addresses to the LAN machines. As in your case, the USB wireless interface is ppp0 and the LAN interface is eth0 on the Cent OS server. Step-1: Providing private ip addresses to LAN interface on Cent OS and to the other machines in the LAN. You can give any ...



Only top voted, non community-wiki answers of a minimum length are eligible