6

I am learning about Linux routing, routing tables, IP routing, etc... The following is the output from ip route followed by the output of route:

default via 192.168.1.1 dev wlp0s20f3 proto dhcp metric 600 
169.254.0.0/16 dev wlp0s20f3 scope link metric 1000 
192.168.1.0/24 dev wlp0s20f3 proto kernel scope link src 192.168.1.103 metric 600
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         pfSense.localdo 0.0.0.0         UG    600    0        0 wlp0s20f3
link-local      0.0.0.0         255.255.0.0     U     1000   0        0 wlp0s20f3
192.168.1.0     0.0.0.0         255.255.255.0   U     600    0        0 wlp0s20f3

So, what I understand from the output of route is that anything routed to my local network 192.168.1.0/24 is on the local network and so the interface is essentially unspecified. Same thing with anything sent to link-local (which I believe is my loopback device). Finally, anything that is routed to anything else is sent to the default gateway which is my router. Hopefully I've got this right.

I am having difficulty parsing the output of ip route. I can see what my default gateway is obviously but I have trouble matching the other two lines with the output of route. I've been through the documentation and learned quite a bit thankfully but haven't been able to find anything specific about the output of the command aside from the fact that it tells me the interface and the destination. If anyone could be so kind as to break down a line for me and explain how to read it I would greatly appreciate it!

Some relevant links for those who stroll upon this question once answered:

http://linux-ip.net/html/tools-ip-route.html

http://www.policyrouting.org/iproute2.doc.html#ss9.5

4
  • Where do you get this notion of "null interface" from? What does that even mean? The second and third routes are connected routes meaning that that subnet can be reached via the given interface (wlp0s20f3 in this case) without an intervening router. That is, they are for the subnets that the interface is configured in. – kaylum Jan 27 '20 at 3:21
  • I read that 0.0.0.0 was a special address that essentially said nowhere or unspecified. I probably could have worded that better but what I mean is that there is no intermediary device and those objects are on the local network. – RhythmInk Jan 27 '20 at 3:24
  • Ok, in that case it sounds like you know what those routes represent. Can you clarify then what specifically you don't understand? – kaylum Jan 27 '20 at 3:31
  • Specifically the stuff that follows the device. Scope link etc... And how lines of ip route can be seen in the output of route. – RhythmInk Jan 27 '20 at 5:21
0

link-local (which I believe is my loopback device).

link-local (the 169.254.0.0/16) is a special subnet. Loopback device is "lo" and 127.0.0.1, and scope host and LOOPBACK (with ip a)

The other two lines of ip route show can be created with:

ip address add 192.168.0.16/24 dev eth0
ip route add 192.168.0.0/24 dev eth0
ip route add default via 192.168.0.1

This gives the same as this (dhcp), just the address is different (15 vs 16):

default via 192.168.0.1 dev eth0 proto dhcp src 192.168.0.15 metric 202 
192.168.0.0/24 dev eth0 proto dhcp scope link src 192.168.0.15 metric 202

Some relevant links for those who stroll upon this question once answered

???

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.