netplan with multiple vlans on single interface - help needed
Solution 1:
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