[Lxc-users] LXC Container: Network Configuration

Gordon Henderson gordon at drogon.net
Thu Dec 1 18:14:06 UTC 2011


On Thu, 1 Dec 2011, Patrick Kevin McCaffrey wrote:

> Thanks a bunch, Gordon.  I ran route -n inside the container, as saw 
> there was no gateway.  Assigning 192.168.80.1 (the address of br0) as 
> the default gateway inside the container works beautifully.

I think sometimes we overlook the obvious! Glad its going now.

> I can now 
> apt-get from the container, and ping it from another subnet too.  I had 
> been playing with the "gateway" setting in /etc/network/interfaces on 
> the host machine, but it seems like everything worked (as far as the 
> machine acting as my router, and each subnet having access to the 
> Internet and each other) without defining a default gateway, so it 
> totally slipped my mind to try assigning one inside the container.

My containers don't look at /etc/network/* at all during startup - the 
networing is setup in /etc/init.d/rcS.

I'm actually switching to using file-rc in my containers because what the 
need to do to "boot" is really very minimal and I can then trivially 
disable things by editing them out of one config file (/etc/runlevel.conf)

One other thing you might want to check is the NAT on the host - if you're 
not careful to exclude each LAN (or bridged vlan) subnet, you can end up 
sending data through the NAT tables. It may be that smoothwall does this 
for you, but it's always handy to check.

Cheers,

Gordon




More information about the lxc-users mailing list