Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
    
+1 What decides the metric value? The device itself, configuration, or something else entirely? –  Kent Boogaart Sep 3 '10 at 12:38
1  
+1 Typing ifconfig in my case (eth0 disconnected, wlan0 connected) given Metric:1 for all interfaces. How is this metric value to be interpreted ? –  koushik Sep 3 '10 at 15:04
    
@koushik Think of metric as the cost to send traffic for that rule. It will try to send it the way that costs the least. –  Azendale Jul 8 '11 at 6:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.