Ubuntu – Multiple network connections, where does traffic get routed through

network-managernetworking

My thinkpad has two network interfaces, one wired and one wireless. Both interfaces can be connected to a router which in turn is connected to the Internet.

If both interfaces are connected, are both interfaces used simultaneously or just one at a time. How can I tell which interface is used?

Best Answer

I activated my wired eth0 and wifi eth2 with network manager (both dhcp):

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     1      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     2      0        0 eth2
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0

tcpdump -n -i eth0 shows traffic, while tcpdump -n -i eth2 doesn't.

So let's try to reorder the interfaces in the routing table:

sudo route del -net 192.168.1.0/24 dev eth2
sudo route add -net 192.168.1.0/24 dev eth2
sudo route -n add default gw 192.168.1.1 dev eth2

Now the routing table is:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth2
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth2
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0

now tcpdump shows all the traffic going through the eth2 interface.

Related Question