Adding a Secondary Gateway / Static Route in Linux
In order to create a static Route you can enter the following command :
ip route add 192.168.1.0/24 via 192.168.1.254 dev eth0
or
route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.254 dev eth1
Note : In order to make this permanent, you would have to create a file named routes-eth0
vi /etc/sysconfig/network-scripts/route-eth0
Append the following line to the file, if the file does not exist , create new file
192.168.1.0/24 via 192.168.1.254
You could also have something like this :
GATEWAY0=192.168.1.254 NETMASK0=255.255.255.0 ADDRESS0=192.168.1.0 GATEWAY1=10.10.1.0
NETMASK1= 255.255.255.240 ADDRESS1=10.10.1.254