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

Schorschi schorschi at dc.rr.com
Fri Mar 2 01:46:45 UTC 2012


My tactical work around was to inject the route add into /etc/rc.d/rc.local
in the rootfs template for my LXC containers, so when I create each
container rc.local is staged, did the same with /etc/resolv.conf as well.

Schorschi

-----Original Message-----
From: Arun M [mailto:arun_mah at yahoo.com] 
Sent: Thursday, March 01, 2012 11:32
To: lxc-users at lists.sourceforge.net
Subject: [Lxc-users] adding a default gateway inside a container as a non
root user

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

Any pointers ?

Thanks,
Arun

----------------------------------------------------------------------------
--
Virtualization & Cloud Management Using Capacity Planning Cloud computing
makes use of virtualization - but cloud computing also focuses on allowing
computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Lxc-users mailing list
Lxc-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-users





More information about the lxc-users mailing list