Wednesday, May 11, 2016

Figuring out which internet connection is being used

Now that fiber connections are more widely available (including in my house) sometimes I will plug my laptop in to a wired connection so that I can take advantage of the higher speeds. For general browsing and listening to music it doesn't make much difference whether I am on wifi or wired in, but when transferring large amounts of data, it can make a big difference. But when I plug in the wired connection, do I need to disconnect my wifi to ensure I am using the connection? How do I tell which connection is being used? The answer is found with the Linux tools route and traceroute.

First we look at the route that will be taken to get to our destination. To find out what route will be taken, type


This will return a list of hops that your data packet must take to reach its destination. While the output from this tool is can be a fascinating look at the winding path of your data, we are really only interested in the first line, which in my case looks like this:

1 (  0.454 ms  0.437 ms  0.428 ms

This tells me that the first hop is from my laptop to Now I can the route tool to determine which internet connection is going to this location. I type


and the output tells me

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         UG    100    0        0 eth0
default         UG    600    0        0 wlan0        *        U     100    0        0 eth0
link-local      *          U     1000   0        0 virbr0     *        U     600    0        0 wlan0   *        U     0      0        0 virbr0

Again, I am only interested in the first few rows. You can see that I have a default route going to the gateway, and the Use Iface column tells me that this uses the eth0 interface, which is my wired connection. (The wlan0 is my wifi, and the virbr0 is a virtual bridge, in case anyone is curious).

So connections to the website (which is a stand-in for anything real I would use there) run through the gateway over the wired eth0 connection, and I don't need to worry about disconnecting my wifi to ensure that I get high speed for my download.

No comments:

Post a Comment