Unix: Getting from here to there (routing basics)

You need to understanding routing tables if you're going to do any kind of network troubleshooting. Let's take a look at what Linux commands can tell you about how your system is making connections.


What is routing? It's the set of rules that govern how you make connections to other systems. Any time you make a connection from one system to another system -- whether you're sending email, transferring a set of files or logging in with ssh -- you're routing. And, since most connections aren't direct (in other words, they're travelling through one or more system en route to the target), most of the time you're going to be crossing a router -- or maybe a long series of routers -- to get there.

To view the routing table on a Linux system, use the netstat -rn command. The output of this command will tell you how connections you initiate are going to be handled. The routing table on most Linux systems will look something like this:

$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface   U         0 0          0 eth0     U         0 0          0 eth0         UG        0 0          0 eth0

The fields in this output are:

Destination -- where the connections are headed. This can be a specific network, one particular system or everything not covered by some other routing entry (i.e., the default).

Gateway -- where those connections first have to go before being sent to the ultimate destination. This can be a local router or a "" (no router involved) kind of entry.

Genmask -- the network mask that determines what systems are covered by your destination.

Flags -- indicators that tell you more about each routing table entry (e.g., whether it's a gateway).

MSS -- maximum segment size

Window -- size of packet that can be transmitted

irtt -- initial round trip time

Iface -- the network interface that is involved

For several of these settings, a size of 0 means that the default value is being used.

Now, let's examine this output line by line.

Line 1

First, is the local network. How do you know this? Well, with a gateway of, connections clearly aren't going through another system.

Photo Credit: 

flickr / Ramkarthikblogger

Join us:






Spotlight on ...
Online Training

    Upgrade your skills and earn higher pay

    Readers to share their best tips for maximizing training dollars and getting the most out self-directed learning. Here’s what they said.


    Learn more

NetworkingWhite Papers & Webcasts

See more White Papers | Webcasts

Answers - Powered by ITworld

ITworld Answers helps you solve problems and share expertise. Ask a question or take a crack at answering the new questions below.

Join us:






Ask a Question