Multiple network connections, where does traffic get routed through?

Network interfaces have a "metric" value. If multiple interfaces can reach to the gateway, the one with the smallest metric will be used.

You can try typing netstat -r at the command line to have a look at that. ifconfig will give the metric for each interface as well.


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.