Find the answer to your Linux question:
Results 1 to 2 of 2
Hello! I have created one virtual machine using lxc in Debian. In main host there are two network interfaces - eth5, eth5 and this interfaces are connected via bounding (bond0) ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2011
    Posts
    1

    bonding + bridge + lxc = virtual host routing problem


    Hello!

    I have created one virtual machine using lxc in Debian. In main host there are two network interfaces - eth5, eth5 and this interfaces are connected via bounding (bond0) and then, there is a bridge from bond0 to br0 becouse lxc requires that bridge.
    It looks like that:

    Main host configuration:


    Code:
    PLHQSRDMZ01:~# cat /etc/network/interfaces 
    auto lo
    iface lo inet loopback
    
    auto bond0
    iface bond0 inet manual
    slaves eth5 eth6
    bond-mode active-backup
    bond-miimon 100
    bond-downdelay 0
    bond-updelay 0
    
    auto br0
    iface br0 inet static
    address 10.50.12.100
    netmask 255.255.255.0
    gateway 10.50.12.1
    network 10.50.10.0
    bridge_ports bond0
    bridge_fd 0
    bridge_maxwait 0
    bridge_stp off
    Code:
    PLHQSRDMZ01:~# ifconfig 
    bond0 Link encap:Ethernet HWaddr 08:00:27:95:e4:45 
    inet6 addr: fe80::a00:27ff:fe95:e445/64 Scope:Link
    UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
    RX packets:515 errors:0 dropped:0 overruns:0 frame:0
    TX packets:132 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0 
    RX bytes:37405 (36.5 KiB) TX bytes:13712 (13.3 KiB)
    
    br0 Link encap:Ethernet HWaddr 08:00:27:95:e4:45 
    inet addr:10.50.12.100 Bcast:10.50.12.255 Mask:255.255.255.0
    inet6 addr: fe80::a00:27ff:fe95:e445/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:514 errors:0 dropped:0 overruns:0 frame:0
    TX packets:126 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0 
    RX bytes:27959 (27.3 KiB) TX bytes:13244 (12.9 KiB)
    
    eth5 Link encap:Ethernet HWaddr 08:00:27:95:e4:45 
    UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
    RX packets:514 errors:0 dropped:0 overruns:0 frame:0
    TX packets:132 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000 
    RX bytes:37345 (36.4 KiB) TX bytes:13712 (13.3 KiB)
    
    eth6 Link encap:Ethernet HWaddr 08:00:27:95:e4:45 
    UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
    RX packets:1 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000 
    RX bytes:60 (60.0 B) TX bytes:0 (0.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:8 errors:0 dropped:0 overruns:0 frame:0
    TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0 
    RX bytes:560 (560.0 B) TX bytes:560 (560.0 B)
    Code:
    PLHQSRDMZ01:~# cat /proc/net/bonding/bond0 
    Ethernet Channel Bonding Driver: v3.5.0 (November 4, 2008)
    
    Bonding Mode: fault-tolerance (active-backup)
    Primary Slave: None
    Currently Active Slave: eth5
    MII Status: up
    MII Polling Interval (ms): 100
    Up Delay (ms): 0
    Down Delay (ms): 0
    
    Slave Interface: eth5
    MII Status: up
    Link Failure Count: 0
    Permanent HW addr: 08:00:27:95:e4:45
    
    Slave Interface: eth6
    MII Status: up
    Link Failure Count: 0
    Permanent HW addr: 08:00:27:48:60:b1
    Code:
    PLHQSRDMZ01:~# cat /var/lib/lxc/plhqsrwww01/config 
    lxc.tty = 4
    lxc.pts = 1024
    lxc.rootfs = /var/lib/lxc/plhqsrwww01/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
    
    lxc.utsname = plhqsrwww01
    lxc.network.type = veth
    lxc.network.flags = up
    lxc.network.link = br0
    #lxc.network.hwaddr = 00:FF:12:34:56:00
    lxc.network.ipv4 = 10.50.12.101/25
    
    # mounts point
    lxc.mount.entry=proc /var/lib/lxc/plhqsrwww01/rootfs/proc proc nodev,noexec,nosuid 0 0
    lxc.mount.entry=devpts /var/lib/lxc/plhqsrwww01/rootfs/dev/pts devpts defaults 0 0
    lxc.mount.entry=sysfs /var/lib/lxc/plhqsrwww01/rootfs/sys sysfs defaults 0 0
    Code:
    PLHQSRDMZ01:~# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    10.50.12.0 0.0.0.0 255.255.255.0 U 0 0 0 br0
    0.0.0.0 10.50.12.1 0.0.0.0 UG 0 0 0 br0
    Virtual host configuration:
    Code:
    plhqsrwww01:~# ifconfig 
    eth0 Link encap:Ethernet HWaddr e6:7b:db:5a:dc:95 
    inet addr:10.50.12.101 Bcast:10.50.12.0 Mask:255.255.255.0
    inet6 addr: fe80::e47b:dbff:fe5a:dc95/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:19 errors:0 dropped:0 overruns:0 frame:0
    TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000 
    RX bytes:904 (904.0 B) TX bytes:384 (384.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)
    Code:
    plhqsrwww01:~# cat /etc/network/interfaces 
    auto lo
    iface lo inet loopback
    
    auto eth0
    iface eth0 inet static
    address 10.50.12.101
    netmask 255.255.255.0
    gateway 10.50.12.1
    Code:
    plhqsrwww01:~# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    10.50.12.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
    0.0.0.0 10.50.12.1 0.0.0.0 UG 0 0 0 eth0
    And using that cfg, I can ping from main host router (10.50.12.100-->10.50.12.1) from main host, virtual host (10.50.12.100-->10.50.12.101) and vurtual host can ping main host (10.50.12.101-->10.50.12.100) but virtual host can't ping router (10.50.12.101 ---xxx--- 10.50.12.1). What can be problem here?

  2. #2
    Just Joined!
    Join Date
    Jun 2013
    Posts
    1
    Quote Originally Posted by rysic View Post
    Hello!

    I have created one virtual machine using lxc in Debian. In main host there are two network interfaces - eth5, eth5 and this interfaces are connected via bounding (bond0) and then, there is a bridge from bond0 to br0 becouse lxc requires that bridge.
    It looks like that:

    Main host configuration:


    Code:
    PLHQSRDMZ01:~# cat /etc/network/interfaces 
    auto lo
    iface lo inet loopback
    
    auto bond0
    iface bond0 inet manual
    slaves eth5 eth6
    bond-mode active-backup
    bond-miimon 100
    bond-downdelay 0
    bond-updelay 0
    
    auto br0
    iface br0 inet static
    address 10.50.12.100
    netmask 255.255.255.0
    gateway 10.50.12.1
    network 10.50.10.0
    bridge_ports bond0
    bridge_fd 0
    bridge_maxwait 0
    bridge_stp off
    Problem: phisical ifaces does not known mac's from lxc ifacesa as this mac's are bound to bound0

    Solution: turn on promiscuous mode on physical slaves of the bond

    here is my /etc/network/interfaces file (debian-jessie)
    Code:
    allow-bond0 eth0
    iface eth0 inet manual
     up ip link set $IFACE promisc on
     pre-down ip link set $IFACE promisc off
    
    allow-bond0 eth1
    iface eth1 inet manual
     up ip link set $IFACE promisc on
     pre-down ip link set $IFACE promisc off
    
    allow-br0 bond0
    iface bond0 inet manual
      bond_slaves eth0 eth1
      bond_miimon 100
      bond_mode 802.3ad
    
    iface br0 inet static
      address 10.21.60.10
      netmask 255.255.255.0
      bridge_ports bond0
      bridge_maxwait 1
      pre-up ifup --allow "$IFACE" bond0
      post-down ifdown --allow "$IFACE" bond0


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •