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 10.0.0.0/8 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?
Best Answer
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 ifeth1
comes up. Like this: