Ubuntu – How to tell whether your computer is using wifi or ethernet to access the internet

14.04ethernetinternetnetworking

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?

Best Answer

  • 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

  • Related Question