Howto add static route on CentOS or RedHat RHEL

Howto add static route on CentOS or RedHat RHEL

1. Adding Routes

[root@localhost ~]# route add -net 10.4.3.0 netmask 255.255.255.0 gw 192.168.129.55
[root@localhost ~]#

Or

[root@localhost ~]# route add -net 10.4.2.0 netmask 255.255.255.0 dev eth0
[root@localhost ~]#

2. Show routing table

[root@localhost ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.129.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0
10.4.3.0 192.168.129.55 255.255.255.0 UG 0 0 0 eth0
10.4.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.129.2 0.0.0.0 UG 0 0 0 eth0
[root@localhost ~]#
[root@localhost ~]# netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.129.0 * 255.255.255.0 U 0 0 0 eth0
10.4.3.0 192.168.129.55 255.255.255.0 UG 0 0 0 eth0
10.4.2.0 * 255.255.255.0 U 0 0 0 eth0
default 192.168.129.2 0.0.0.0 UG 0 0 0 eth0
[root@localhost ~]#

That’s all. Thanks for using IThelpblog.com.

 

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>