Sunday, July 15, 2007

Linux - Set static routes per ethernet device

This post will explain the way to add new static routes in Linux (RH).
The old way to do this was to add the route lines to /etc/rc.local.

The currently way to do this is to create a file named route-{Device Name} (Ex: route-eth0)
in /etc/sysconfig/network-scripts, and add the new routes for this device to the file in this format:

GATEWAY0=10.10.0.1
NETMASK0=255.0.0.0
ADDRESS0=10.0.0.0

GATEWAY1=10.2.0.1
NETMASK1=255.255.0.0
ADDRESS1=192.168.0.0

NOTE: http://kbase.redhat.com/faq/FAQ_79_2561.shtm

Oded.