Configuring static routes
From Peter Pap's Technowiki
Revision as of 04:21, 19 November 2012 by Ppapa (talk | contribs) (Created page with "So your server has multiple interfaces and you want some of your traffic to use a different interface. Static route configuration is stored per-interface in a /etc/sysconfig/net...")
So your server has multiple interfaces and you want some of your traffic to use a different interface. Static route configuration is stored per-interface in a /etc/sysconfig/network-scripts/route-interface file.
1. Go to the /etc/sysconfig/network-scripts/ directory
cd /etc/sysconfig/network-scripts/
2. Create a file called route-interface, where interface is the name of the interface that will be using the static route. In this example, we'll use eth1.
vim route-eth1
3. Add an entry for the route in the format X.X.X.X/Y via X.X.X.X dev interface. In this example, the network we want to get to is 192.168.50.0/24, using gateway 192.168.40.1, on interface eth1
192.168.50.0/24 via 192.168.40.1 dev eth1
4. Save the file and restart the network. You're done!