Thursday, September 24, 2009

Static Routes

To add a static route to say the network from your machine through your gateway router who's IP is

route add -net netmask gw dev eth0

will add the route to your kernel and it will be available immediately. However this will not survive a reboot.
To make this persistent after a reboot you need to input the route into a configuration file

on Ubuntu edit


and Red hat / Centos / Fedora

edit /etc/sysconfig/network-scripts/route-eth0

if the route-eth0 file file does not exist (it probably won't) then create it
and add the following via

save the file and then restart networking to read in the new route
/etc/init.d/networking restart

No comments: