LXC with mutliple VLANs

I’ve created 2 VLANs (VLAN #1 & VLAN #2) on my Turris Omnia:

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option vid '1'
        option ports '0 1 2 3 4 5'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option vid '2'
        option ports '0t 1t 2t 3t 4t 5t'

created 2 Interfaces for both VLANs:

  config interface 'lan1'
            option force_link '1'
            option type 'bridge'
            option proto 'static'
            option netmask '255.255.255.0'
            option _orig_ifname 'eth0 eth2'
            option _orig_bridge 'true'
            option ifname 'eth0 eth2'
            option ipaddr '192.168.1.2'
            option gateway '192.168.1.1'

    config interface 'lan2'
            option proto 'static'
            option ifname 'eth0.2'
            option ipaddr '192.168.2.2'
            option netmask '255.255.255.0'
            option gateway '192.168.2.1'

How can a LXC get access to both VLANs?

LXC with Ubuntu: /etc/network/interfaces

auto eth0
iface eth0 inet static
        address 192.168.1.3
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1

auto eth0.2
iface eth0.2 inet static
        address 192.168.2.3
        netmask 255.255.255.0
        network 192.168.2.0
        broadcast 192.168.1.255
        gateway 192.168.2.1

LXC: config

lxc.network.type = veth
lxc.network.link = br-lan
lxc.network.flags = up
lxc.network.name = eth0

VLAN #2 does not work. Any ideas?

maybe you must configure second ethernet

lxc.network.type = veth
lxc.network.link = br-lan
lxc.network.flags = up
lxc.network.name = eth0

lxc.network.type = veth
lxc.network.link = br-lan2
lxc.network.flags = up
lxc.network.name = eth1

and on ubuntu configure /etc/network/interfaces like this

auto eth0
iface eth0 inet static
        address 192.168.1.3
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1

auto eth1
iface eth1 inet static
        address 192.168.2.3
        netmask 255.255.255.0
        network 192.168.2.0
        broadcast 192.168.1.255
        gateway 192.168.2.1
1 Like

Thanks, working :grinning:.