A permanent static route in Ubuntu Karmic Koala (9.10), Precise Pangolin (12.04) & Trusty Tahr (14.04)

Last modified on July 24, 2026 • 1 min read • 180 words
To add a permanent static route to a Karmic Koala system with one NIC, you need to edit the/etc/network/interfaces file.
Karmic KoalaTo 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 interfaceauto eth0#iface eth0 inet dhcpModify as follows:# The primary network interfaceauto eth0iface eth0 inet dhcpup route add -net 10.8.0.0 netmask 255.255.255.0 gw 192.168.0.3down 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#if [ "$IFACE" = "eth0" ]; then route add -net 10.8.0.0/24 gw 192.168.0.18#fiI never added a corresponding script (del_route) to /etc/if-down.d, but that seems to be OK.**Trusty Tahr (14.04)**With Trusty Tahr, I was adding the route command as a line to the /etc/rc.local script:…route add -net 192.168.1.0/24 gw 192.168.0.3exit 0The route command needs to be before the “exit 0” line!**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 .