FYI: I just got this working myself today.
The answer to this will not be found by reading the man page for the route command, unfortunately. Since I have struggled with this I happen to know a little bit about how this works in ubuntu and other distros as well. The reason you will not find the answer in the route man page is because this is handled differently depending on the distribution.
What is gathered together in RedHat's /etc/sysconfig dir is mostly in /etc/network in ubuntu so that is the best place to look first when you need to manually edit some networking or interface properties. And as to the very specific static-route file that you get in other distros, this does not exist anywhere in ubuntu. Rather, to add a static route in ubuntu you add it to the interfaces file immediately under the interface block that will be affected by it, as such:
Code:
root@isengard:/etc/network# more interfaces
auto lo
iface lo inet loopback
iface eth0 inet static
address 10.80.80.1
netmask 255.0.0.0
gateway 10.44.65.1
# static routes
up route add -net 10.10.11.0/24 gw 10.0.0.1 dev eth0
up route add -net 10.10.12.0/24 gw 10.0.0.1 dev eth0
auto eth0
Remember a couple of things though. If you add these routes simple using the route command, you will lose them next time your networking is restarted, machine is rebooted, etc. Also, if you go this route to make them permanent (or static) then you need to restart networking to make use of the new routes, via:
Code:
sudo /etc/init.d/networking restart
If you get an error saying something to the effect that the interfaces file could not be read then you are dealing with either a syntax problem or a placement problem. Be careful to place the static routes under the interface you want them to affect.
Bookmarks