Ubuntu static routes…easy right? Well I thought so as well until recently I ran into an issue while configuring an installation of Ubuntu 12.04 where I could not get the system in question to maintain a series of static routes I had added to the system. For some reason, which I am still not 100% comfortable with, the system would fail to install the routes upon reboot.
For this requirement for Ubuntu static routes I initially tried adding the routes to /etc/network/interfaces file which according to many sources should have worked just fine. This is after all the recommended solution in most (or many) scenarios.
I ended up taking another approach to get these routes to be persistent after reboots.
Here is a video walking you through the required steps to get this done with a step by step below.
To do this try the following:
once created you will need to make sure the file is executable with the following
Now that you have created the file to hold the routes and set the permissions correctly it is time to edit the file itself.
Using your favorite editor execute something like
once open you will need to add the desired routes in the format below
Next we will need to ensure the added file is processed
The only thing left to do at this point is to make sure that your changes have worked. In my case I was able to simply restart the system to verify operation as this particular box was not yet in production. PLEASE make sure to verify that the system you are modifying is not production before testing or modifying.