How to Know Which Network Is Connected?

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).

1

1 Answer

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 
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.

Share this article
Twitter Facebook Pinterest