[Lxc-users] Set default GW

Daniel Lezcano daniel.lezcano at free.fr
Wed Jun 9 20:09:50 UTC 2010


On 06/09/2010 09:15 PM, Bodhi Zazen wrote:
> 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 ?
>    

Unfortunately, no yet. It is in the TODO list :/





More information about the lxc-users mailing list