[Lxc-users] Set default GW
Bodhi Zazen
bodhi.zazen at montanalinux.org
Wed Jun 9 19:15:16 UTC 2010
Is there a way to set the default gateway in a linux container ?
If I set an ipaddress in the config file
lxc.utsname = foo
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.name = eth0
lxc.network.mtu = 1500
lxc.network.ipv4 = 192.168.0.10/24
These lines set the ip address of the guest.
Now if I use it either as a container (adding a rootfs , fstab, devices and running lxc-start -n foo) or as an application (using the system / and lxc-execute -n foo -f /lxc/foo.config /bin/bash) , everything starts as expected, I can enter the container with lxc-console, etc ...
The "problem" is the default gw is not set. I have to either add the gw manually (when running /bin/bash) or adding it to the init scripts (if running a container)
route add default gw 192.168.0.1 eth0
after running the route command everything works as expected.
So, what I am asking, is there a way of setting the default route / gw in the config file, foo.config ?
More information about the lxc-users
mailing list