Routing Information Base (RIB) or routing table could traditionally be viewed using the route and netstat -r command at the terminal in Linux and other Unix based systems. Both route and netstat are part of net-tools suite, which is now deprecated (though still available for most systems). It is replaced by the iproute2 suite.

Routing table could be displayed at the terminal in Linux using the ip route command from the iproute2 suite.

View 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 route table using ip tool.
    $ ip route list
    default via 192.168.111.2 dev ens33 proto dhcp src 192.168.111.128 metric 100
    192.168.111.0/24 dev ens33 proto kernel scope link src 192.168.111.128
    192.168.111.2 dev ens33 proto dhcp scope link src 192.168.111.128 metric 100
  4. View route information for specific network segment.
    $ ip route list 192.168.111.0/24
    192.168.111.0/24 dev ens33 proto kernel scope link src 192.168.111.128
  5. Select particular route using grep.
    $ ip route list | grep ^default
    default via 192.168.111.2 dev ens33 proto dhcp src 192.168.111.128 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.

Leave a comment:
Share!