LXC container and static route

juniper

Renowned Member
Oct 21, 2013
84
0
71
Hi,

i have one container with 2 network card/connection

i have to set one static route, but using (for example) in /etc/network/interfaces

up route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.10.200.1

doesn't work

suggestion?

thanks in advance
 
obviously the same command from shell works fine...

Should work also in /etc/network/interfaces - but depends on the container template you have; not in all distros /etc/network/interfaces is processed during startup.
 
can you post your /network/interfaces file?

i have two virtual interfaces...
Code:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
   address 192.168.18.180
   netmask 255.255.240.0
   gateway 192.168.16.1
   up route add -net 10.110.0.0/16 gw 192.168.18.200

auto eth1
iface eth1 inet static
   address 10.56.153.131
   netmask 255.255.255.0

auto eth2
iface eth2 inet static
   address 10.56.153.132
   netmask 255.255.255.0

auto eth3
iface eth3 inet static
   address 10.56.153.133
   netmask 255.255.255.0

auto eth4
iface eth4 inet static
   address 10.56.153.134
   netmask 255.255.255.0
 
Works here also on debian buster with
post-up route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.1.1.2
Where do you put it? Into what file? /network/interfaces file does NOT exist in the containers...
Does it stay after reboot?