- route
$ sudo route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
You need to be root to execute route.
The -n option means that you want numerical IP addresses displayed, instead of the corresponding host names. - netstat
$ netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
The -r option specifies that you want the routing table. The -n option is similar to that of the route command. - ip
$ ip route list
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.103
default via 192.168.0.1 dev eth0
Initially a Linux command-line interface blog, it has evolved to cover increasingly more GUI app topics. Instead of just giving you information like some man page, I illustrate their usage in real-life scenarios.
Monday, May 5, 2008
How to Display Routing Table
To display the kernel routing table, you can use any of the following methods:
Subscribe to:
Post Comments (Atom)
4 comments:
You don't need to be root to execute route.
Use the full path of the command.
$ /sbin/route
But you have 5 routing tables. How to Display e.g local or default by route command??
I know you can do it with the ip command ( ip route show table main, ip route show table local )
you don't, route is hard wired to show the main table
Thanks for this post!
Post a Comment