Monitoring, Management & Location Tracking

How to add permanent static routes in Cent OS:-

Aruba Employee

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
NETMASK0=X.X.X.X
GATEWAY0=X.X.X.X
• 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:
• ADDRESS0=10.10.10.0
• NETMASK0=255.255.255.0
• GATEWAY0=192.168.0.1
• ADDRESS1=172.16.1.0
• NETMASK1=255.255.255.0
• GATEWAY1=192.168.0.1
• 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.

# route

Reference: http://www.centos.org/docs/5/html/5.1/Deployment_Guide/s1-networkscripts-static-routes.html

Version history
Revision #:
1 of 1
Last update:
‎06-24-2014 02:56 PM
Updated by:
 
Labels (1)
Contributors
Search Airheads
cancel
Showing results for 
Search instead for 
Did you mean: 
Is this a frequent problem?

Request an official Aruba knowledge base article to be written by our experts.