Using the route command on Linux to show the routing table.

Posted: October 17, 2014. At: 8:19 PM. This was 3 years ago. Post ID: 7830

The route command on Linux will show the kernel routing table, this is very useful as in my case, when you are using a VPN and you need to see the routing table.

This is an example, I am viewing the routing table on my Ubuntu 14.04 machine running OpenVPN.

jason-H55-USB3 [route -v] ~                                                                                                14-10-17 12:40PM
jason-H55-USB3% route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.100.1   0.0.0.0         UG    0      0        0 eth2
10.8.0.0        10.8.0.2        255.255.255.0   UG    0      0        0 tun1194
10.8.0.2        *               255.255.255.255 UH    0      0        0 tun1194
172.16.96.0     *               255.255.255.0   U     0      0        0 vmnet8
192.168.44.0    *               255.255.255.0   U     0      0        0 vmnet1
192.168.100.0   *               255.255.255.0   U     1      0        0 eth2

Here I am using the -v parameter to view a more verbose output of the routing table.

jason-H55-USB3 [route] ~                                                                                                   14-10-17 12:40PM
jason-H55-USB3% route -v
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.100.1   0.0.0.0         UG    0      0        0 eth2
10.8.0.0        10.8.0.2        255.255.255.0   UG    0      0        0 tun1194
10.8.0.2        *               255.255.255.255 UH    0      0        0 tun1194
172.16.96.0     *               255.255.255.0   U     0      0        0 vmnet8
192.168.44.0    *               255.255.255.0   U     0      0        0 vmnet1
192.168.100.0   *               255.255.255.0   U     1      0        0 eth2

If you want much more information about your network routing table, use the

routel

command on Ubuntu. This provides a much more verbose output.

[email protected]:~$ routel
         target            gateway          source    proto    scope    dev tbl
        default      192.168.100.1                   static            eth0 
       10.8.0.0 24        10.8.0.2                                  tun1194 
       10.8.0.2                           10.8.0.1   kernel     linktun1194 
  192.168.100.0 24                   192.168.100.8   kernel     link   eth0 
       10.8.0.1              local        10.8.0.1   kernel     hosttun1194 local
      127.0.0.0          broadcast       127.0.0.1   kernel     link     lo local
      127.0.0.0 8            local       127.0.0.1   kernel     host     lo local
      127.0.0.1              local       127.0.0.1   kernel     host     lo local
127.255.255.255          broadcast       127.0.0.1   kernel     link     lo local
  192.168.100.0          broadcast   192.168.100.8   kernel     link   eth0 local
  192.168.100.8              local   192.168.100.8   kernel     host   eth0 local
192.168.100.255          broadcast   192.168.100.8   kernel     link   eth0 local
         fe80:: 64                                   kernel            eth0 
        default        unreachable                   kernel              lo unspec
            ::1              local                     none              lo local
fe80::20c:29ff:fe76:c428              local                     none              lo local
         ff00:: 8                                                      eth0 local
        default        unreachable                   kernel              lo unspec

The arp command on Linux is used to show the MAC addresses on network devices. This is how you see MAC addresses that are associated with devices.

[email protected]:~$ arp -a
? (192.168.100.1) at c4:04:15:4d:44:24 [ether] on eth0

The sudo routef command will flush the routing table entirely. This is a command that you would use with caution.

1 responses to “Using the route command on Linux to show the routing table.

Leave a Reply