lxc networking question

Discussion in 'Server Operation' started by CSsab, Jun 3, 2010.

  1. CSsab

    CSsab New Member

    Hi,
    I am experimenting with LXC and would like advise about configuring network interfaces on a container.

    The host /etc/network/interfaces is:

    # 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 br0
    iface br0 inet static
    address 192.168.1.150
    netmask 255.255.255.0
    broadcast 192.168.1.255
    gateway 192.168.1.1
    network 192.168.1.0
    # Bridge lxchost system
    bridge_ports eth0
    bridge_stp off
    bridge_maxwait 3
    post-up /usr/sbin/brctl setfd br0 0


    The container configuration can be:

    lxc.network.type = macvlan
    or
    lxc.network.type = veth
    or
    lxc.network.type = phys

    for example when executing a process from the host in macvlan i got this:

    root@container1:~# ifconfig
    eth0 Link encap:Ethernet HWaddr 8e:80:43:1a:31:2f
    inet addr:192.168.1.151 Bcast:0.0.0.0 Mask:255.255.255.0
    inet6 addr: fe80::8c80:43ff:fe1a:312f/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:0 (0.0 B) TX bytes:308 (308.0 B)

    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    inet6 addr: ::1/128 Scope:Host
    UP LOOPBACK RUNNING MTU:16436 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)


    I am finding that running a system inside the container is a little tricky !!

    Can anyone tell me how I might link my container from the inside to the host bridge described above and what exactly I could write in /etc/network interfaces inside the container.

    At the moment the container /etc/network/interfaces looks like this.

    auto lo
    iface lo inet loopback

    auto eth0
    iface eth0 inet static
    address 192.168.1.151
    netmask 255.255.255.0
    gateway 192.168.1.1

    This does not make sense to me.

    Thanks for any help.
     

Share This Page