How To Display Routing Table In Linux

The routing table is used to show you where various different network subnets will be routed to. Here are three different commands that you can use to print out the routing table in Linux.

If you’re instead trying to create a new static route in Linux check out our guide here.

Using ip command

The current recommended way of printing the routing table in Linux is with the ip command followed by route, as demonstrated below.

[root@centos7 ~]# ip route
default via dev eno16777736  proto static  metric 100 dev eno16777736  proto kernel  scope link  src  metric 100 dev virbr0  proto kernel  scope link  src

If you’re in a hurry you can also shorten this to ‘ip r’ which will print the same output. While this is the current recommended method of printing out the routing table in Linux, you will see that the output doesn’t look as nice as older options.

Check out our IP command examples for further information on how you can use this to display networking information.

Using netstat command

While this is a popular way of printing out routing information in Linux, netstat is actually deprecated and replaced instead with ip route – it even says so in the manual page. Nevertheless as it is still widely used, we have included it here.

Netstat combined with the -r option will display the kernel routing tables. This is commonly used with the -n option, which will only show numerical addresses rather than performing any sort of name resolution.

[root@centos7 ~]# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface         UG        0 0          0 eno16777736   U         0 0          0 eno16777736   U         0 0          0 virbr0

Using route command

The manual page for route also states that it is obsolete and has been replaced by the ip route command previously mentioned, again as this is still used, here’s an example of it. Like netstat, the -n option is used to display numeric information only.

[root@centos7 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    100    0        0 eno16777736   U     100    0        0 eno16777736   U     0      0        0 virbr0


As we have seen there are a few ways to display the routing information in Linux, however most are now considered obsolete with ‘ip route’ being the current recommended method, despite the output in my opinion not looking as neat as the others.

  1. your ip route example only works that way if you have 1) no dns servers configured or 2) unreachable dns servers configured.

  2. just what I needed, thanks!

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>