Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 17244  / 1 Year ago, sat, may 13, 2023, 5:58:31

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?


More From » networking

 Answers
3

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 ...
fi

[#27092] Sunday, May 14, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
unsmmoth

Total Points: 72
Total Questions: 113
Total Answers: 95

Location: Thailand
Member since Tue, Oct 6, 2020
4 Years ago
;