Adding Persistent Static Routes on Ubuntu –

When you need to access networks located on a different network segment, you need to have a route set up so the PC knows how to get to the other network segment. This generally just points to your main gateway, but you may want to set up additional static routes, where you don’t want the traffic going through your main default gateway.

To set up a static route on Ubuntu so that it automatically gets created every time the PC starts, you need to modify the /etc/network/interfaces file.

The route will get set up when one of the interfaces comes up. Find the section that corresponds to the interface that this route will be set up on. Eg. eth0 or em1.

At the bottom of this section, add the following line:

Modify the above to suit the route you want to add.

Your file should now look something like this:

To make these changes take effect, you can run the following command to bring down the interface, and bring it back up again:

or simply try a reboot.

Run the following command to ensure the route has been set up correctly:


Source: adding persistent static routes on ubuntu by

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.