Linux Routing Explained

The latest CLI Magic column is up at, and the new feature is the route command. If you’ve ever needed to troubleshoot a network routing issue, this is the kind of thing you’ll need to know.

Unfortunately the author refers the reader to the man page for the route command rather than offering explanations. He says the new network tools in use are ip and ss. They are on my system, but strangely enough, I’ve never heard of them before. Looks like I may need to track down some more recent training materials and/or check out some man pages.

I posted the route command I use at work in a post last Monday, but here it is again for quick reference (gateway address concealed for privacy reasons):

route add -net gw

This essentially creates a default route through a gateway to anywhere but my local LAN. The -net switch says the following address is a network (vs. a host), and the gateway is listed by IP address. If I run the route command without any switches or arguments, this is what it looks like:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface  *      U     0      0        0 eth0
loopback        *            U     0      0        0 lo
default         UG    0      0        0 eth0

The column explains the rest of the fields; note the Gateway here, though, has been converted to a domain name rather than an IP address. This is because I’m on a public network with DNS vs. a private network in the 10.x.x.x or 192.168.x.x range. Unless you’re running your own internal DNS for some reason, you should see an IP address in this field.