I have used Ubuntu since Ubuntu 8.10; today I'm working with Ubuntu 12.04 Server.
I am having difficulty keeping static routes on booting. I would usually put the route commands
/sbin/route add -net <IP>/<MASK> <GW> dev <ethX>
in /etc/rc.local
or I would create a file (named routes
) inside the directory /etc/network/if-up/
, but I notice that on Ubuntu 12.04 it isn't working.
If I type the commands in the shell, they work, but the same commands don't work when they are in the specified file.
I already tried to change the file name to other names thinking that my file name (routes
) could be erroneous in Ubuntu 12.04, but that also did not work.
I notice also that command /sbin/ifconfig
works, less the /sbin/route
.
What changed in network set-up?
How can I define static routes on Ubuntu 12.04?
Best Answer
You can put static routes in
/etc/network/interfaces
: