[Lxc-users] adding a default gateway inside a container as a non root user

Daniel Lezcano daniel.lezcano at free.fr
Thu Mar 1 21:20:28 UTC 2012


On 03/01/2012 08:32 PM, Arun M wrote:
> Hi,
>
> I am trying to add a default gateway inside a lxc container so that the application can talk to outside network. 
>
> I used lxc-setcap to set capabilities and started the container as a non-root user.
>
> lxc-execute -n alpha -f a.conf -- /bin/start.sh
>
> in start.sh :-
> #!/bin/sh
> route add default gw 169.254.100.1
> exec sh
>
> I get the following error :- 
> route: SIOCADDRT: Operation not permitted
>
> Tried adding cap_net_admin to lxc-init, making 'route' a suid program etc but did not help.
>
> The networking config is as follows:-
> lxc.network.type = veth
>
> lxc.network.flags = up
> lxc.network.link = br0
> lxc.network.name = eth1
> lxc.network.ipv4 = 169.254.100.6/24

With the 0.8.0 version, you will be able to setup the gateway directly 
from the configuration file.

   -- Daniel




More information about the lxc-users mailing list