Static routes will be added usually through “route add” command. The drawback of ‘route’ command is that, when Linux reboots it will forget static routes. But to make it persistent across reboots, you have to add it to /etc/sysconfig/network-scripts/route-<eth> .

To add static route using “route add”:

# route add -net 192.168.100.0 netmask 255.255.255.0 gw 192.168.10.1 dev eth0

Adding Persistent static route:

You need to edit /etc/sysconfig/network-scripts/route-eth0 file to define static routes for eth0 interface.

GATEWAY0=192.168.10.1
NETMASK0=255.255.255.0
ADDRESS0=192.168.100.0

GATEWAY1=10.64.34.1
NETMASK1= 255.255.255.240
ADDRESS1=10.64.34.10

Save and close the file. Restart networking:

# service network restart

Verify new routing table:

# route –n

# netstat –nr

 

0 Shares:
Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like
Read More

Managing Xen

Here are some xm and virsh commands for creating, managing, and troubleshooting xen virtual machines. Staring and Stopping…
Read More

Load Average

A very good article on Unix Load averages and how it is calculated [ http://www.linuxjournal.com/article/9001 ] . Worth…
Read More

Netapp : SNMP tips

How to enable SNMP on a netapp filer filer1> options snmp.enable onfiler1> options snmpsnmp.access                  legacy   snmp.enable                  on        filer1>…