<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #333333"><div>Has anyone implemented something like this successfully? Can someone point me in the right direction?<br></div><div><br></div><div data-marker="__SIG_PRE__"><div>Thanks! <br></div><div>Lai<br></div></div><br><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><b>From: </b>"Lai Wei-Hwa" <whlai@robco.com><br><b>To: </b>"lxc-users" <lxc-users@lists.linuxcontainers.org><br><b>Sent: </b>Tuesday, March 19, 2019 3:13:38 PM<br><b>Subject: </b>[lxc-users] Issue with networking when bridging to vlan interface<br></div><br><div data-marker="__QUOTED_TEXT__"><div id="zimbraEditorContainer" style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #333333" class="14"><div>Hi Everyone,<br></div><br><div>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:<br></div><br><div style="padding-left: 30px;"><br><span style="color: rgb(128, 128, 128);"><em>source /etc/network/interfaces.d/*</em></span><br><br><span style="color: rgb(128, 128, 128);"><em>######################</em></span><br><span style="color: rgb(128, 128, 128);"><em># Loopback interface #</em></span><br><span style="color: rgb(128, 128, 128);"><em>######################</em></span><br><br><span style="color: rgb(128, 128, 128);"><em>auto lo</em></span><br><span style="color: rgb(128, 128, 128);"><em>iface lo inet loopback</em></span><br><br><span style="color: rgb(128, 128, 128);"><em>#######################</em></span><br><span style="color: rgb(128, 128, 128);"><em># Physical Interfaces #</em></span><br><span style="color: rgb(128, 128, 128);"><em>#######################</em></span><br><br><span style="color: rgb(128, 128, 128);"><em>auto eno1</em></span><br><span style="color: rgb(128, 128, 128);"><em>iface eno1 inet manual</em></span><br><span style="color: rgb(128, 128, 128);"><em>        bond-master bond0</em></span><br><span style="color: rgb(128, 128, 128);"><em>        bond-primary eno1</em></span><br><br><span style="color: rgb(128, 128, 128);"><em>auto eno2</em></span><br><span style="color: rgb(128, 128, 128);"><em>iface eno2 inet manual</em></span><br><span style="color: rgb(128, 128, 128);"><em>        bond-master bond0</em></span><br><br><span style="color: rgb(128, 128, 128);"><em>auto eno3</em></span><br><span style="color: rgb(128, 128, 128);"><em>iface eno3 inet manual</em></span><br><span style="color: rgb(128, 128, 128);"><em>        bond-master bond0</em></span><br><br><span style="color: rgb(128, 128, 128);"><em>auto eno4</em></span><br><span style="color: rgb(128, 128, 128);"><em>iface eno4 inet manual</em></span><br><span style="color: rgb(128, 128, 128);"><em>        bond-master bond0</em></span><br><br><br><span style="color: rgb(128, 128, 128);"><em>##########################</em></span><br><span style="color: rgb(128, 128, 128);"><em># BONDED NETWORK DEVICES #</em></span><br><span style="color: rgb(128, 128, 128);"><em>##########################</em></span><br><br><span style="color: rgb(128, 128, 128);"><em>auto bond0</em></span><br><span style="color: rgb(128, 128, 128);"><em>iface bond0 inet manual</em></span><br><span style="color: rgb(128, 128, 128);"><em>        bond-mode 4</em></span><br><span style="color: rgb(128, 128, 128);"><em>        bond-slaves none</em></span><br><span style="color: rgb(128, 128, 128);"><em>        bond-miimon 100</em></span><br><span style="color: rgb(128, 128, 128);"><em>        bond-lacp-rate 1</em></span><br><span style="color: rgb(128, 128, 128);"><em>        bond-slaves eno1 eno2 eno3 eno4</em></span><br><span style="color: rgb(128, 128, 128);"><em>        bond-downdelay 200</em></span><br><span style="color: rgb(128, 128, 128);"><em>        bond-updelay 200</em></span><br><span style="color: rgb(128, 128, 128);"><em>        bond-xmit-hash-policy layer2+3</em></span><br><br><br></div><div style="padding-left: 30px;"><span style="color: rgb(128, 128, 128);"><em>####################</em></span><br><span style="color: rgb(128, 128, 128);"><em># RAW VLAN DEVICES #</em></span><br><span style="color: rgb(128, 128, 128);"><em>####################</em></span><br><br><span style="color: rgb(128, 128, 128);"><em>iface bond0.100 inet static</em></span><br><span style="color: rgb(128, 128, 128);"><em>vlan-raw-device bond0</em></span><br><br><span style="color: rgb(128, 128, 128);"><em>iface bond0.101 inet static</em></span><br><span style="color: rgb(128, 128, 128);"><em>vlan-raw-device bond0</em></span><br><br><span style="color: rgb(128, 128, 128);"><em>iface bond0.102 inet static</em></span><br><span style="color: rgb(128, 128, 128);"><em>vlan-raw-device bond0</em></span><br><br><span style="color: rgb(128, 128, 128);"><em>iface bond0.103 inet static</em></span><br><span style="color: rgb(128, 128, 128);"><em>vlan-raw-device bond0</em></span><br><br><br><span style="color: rgb(128, 128, 128);"><em>##########################</em></span><br><span style="color: rgb(128, 128, 128);"><em># BRIDGE NETWORK DEVICES #</em></span><br><span style="color: rgb(128, 128, 128);"><em>##########################</em></span><br><br><span style="color: rgb(128, 128, 128);"><em>auto br0</em></span><br><span style="color: rgb(128, 128, 128);"><em>iface br0 inet static</em></span><br><span style="color: rgb(128, 128, 128);"><em>bridge_ports bond0</em></span><br><span style="color: rgb(128, 128, 128);"><em>bridge_maxwait 10</em></span><br><span style="color: rgb(128, 128, 128);"><em>address 10.9.0.188</em></span><br><span style="color: rgb(128, 128, 128);"><em>netmask 255.255.0.0</em></span><br><span style="color: rgb(128, 128, 128);"><em>broadcast 10.9.255.255</em></span><br><span style="color: rgb(128, 128, 128);"><em>network 10.9.0.0</em></span><br><span style="color: rgb(128, 128, 128);"><em>gateway 10.9.0.1</em></span><br><span style="color: rgb(128, 128, 128);"><em>dns-nameservers 10.1.1.84 8.8.8.8</em></span><br><br><span style="color: rgb(128, 128, 128);"><em>auto br0-100</em></span><br><span style="color: rgb(128, 128, 128);"><em>iface br0-100 inet manual</em></span><br><span style="color: rgb(128, 128, 128);"><em>    bridge_ports bond0.100</em></span><br><span style="color: rgb(128, 128, 128);"><em>    bridge_stp off</em></span><br><span style="color: rgb(128, 128, 128);"><em>    bridge_fd 0</em></span><br><span style="color: rgb(128, 128, 128);"><em>    bridge_maxwait 0</em></span><br><br><span style="color: rgb(128, 128, 128);"><em>auto br0-101</em></span><br><span style="color: rgb(128, 128, 128);"><em>iface br0-101 inet manual</em></span><br><span style="color: rgb(128, 128, 128);"><em>    bridge_ports bond0.101</em></span><br><span style="color: rgb(128, 128, 128);"><em>    bridge_stp off</em></span><br><span style="color: rgb(128, 128, 128);"><em>    bridge_fd 0</em></span><br><span style="color: rgb(128, 128, 128);"><em>    bridge_maxwait 0</em></span></div><div style="padding-left: 30px;"><br><span style="color: rgb(128, 128, 128);"><em>auto br0-102</em></span><br><span style="color: rgb(128, 128, 128);"><em>iface br0-102 inet manual</em></span><br><span style="color: rgb(128, 128, 128);"><em>    bridge_ports bond0.102</em></span><br><span style="color: rgb(128, 128, 128);"><em>    bridge_stp off</em></span><br><span style="color: rgb(128, 128, 128);"><em>    bridge_fd 0</em></span><br><span style="color: rgb(128, 128, 128);"><em>    bridge_maxwait 0</em></span><br><br><span style="color: rgb(128, 128, 128);"><em>auto br0-103</em></span><br><span style="color: rgb(128, 128, 128);"><em>iface br0-103 inet manual</em></span><br><span style="color: rgb(128, 128, 128);"><em>    bridge_ports bond0.103</em></span><br><span style="color: rgb(128, 128, 128);"><em>    bridge_stp off</em></span><br><span style="color: rgb(128, 128, 128);"><em>    bridge_fd 0</em></span><br><span style="color: rgb(128, 128, 128);"><em>    bridge_maxwait 0</em></span><br></div><div style="padding-left: 30px;"><br></div><div>I have create a profile for a container to use vlan100 (br0-100)<br></div><br><div style="padding-left: 30px;"><span style="color: rgb(128, 128, 128);"><em>config: {}</em></span><br><span style="color: rgb(128, 128, 128);"><em>description: ""</em></span><br><span style="color: rgb(128, 128, 128);"><em>devices:</em></span><br><span style="color: rgb(128, 128, 128);"><em>  eth0:</em></span><br><span style="color: rgb(128, 128, 128);"><em>    nictype: bridged</em></span><br><span style="color: rgb(128, 128, 128);"><em>    parent: br0-100</em></span><br><span style="color: rgb(128, 128, 128);"><em>    type: nic</em></span><br><span style="color: rgb(128, 128, 128);"><em>  root:</em></span><br><span style="color: rgb(128, 128, 128);"><em>    path: /</em></span><br><span style="color: rgb(128, 128, 128);"><em>    pool: default</em></span><br><span style="color: rgb(128, 128, 128);"><em>    type: disk</em></span><br><span style="color: rgb(128, 128, 128);"><em>name: vlantest</em></span><br><span style="color: rgb(128, 128, 128);"><em>used_by:</em></span><br><span style="color: rgb(128, 128, 128);"><em>- /1.0/containers/v100</em></span><br><br></div><div>The interface file in my container:<br></div><div style="padding-left: 30px;"><br></div><div style="padding-left: 30px;"><span style="color: rgb(128, 128, 128);"><em>source /etc/network/interfaces.d/*.cfg</em></span></div><div style="padding-left: 30px;"><br></div><div style="padding-left: 30px;"><span style="color: rgb(128, 128, 128);"><em># The loopback network interface</em></span><br><span style="color: rgb(128, 128, 128);"><em>auto lo</em></span><br><span style="color: rgb(128, 128, 128);"><em>iface lo inet loopback</em></span><br><br><span style="color: rgb(128, 128, 128);"><em># The primary network interface</em></span><br><span style="color: rgb(128, 128, 128);"><em>auto eth0</em></span><br><span style="color: rgb(128, 128, 128);"><em>iface eth0 inet static</em></span><br><span style="color: rgb(128, 128, 128);"><em>  address 10.9.100.101</em></span><br><span style="color: rgb(128, 128, 128);"><em>  netmask 255.255.255.0</em></span><br><span style="color: rgb(128, 128, 128);"><em>  network 10.9.100.0</em></span><br><span style="color: rgb(128, 128, 128);"><em>  gateway 10.9.100.1</em></span><br><span style="color: rgb(128, 128, 128);"><em>  broadcast 10.9.100.255</em></span><br><span style="color: rgb(128, 128, 128);"><em>  dns-nameservers 10.1.1.84</em></span><br><br></div><div>ifconfig in container:<br></div><br><div style="padding-left: 30px;"><em><span style="color: rgb(128, 128, 128);">eth0      Link encap:Ethernet  HWaddr 00:16:3e:40:16:9c  </span></em><br><em><span style="color: rgb(128, 128, 128);">          inet6 addr: fe80::216:3eff:fe40:169c/64 Scope:Link</span></em><br><em><span style="color: rgb(128, 128, 128);">          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1</span></em><br><em><span style="color: rgb(128, 128, 128);">          RX packets:12 errors:0 dropped:0 overruns:0 frame:0</span></em><br><em><span style="color: rgb(128, 128, 128);">          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0</span></em><br><em><span style="color: rgb(128, 128, 128);">          collisions:0 txqueuelen:1000 </span></em><br><em><span style="color: rgb(128, 128, 128);">          RX bytes:1016 (1.0 KB)  TX bytes:1192 (1.1 KB)</span></em><br><br><em><span style="color: rgb(128, 128, 128);">eth1      Link encap:Ethernet  HWaddr 00:16:3e:42:12:66  </span></em><br><em><span style="color: rgb(128, 128, 128);">          inet6 addr: fe80::216:3eff:fe42:1266/64 Scope:Link</span></em><br><em><span style="color: rgb(128, 128, 128);">          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1</span></em><br><em><span style="color: rgb(128, 128, 128);">          RX packets:14 errors:0 dropped:0 overruns:0 frame:0</span></em><br><em><span style="color: rgb(128, 128, 128);">          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0</span></em><br><em><span style="color: rgb(128, 128, 128);">          collisions:0 txqueuelen:1000 </span></em><br><em><span style="color: rgb(128, 128, 128);">          RX bytes:1700 (1.7 KB)  TX bytes:508 (508.0 B)</span></em><br><br><em><span style="color: rgb(128, 128, 128);">lo        Link encap:Local Loopback  </span></em><br><em><span style="color: rgb(128, 128, 128);">          inet addr:127.0.0.1  Mask:255.0.0.0</span></em><br><em><span style="color: rgb(128, 128, 128);">          inet6 addr: ::1/128 Scope:Host</span></em><br><em><span style="color: rgb(128, 128, 128);">          UP LOOPBACK RUNNING  MTU:65536  Metric:1</span></em><br><em><span style="color: rgb(128, 128, 128);">          RX packets:0 errors:0 dropped:0 overruns:0 frame:0</span></em><br><em><span style="color: rgb(128, 128, 128);">          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0</span></em><br><em><span style="color: rgb(128, 128, 128);">          collisions:0 txqueuelen:1 </span></em><br><em><span style="color: rgb(128, 128, 128);">          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)</span></em><br><br></div><div>What am I doing wrong here? Container creates an additional interface for some reason (eth1) but neither get addresses. <br></div><br><div><div>Best Regards,</div><br><div style="text-align: left;"><img style="align: left;" data-mce-src="https://www.robco.com/images/logo.jpg" src="https://www.robco.com/images/logo.jpg" align="left"><strong>Lai Wei-Hwa</strong><br> <span style="font-size: 10pt;">IT Administrator</span><br> T. (514) 367-2252 ext 6308 C. (514) 218-7400 <a href="mailto:whlai@robco.com" target="_blank">whlai@robco.com</a><br> Montreal<strong><span style="color: #ff0000;"> -</span></strong> Toronto <strong><span style="color: #ff0000;">-</span></strong> Edmonton <a href="https://www.robco.com" target="_blank">www.robco.com</a><br><hr></div><div style="text-align: right;"><span style="color: #808080;">ISO 9001 / 14001</span></div><div style="text-align: left;"><br></div></div></div><br>_______________________________________________<br>lxc-users mailing list<br>lxc-users@lists.linuxcontainers.org<br>http://lists.linuxcontainers.org/listinfo/lxc-users<br></div></div></body></html>