OnlineWebTools

How to display routing information in Linux

The programs normally used in Linux to show routing information is route and netstat. The following is an example of using both programs:

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.64.64.64     *               255.255.255.255 UH    0      0        0 ppp0
default         *               0.0.0.0         U     0      0        0 ppp0
$ netstat -r
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
10.64.64.64     *               255.255.255.255 UH        0 0          0 ppp0
default         *               0.0.0.0         U         0 0          0 ppp0

It is advisable to include the -n options to both command for faster execution (by not resolving names, and produce slightly different result) as the following;

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.64.64.64     0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 ppp0
$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
10.64.64.64     0.0.0.0         255.255.255.255 UH        0 0          0 ppp0
0.0.0.0         0.0.0.0         0.0.0.0         U         0 0          0 ppp0
Exit mobile version