2

I'm trying to start lxc containers with their own public ip address on the network. This is what I've tried so far:

On the host

The host machine has an IP address of 192.168.255.254. I added a bridge, br0, in the same subnet:

auto eth1
iface eth1 inet static
    address 192.168.255.254
    netmask 255.255.0.0
auto br0
iface br0 inet static
    address 192.168.255.1
    netmask 255.255.0.0

I've also enabled ip forwarding (net.ipv4.ip_forward = 1 in /etc/sysctl.d/20-lxc.conf as per this guide)

In /var/lib/lxc/$NAME/config:

lxc.network.type=veth
lxc.network.link=br0
lxc.network.name=eth1

On the container

In /etc/network/interfaces:

auto eth1
iface eth1 inet dhcp
    address 192.168.255.99
    netmask 255.255.0.0

When I try to start the container, it can't get an IP address:

cloud-init-container: emitted ifup for eth1
cloud-init start-local running: Thu, 11 Apr 2013 07:27:54 +0000. up 1592.73 seconds
no instance data found in start-local
cloud-init-nonet waiting 120 seconds for a network device.
cloud-init-nonet gave up waiting for a network device.
ci-info: lo    : 1 127.0.0.1       255.0.0.0       .
ci-info: eth1  : 1 .               .               00:16:3e:cf:20:b5
route_info failed

This is the output of route:

default         10.0.2.2        0.0.0.0         UG    0      0        0 eth0
default         10.0.2.2        0.0.0.0         UG    100    0        0 eth0
10.0.2.0        *               255.255.255.0   U     0      0        0 eth0
10.0.3.0        *               255.255.255.0   U     0      0        0 lxcbr0
192.168.0.0     *               255.255.0.0     U     0      0        0 eth1
192.168.0.0     *               255.255.0.0     U     0      0        0 br0

What am I doing wrong?

0 Answers0