Breaking News
Coming soon "Change Your Life Now With A Career in Technology" check it out →

Ubuntu Static Routes

Ubuntu Static Routes

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:

touch /etc/init.d/filenamehere
  (this will create the file to hold your routes with a name that makes sense to you)

once created you will need to make sure the file is executable with the following

chmod +x /path/to/your/file/created/above ( in this case /etc/init.d/filenamehere )

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

nano /etc/init.d/filenamehere

once open you will need to add the desired routes in the format below

route add netmask gw

Next we will need to ensure the added file is processed

update-rc.d /etc/init.d/filenamehere defaults

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.





Written by Daddy

Leave A Reply