Internal LAN on LXC

When I wrote my previous post about setting up LXC, one of the things I found was that when installing the lxc package, it went ahead and created an “lxcbr0” interface.

It turns out that this interface is actually an “internal network” which you can connect your VM’s to if you want them talking to each other directly, as opposed to any network which the host is also on.

To setup my VM’s I just added another interface and connected it to the “lxcbr0” bridge, by adding the following lines to the configuration:

lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = lxcbr0
lxc.network.hwaddr = 4a:49:43:49:79:ef

and then configuring the interface in the “interfaces” file:

auto eth1
iface eth1 inet static
    address 10.0.3.2
    netmask 255.255.255.0

Then I did the same to another VM and they were able to talk to each other.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.