Get Routing Table in Linux

Get Routing Table in Linux

The routing table is used to show how packets are to be forwarded across the network. This tutorial demonstrates how to get routing table in the Linux.

In Linux systems, the ip command can be used for manipulating routing table. Run the following command to get routing table:

ip route show

Output example:

default via 192.168.0.1 dev ens33 proto dhcp src 192.168.0.252 metric 100
192.168.0.0/24 dev ens33 proto kernel scope link src 192.168.0.252 metric 100
192.168.0.1 dev ens33 proto dhcp scope link src 192.168.0.252 metric 100

To display only the routing for a specific network, provide additional argument as follows:

ip route show 192.168.0.0/24

Output example:

192.168.0.0/24 dev ens33 proto kernel scope link src 192.168.0.252 metric 100

Leave a Comment

Cancel reply

Your email address will not be published.