I have Ubuntu 13.10, Saucy Salamander x64 running as a guest in VirtualBox (with Windows 7 as a host).

I wrote this /etc/network/interfaces because I need to add a large number of permanent, manual static routes:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet dhcp
    up ip -force -b /etc/network/eth1-routes

eth1-routes contains several lines of the form:

route add via 172.x.x.x dev eth1

where 172.x.x.x is the gateway that VBox NAT gives me.

By running netstat -nr it appears that all of my manual routes have been successfully added, including routes to get to two DNS servers via 172.x.x.x.

However, network manager says that both devices are "not managed". If I set /etc/NetworkManager/NetworkManager.conf managed=true, network manager works again but my routes are lost. So my current compromise is to set managed=false and comment out the eth0 lines in /etc/network/interfaces.

Is there a way to have a device be managed and still do manual routes as above?

3 Answers 3


Network Manager manages its own static routes - open network manager and select "wired connection 1". Select edit. select IPv4 tab. At the bottom of this page is a button for "Routes". That is where you add them. When done NM writes to a file with root permissions in its /etc/NetworkManager/system-connections/ directory called "Wired connection 1"

Example follows

ls -l /etc/NetworkManager/system-connections/
total 4.0K
-rw------- 1 root root 216 Aug 26 10:38 Wired connection 1

sudo cat /etc/NetworkManager/system-connections/Wired\ connection\ 1


id=Wired connection 1



Where is the destination network and is the gateway.


Network Manager does not recognize the statements you wrote in /etc/network/interfaces.

So your can add your script eth1-routes as a dispatcher script for Network Manager in /etc/network/if-up.d/. It will be run every time an interface goes up. Maybe you have to write in your script an "if clause" to only add the routes if eth1 comes up. Like this:

if [ "$IFACE" == "eth1" ]; then
  route add ...
  route add ...

If you want to add a route to Ubuntu that persists reboot and does not use the default interface as the gateway then you may want to add a route statement to the NetworkManager configuration file for the specific interface.

Add a route to the /etc/NetworkManager/system-connections/"connection name" configuration file by adding the route statement to the configuration file for (assuming IPv4). The route has four parts; "the first being the destination IPv4 network or address (network byte order), the second the destination network or address prefix (1 - 32), the third being the next-hop (network byte order) if any, and the fourth being the route metric".


This is the equivalent of setting the route using the following route statement:

route add -net netmask gw

The route keyname is defined in Table 12 in the NetmorkManager developer documentation. Please see the following URL for more information: https://developer.gnome.org/NetworkManager/0.9/ref-settings.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.