Coloque algo assim (ajustado para o seu nic) no seu arquivo cloud-config:
- name: 00-vlan1.netdev
runtime: true
content: |
[NetDev]
Name=vlan1
Kind=vlan
[VLAN]
Id=1
- name: 00-vlan2.netdev
runtime: true
content: |
[NetDev]
Name=vlan2
Kind=vlan
[VLAN]
Id=2
- name: 30-ens192.network
runtime: true
content: |
[Match]
Name=ens192
[Network]
DHCP=yes
VLAN=vlan1
VLAN=vlan2
Essas informações vêm de duas fontes: as páginas de manual do systemd-networkd e do blog do núcleo link
Eu tentei isso em um dos meus próprios sistemas, pois também precisarei de vlans em breve. Funciona muito bem. Aqui está o resultado:
core@localhost ~ $ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:48:9e:49 brd ff:ff:ff:ff:ff:ff
inet 10.9.8.123/24 brd 10.9.8.255 scope global dynamic ens192
valid_lft 3200sec preferred_lft 3200sec
inet6 fe80::20c:29ff:fe48:9e49/64 scope link
valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN
link/ether 56:84:7a:fe:97:99 brd ff:ff:ff:ff:ff:ff
inet 172.17.42.1/16 scope global docker0
valid_lft forever preferred_lft forever
4: vlan1@ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
link/ether 42:cf:24:c7:c6:bd brd ff:ff:ff:ff:ff:ff
inet6 fe80::40cf:24ff:fec7:c6bd/64 scope link
valid_lft forever preferred_lft forever
5: vlan2@ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
link/ether da:0d:c5:73:91:1d brd ff:ff:ff:ff:ff:ff
inet6 fe80::d80d:c5ff:fe73:911d/64 scope link
valid_lft forever preferred_lft forever
core@localhost ~ $