[lxc-users] Issue with networking when bridging to vlan interface

Lai Wei-Hwa whlai at robco.com
Tue Mar 26 15:44:38 UTC 2019


Has anyone implemented something like this successfully? Can someone point me in the right direction? 

Thanks! 
Lai 


From: "Lai Wei-Hwa" <whlai at robco.com> 
To: "lxc-users" <lxc-users at lists.linuxcontainers.org> 
Sent: Tuesday, March 19, 2019 3:13:38 PM 
Subject: [lxc-users] Issue with networking when bridging to vlan interface 

Hi Everyone, 

Here's my scenario. My host has 4 nics which are bonded (bond0). I want to have different containers using different vlans. Here is my host interfaces file: 


source /etc/network/interfaces.d/* 

###################### 
# Loopback interface # 
###################### 

auto lo 
iface lo inet loopback 

####################### 
# Physical Interfaces # 
####################### 

auto eno1 
iface eno1 inet manual 
bond-master bond0 
bond-primary eno1 

auto eno2 
iface eno2 inet manual 
bond-master bond0 

auto eno3 
iface eno3 inet manual 
bond-master bond0 

auto eno4 
iface eno4 inet manual 
bond-master bond0 


########################## 
# BONDED NETWORK DEVICES # 
########################## 

auto bond0 
iface bond0 inet manual 
bond-mode 4 
bond-slaves none 
bond-miimon 100 
bond-lacp-rate 1 
bond-slaves eno1 eno2 eno3 eno4 
bond-downdelay 200 
bond-updelay 200 
bond-xmit-hash-policy layer2+3 


#################### 
# RAW VLAN DEVICES # 
#################### 

iface bond0.100 inet static 
vlan-raw-device bond0 

iface bond0.101 inet static 
vlan-raw-device bond0 

iface bond0.102 inet static 
vlan-raw-device bond0 

iface bond0.103 inet static 
vlan-raw-device bond0 


########################## 
# BRIDGE NETWORK DEVICES # 
########################## 

auto br0 
iface br0 inet static 
bridge_ports bond0 
bridge_maxwait 10 
address 10.9.0.188 
netmask 255.255.0.0 
broadcast 10.9.255.255 
network 10.9.0.0 
gateway 10.9.0.1 
dns-nameservers 10.1.1.84 8.8.8.8 

auto br0-100 
iface br0-100 inet manual 
bridge_ports bond0.100 
bridge_stp off 
bridge_fd 0 
bridge_maxwait 0 

auto br0-101 
iface br0-101 inet manual 
bridge_ports bond0.101 
bridge_stp off 
bridge_fd 0 
bridge_maxwait 0 

auto br0-102 
iface br0-102 inet manual 
bridge_ports bond0.102 
bridge_stp off 
bridge_fd 0 
bridge_maxwait 0 

auto br0-103 
iface br0-103 inet manual 
bridge_ports bond0.103 
bridge_stp off 
bridge_fd 0 
bridge_maxwait 0 

I have create a profile for a container to use vlan100 (br0-100) 

config: {} 
description: "" 
devices: 
eth0: 
nictype: bridged 
parent: br0-100 
type: nic 
root: 
path: / 
pool: default 
type: disk 
name: vlantest 
used_by: 
- /1.0/containers/v100 

The interface file in my container: 

source /etc/network/interfaces.d/*.cfg 

# The loopback network interface 
auto lo 
iface lo inet loopback 

# The primary network interface 
auto eth0 
iface eth0 inet static 
address 10.9.100.101 
netmask 255.255.255.0 
network 10.9.100.0 
gateway 10.9.100.1 
broadcast 10.9.100.255 
dns-nameservers 10.1.1.84 

ifconfig in container: 

eth0 Link encap:Ethernet HWaddr 00:16:3e:40:16:9c 
inet6 addr: fe80::216:3eff:fe40:169c/64 Scope:Link 
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 
RX packets:12 errors:0 dropped:0 overruns:0 frame:0 
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 
collisions:0 txqueuelen:1000 
RX bytes:1016 (1.0 KB) TX bytes:1192 (1.1 KB) 

eth1 Link encap:Ethernet HWaddr 00:16:3e:42:12:66 
inet6 addr: fe80::216:3eff:fe42:1266/64 Scope:Link 
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 
RX packets:14 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:1700 (1.7 KB) TX bytes:508 (508.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:65536 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:1 
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) 

What am I doing wrong here? Container creates an additional interface for some reason (eth1) but neither get addresses. 

Best Regards, 

Lai Wei-Hwa 
IT Administrator 
T. (514) 367-2252 ext 6308 C. (514) 218-7400 [ mailto:whlai at robco.com | whlai at robco.com ] 
Montreal - Toronto - Edmonton [ https://www.robco.com/ | www.robco.com ] 

ISO 9001 / 14001 


_______________________________________________ 
lxc-users mailing list 
lxc-users at lists.linuxcontainers.org 
http://lists.linuxcontainers.org/listinfo/lxc-users 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20190326/56b05de1/attachment.html>


More information about the lxc-users mailing list