add static route in Cantos and make sure it wont loose after reboot

1. Adding Routes

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


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

2. Show routing table

[root@localhost ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface U 1 0 0 eth0 UG 0 0 0 eth0 U 0 0 0 eth0 UG 0 0 0 eth0
[root@localhost ~]#
if you dont wanna loose, you can add above command to /etc.rc.local
or try this way
add routes in route-eth0 file
 static routes for the eth0 interface would be stored in the /etc/sysconfig/network-scripts/route-eth0 file. The route-interface file has two formats: IP command arguments and network/netmask directives.

The following is a sample route-eth0 file using the IP command arguments format. The default gateway is, interface eth0. The two static routes are for the and networks:

default dev eth0 via dev eth0 via dev eth0

Static routes should only be configured for other subnets. The above example is not necessary, since packets going to the and networks will use the default gateway anyway. Below is an example of setting static routes to a different subnet, on a machine in a subnet. The example machine has an eth0 interface in the subnet, and an eth1 interface ( in the subnet:

It's only fair to share...Tweet about this on TwitterShare on Google+Share on FacebookShare on LinkedInEmail this to someone
Twitter Auto Publish Powered By :