In Linux operating system, routing table is used by the computer networks or servers to stores the routes of the destinations that responsible for forwarding. Routing tables contain a list of IP addresses and each of IP addresses identifies a network gateway. In this post, i will show you three ways to check and display the linux Routing Table. This command has been tested on CentOS 6.4 server.
Method 1. Display routing table using “netstat -rn” :
[root@centos64 ~]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
Method 2. Display routing table using “ip route show” :[root@centos64 ~]# ip route show
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.44
169.254.0.0/16 dev eth0 scope link metric 1002
default via 192.168.1.1 dev eth0
3. Display routing table using “route -n” :[root@centos64 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
0 comments:
Post a Comment