Network routing table in Linux
are stored in Routing Information Base (RIB
) and could traditionally be viewed using the route
and netstat -r
command at the terminal. Both route
and netstat
are part of net-tools
suite, which is now deprecated.
Both tools are still available for some systems though it is slowly being replaced by the iproute2
suite of tools.
iproute
suite (optional, if your system don't already have it installed). $ sudo apt update && sudo apt install --assume-yes iproute2 # Ubuntu and Debian
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
$ ip route list 192.168.111.0/24 192.168.111.0/24 dev ens33 proto kernel scope link src 192.168.111.128
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.
Comment anonymously. Login not required.