2

I have a server running Ubuntu 14 (server edition), connected to a network using two network adapters. These two network adapters are configured in a bond to have network redundancy (in case one of them breaks down). This server has a static IP address configured

On this server, I installed LXC and created a new container. I want to connect this container directly to the network as well, so I created a bridge.

This is the network configuration (/etc/network/interfaces) on my host server:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto p2p3
iface p2p3 inet manual
bond-master bond0

auto p2p4
iface p2p4 inet manual
bond-master bond0

# Set up a bonding NIC
auto bond0
iface bond0 inet manual
bond-mode active-backup
bond-miimon 100
bond-slaves p2p3 p2p4

# Set up bridge
auto br0
iface br0 inet static
address 103.129.12.95
gateway 103.129.12.1
netmask 255.255.255.0
dns-nameservers 103.129.12.2 103.129.12.3
bridge-ports bond0
up ip route add 192.168.105.0/24 via 103.129.12.23

And this is the container configuration:

lxc.include = /usr/share/lxc/config/ubuntu.common.conf
lxc.rootfs = /var/lib/lxc/mailman/rootfs
lxc.mount = /var/lib/lxc/mailman/fstab
lxc.utsname = mailman
lxc.arch = amd64
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.hwaddr = 12:ae:9a:12:ac:32
lxc.start.auto = 0
lxc.loglevel = 0
lxc.network.ipv4 = 103.129.12.96
lxc.network.ipv4.gateway = 103.129.12.1

And the network configuration of the container (/etc/network/interfaces):

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

There seems to be something wrong with my configuration, because the network only works on the host machine (and doesn't on the container). Can anyone put me in the right direction here? Thanks!

1

Turns out I had to add the netmask to the container network configuration:

lxc.network.ipv4 = 103.129.12.96/24

It's better to change the container interface to manual as well:

iface eth0 inet manual

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.