[Lxc-users] Network setup

Jason McKellar jason at deadtreepages.com
Thu Jun 30 18:55:57 UTC 2011


Hello,
I have been trying for quite sometime to get the network setup in an
LXC container (I am using debian wheezy where LXC comes standard).

I have created the container and can start it fine, but no networking works.

My host /etc/networking/interfaces is:

auto br0
iface br0 inet static
   bridge_ports eth0
   bridge_fd 0
   address 192.168.10.74
   netmask 255.255.255.248
   gateway 192.168.10.73
   dns-nameservers 8.8.8.8

iface br0:0 inet static
   address 192.168.10.75
   netmask 255.255.255.248
   gateway 192.168.10.73

Which works fine, ifconfig shows br0 and br0:0 with the correct addresses.

I have my lxc config as:

lxc.tty = 4
lxc.pts = 1024
lxc.rootfs = /var/lib/lxc/vm0/rootfs
lxc.cgroup.devices.deny = a
# /dev/null and zero
lxc.cgroup.devices.allow = c 1:3 rwm
lxc.cgroup.devices.allow = c 1:5 rwm
# consoles
lxc.cgroup.devices.allow = c 5:1 rwm
lxc.cgroup.devices.allow = c 5:0 rwm
lxc.cgroup.devices.allow = c 4:0 rwm
lxc.cgroup.devices.allow = c 4:1 rwm
# /dev/{,u}random
lxc.cgroup.devices.allow = c 1:9 rwm
lxc.cgroup.devices.allow = c 1:8 rwm
lxc.cgroup.devices.allow = c 136:* rwm
lxc.cgroup.devices.allow = c 5:2 rwm
# rtc
lxc.cgroup.devices.allow = c 254:0 rwm

# mounts point
lxc.mount.entry=proc /var/lib/lxc/vm0/rootfs/proc proc nodev,noexec,nosuid 0 0
lxc.mount.entry=devpts /var/lib/lxc/vm0/rootfs/dev/pts devpts defaults 0 0
lxc.mount.entry=sysfs /var/lib/lxc/vm0/rootfs/sys sysfs defaults  0 0

lxc.utsname = vm0
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0:0
lxc.network.ipv4 = 192.168.10.75/29
lxc.network.veth.pair = vethvm0

My container's /etc/network/interfaces file is:

auto eth0
iface eth0 inet static
   address 192.168.10.75
   netmask 255.255.255.248
   gateway 192.168.10.73


When I start the container and try to ping anywhere I get destination
unreachable.
I just want my host system and my container to each have a static IP
address (bound to a single physical interface).

I recently came from using FreeBSD jails, so am I going about this the
wrong way for LXC?

Thanks,

Jason




More information about the lxc-users mailing list