Persistent route in Fedora

Today I had to add a static-route on a Fedora 10 workstation to gain access to a web application. Because it needs to be persistent, survive reboots, I wanted to configure the static-route the way Fedora (Red Hat) likes it.

The script ‘/etc/sysconfig/network-scripts/ifup-routes’ is responsible for setting the route. You have to create a ‘route-eth1’ file depending on the interface the static route has to be configured on.

touch /etc/sysconfig/network-scripts/route-eth1 # echo "to 130.37.136.220 via 192.168.129.15" > /etc/sysconfig/network-scripts/route-eth1

You can check if it works by calling the script followed by the interface name.

/etc/sysconfig/network-scripts/ifup-routes eth1

Use the route command to see if the new route has been added to the route table.