7

While running Ubuntu 14.04, my laptop has both its Wifi turned on with a saved wireless network in range, and an ethernet cable plugged in (which leads to a Devolo homeplug from the same network). If I click the "Up/Down" button at the top right of the main screen, both have a "Disconnect" option below them, so that I can't tell which one the computer is using to connect to the internet.

Short of disabling the wifi or disconnecting the ethernet cable, is there any 'programmatic' method to determine how the computer is connected to the internet?

7

If you use the command route there will be and entry in the table with the value 'Default' or '0.0.0.0' as destination field, then the 'Iface' field will be the interface (Ethernet or wifi) your computer is using to reach the internet.

Example:

$ 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 0 0 0 eth0 0.0.0.0 192.168.1.10 0.0.0.0 UG 0 0 0 eth0

1

I use conky for this purpose. It shows live information about all the interfaces on your computer. This is a screeshot from my computer and as you can see on the right side(the red and green graphs) are all the interfaces my PC has.

You can install conky with

sudo apt-get install conky

Your Answer

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

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