How to add permanent static routes in Cent OS:-
Configuring Static Routes :-
Static route configuration is stored in a /etc/sysconfig/network-scripts/route-interface file. For example, static routes for the eth0 interface would be stored in the /etc/sysconfig/network-scripts/route-eth0 file.
If file does not exist on your system please create it using “touch” or “vi” command and add following parameters.
e.g . # vi /etc/sysconfig/network-scripts/route-eth0
The following is a template for the network/netmask format, with instructions following afterwards:
• ADDRESS0=X.X.X.X is the network number for the static route.
• NETMASK0=X.X.X.X is the netmask for the network number defined with ADDRESS0=X.X.X.X.
• GATEWAY0=X.X.X.X is the default gateway, or an IP address that can be used to reach ADDRESS0=X.X.X.X
• The following is a sample route-eth1 file using the network/netmask directives format. The default gateway is 192.168.0.1, interface eth0. The two static routes are for the 10.10.10.0/24 and 172.16.1.0/24 networks. However, as mentioned before, this example is not necessary as the 10.10.10.0/24 and 172.16.1.0/24 networks would use the default gateway anyway:
• Subsequent static routes must be numbered sequentially, and must not skip any values. For example, ADDRESS0, ADDRESS1, ADDRESS2, and so on.
After making this changes please restart networks services
# service network restart
You can check the routes using “route” command.