Static routing

Hi,
Trying to configure dNFS with multipath I ran into the need of routing traffic from a specific devices (10G), this article describing how to do this in the Operating System (Centos/Redhat/Oracle).

There are 2 different ways of configuring persistent static routes.

The first approach requires adding entries for each device (NIC) to the files
/etc/sysconfig/network-scripts/route-eth[X]
For eth0, the file would be
/etc/sysconfig/network-scripts/route-eth0

Example:
echo "192.168.10.30 via 192.168.10.10" >> /etc/sysconfig/network-scripts/route-eth0
echo "192.168.10.32 via 192.168.10.12" >> /etc/sysconfig/network-scripts/route-eth1

To add the routes instantly, run the script /etc/sysconfig/network-scripts/ifup-routes. It takes the device name as input. The script is always run at boot time so the static routes are recreated after reboots.

Example:
/etc/sysconfig/network-scripts/ifup-routes eth0
/etc/sysconfig/network-scripts/ifup-routes eth1

The second approach involves adding routes using the "route" statement. Executing the "route" statement will add the route.

To ensure the routes are persistent, one has to edit the /etc/rc.local file and add the static routes to this file. This file is run once at boot time. Add the following lines to the /etc/rc.local file.

Example:
route add -net 192.168.10.30 netmask 255.255.255.255 dev eth0
route add -net 192.168.10.32 netmask 255.255.255.255 dev eth1

Yossi

Comments

Popular posts from this blog

Data Guard - Changing IP Addresses

Install Oracle Internet Directory (OID) in Standalone mode

Fixing & Registering ORACLE_HOMES in Central Inventory