Tag Archives: netstat

How to check routes (routing table) in linux

The route is nothing but a path or way to the specific or range of destination IP addresses. Linux kernel maintains these routes called as kernel routing table and will route the traffic accordingly.

You can use any one of them to display the routing table


Command route

The command route is used to modify and check the existing routes. To check the routing table using route command,

$ route

This will display the list of routes currently configured

Command: route -n 

$ route -n
Kernel IP routing table
Destination    Gateway       Genmask        Flags  Metric Ref Use Iface        UG     0      0   0   wlan0  U      9      0   0   wlan0

This will give the output with out resolving the names

Command netstat

This command gives the statistics about the network. With this command you can do more than just printing routing table,

Print network connections,
routing tables,
interface statistics,
masquerade connections,  and
multicast memberships

To check the routing table,

Command: nestat -rn

$ netstat -rn
Kernel IP routing table
Destination  Gateway      Genmask        Flags MSS Window irtt Iface        UG    0   0      0    wlan0  U     0   0      0    wlan0


Option -r  is to display the routing table

Option -n is not to resolve the names. Print the IP addresses only

Command IP

To check routing table using command ip 

Command: ip route list

$ ip route list
default via dev wlan0 proto static dev wlan0 proto kernel scope link src metric 9

To find hops, route of the destination and how your machine is reaching the destination you use tracepath

tracepath howto.lintel.in

Where you can replace howto.lintel.in with specific domain or IP address.

We added an updated article with more options on this topic.

Check out at https://howto.lintel.in/add-delete-routes-linux/