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.

How can I see using command-line whether I am connected to network using eth0, eth1 or wln0 etc?

Well, to elaborate, I have a desktop sidebar which I installed using program "conky". This sidebar has meter that shows internet speed. Since I am not using eth0, I need to make a minor change in ~/.conkyrc file. I need to replace "eth0" with whatever network is being used by my wireless card to connect to internet (via a router).

share|improve this question
    
ifconfig may be what you are looking for. –  Marty Fried Jul 23 '12 at 1:11

1 Answer 1

up vote 2 down vote accepted

You may very well be connected to multiple networks at once, depending on your setup.

If you are interested in knowing which interface is being used for Internet traffic, try using the ip route command and look at the default route. For example, on my system it shows that traffic will travel over eth0 if it isn't matched by any of the other rules in the table:

$ ip route
default via 192.168.0.1 dev eth0  proto static 
169.254.0.0/16 dev eth0  scope link  metric 1000 
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.10  metric 1 
share|improve this answer
    
Eureka! It was "eth2". I found it using ifconfig, since I knew my manually configured ip address, it was used by eth2. However, ip route is a better option, since it clearly showed "eth2" to be the one and only network being used. –  Chirag Jul 23 '12 at 16:52

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.