The network routing table defines the route to particular network destinations. In Linux, it is stored in the Routing Information Base (RIB).

The routing table can be displayed on older Linux systems using route and netstat commands at the terminal. Both are part of the net-tools suite, which is now deprecated and slowly replaced by the iproute2 suite.

iproute2 is installed in most new Linux systems, but if it doesn't, it usually is available in the repository of the default package manager thus can easily be installed.

Steps to view network routing table in Linux:

  1. Launch a terminal application.
  2. Install iproute suite (optional, if your system don't already have it installed).
    $ sudo apt update && sudo apt install --assume-yes iproute2 #Ubuntu and Debian
  3. View full network route information table using ip tool.
    $ ip route list
    default via dev ens33 proto dhcp src metric 100 dev ens33 proto kernel scope link src dev ens33 proto dhcp scope link src metric 100
  4. View route information for specific network segment.
    $ ip route list dev ens33 proto kernel scope link src
  5. Select particular route using grep.
    $ ip route list | grep ^default
    default via dev ens33 proto dhcp src metric 100

    This is useful for people who are used to grep rather than having to memorize all the switches for the ip route command.

Discuss the article:

Comment anonymously. Login not required.