add static route under linux

I needed to add a static route on our Asterisk CentOS Linux box to force traffic out the second router to our voice service provider.

Here are three ways;

1.  Note; does not survive a re-boot

root@pbx~]# ip route add 192.168.100.0/24 via 192.168.5.253

2.  Add the route to rc.local

root@pbx ~]# nano /etc/rc.local

3.  Add it to route-eth0, I think this the best way but you will need to restart the the network with /etc/init.d/network restart

root@pbx ~]#nano /etc/sysconfig/network-scripts/route-eth0

reference;

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

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