Score:1

What is the significance of order in the device list of ip route output?

ph flag

I have this output for ip r

default via 10.0.0.1 dev enp0s20f0u1 proto static metric 1000 
default via 10.0.0.1 dev wlan0 proto static metric 2000 
10.0.0.0/24 dev wlan0 proto kernel scope link src 10.0.0.129 
10.0.0.0/24 dev enp0s20f0u1 proto kernel scope link src 10.0.0.120 

Although enp0s20f0u1 appears as the first default -- appropriate with the metric -- wlan0 appears at the top of the list of devices.

What is the significance of order in the device list?

Score:2
ru flag

All that ip route list does is list all of your routes currently in place in the network routing table. The significance of the order of info in the output is less important than the metric values and route table structure for more complicated configurations. Also, and more importantly, basic understanding of how network routes work is key to interpret the output so you understand what each line refers to.

As such, the significance of device order in the output is nearly zero. More important is the Metric value on the default routes and other routes on a per-device level. So ignore 'device order' entirely, and read the routes as you would a list of directions.

So let's first look at the non-default routes, and interpret them as such (based on the data):

  • Traffic to 10.0.0.0/24 via device wlan0 are on-link and will be sent via this device with a source IP address of 10.0.0.129.

  • Traffic to 10.0.0.0/24 via device Ethernet are on-link and will be sent via this device with a source IP address of 10.0.0.120.

Similarly, now that we know the on-link routes are in place, we refer to the following interpretation of your default routes:

  • The default route for all traffic destinations other than on-link routes is via the gateway 10.0.0.1 via device Ethernet, which has a distance/metric value of 1000. This link has the lower distance/metric value and will be used first.

  • The default route for all traffic destinations other than on-link routes is via the gateway 10.0.0.1 via device wlan0, which has a distance/metric value of 2000. If the link/route to Gateway is unavailable on Ethernet, then wlan0 link will be used instead.

This is how you interpret the data, start from the non-default routes and then compare default routes and the metric values.

(Note I shortened your enp... device to just Ethernet for this discussion and ease of typing)

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.