Netplan with Multiple Vlans on Single Interface - Help Needed
I Have a Single Virtual Interface and 802.1Q Enabled. When I Have a Single Vlan for My Interface in Netplan It Works, but When I Add a Second, Additional Vlan...
I have a single virtual interface and 802.1q enabled. When I have a single vlan for my interface in netplan it works, but when I add a second, additional vlan only the last vlan in the file works, preceding vlans do not. Here is the config:
network:
version: 2
renderer: networkd
ethernets:
ens0:
match:
name: ens160
vlans:
vlan.45:
id: 45
link: ens0
dhcp4: no
addresses: [ 10.0.45.11/24 ]
gateway: 10.0.45.1
nameservers:
search: [ domain.local ]
addresses: [ 8.8.8.8 ]
vlan.110:
id: 110
link: ens0
dhcp4: no
addresses: [ 10.0.11.103/24 ]
gateway: 10.0.11.1
nameservers:
search: [ domain.local ]
addresses: [ 10.0.11.18 ]
1 Answer
The following works for me to define two vlans on one physical interface:
network:
version: 2
ethernets:
ens3:
addresses:
- 192.168.122.201/24
gateway4: 192.168.122.1
nameservers:
addresses: [192.168.122.1]
ens8: {}
vlans:
vlan.101:
id: 101
link: ens8
addresses: [192.168.101.1/24]
vlan.102:
id: 102
link: ens8
addresses: [192.168.102.1/24]
Notice, the vlan section is at the same level of indent as the ethernets key. Both are contained within network.
ip link to show result:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 52:54:00:e4:bc:6f brd ff:ff:ff:ff:ff:ff
3: ens8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 52:54:00:7e:d5:19 brd ff:ff:ff:ff:ff:ff
4: vlan.101@ens8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 52:54:00:7e:d5:19 brd ff:ff:ff:ff:ff:ff
5: vlan.102@ens8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 52:54:00:7e:d5:19 brd ff:ff:ff:ff:ff:ff