[Lxc-users] Network setup

Papp Tamas tompos at martos.bme.hu
Thu Jun 30 19:41:29 UTC 2011


On 2011-06-30 20:55, Jason McKellar wrote:
> 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

Here you can define also the iface of the container:
lxc.network.name = eth0

The network.link can be br0 (actually I don't know, it could work also 
with br0:0, but i'm not sure).

In the interfaces file supposed to be this:

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
*    bridge_stp off
    bridge_maxwait 0*

*auto br0:0*
iface br0:0 inet static
    address 192.168.10.75
    netmask 255.255.255.248
    # not necessary gateway 192.168.10.73


So try it with these changes, I hope it will be enough and help:)

tamas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20110630/23aff690/attachment.html>


More information about the lxc-users mailing list