Karmic Koala
To add a permanent static route to a Karmic Koala system with one NIC, you need to edit the
/etc/network/interfaces file. The following section needs to be replaced:
# The primary network interface
auto eth0
#iface eth0 inet dhcp
Modify as follows:
# The primary network interface
auto eth0
iface eth0 inet dhcp
up route add -net 10.8.0.0 netmask 255.255.255.0 gw 192.168.0.3
down route del -net 10.8.0.0 netmask 255.255.255.0 gw 192.168.0.3
Precise Pangolin (12.04)
With the Precise Pangolin, I did it by adding a script called add_route to /etc/network/if-up.d:
#!/bin/sh
I never added a corresponding script (del_route) to /etc/if-down.d, but that seems to be OK.
#if [ "$IFACE" = "eth0" ]; then
route add -net 10.8.0.0/24 gw 192.168.0.18
#fi
Trusty Tahr (14.04)
With Trusty Tahr, I was adding the route command as a line to the /etc/rc.local script:
...
The route command needs to be before the "exit 0" line!
route add -net 192.168.1.0/24 gw 192.168.0.3
exit 0
MacOS X 10.8 (Mountain Lion)
And here is how it is done on MacOS X 10.8: http://nellen.it/blog/2012/01/permanent-static-routes-for-mac-os-x. They details of how to to it in MacOS X have changed over time; here is the way how it was done on MacOS X 10.4.7.