xf.is blog

vlan bridges in netplan

Published (updated: ) in linux.

Took me a while to figure this one out in the netplan yaml syntax:

network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: no
      dhcp6: no
  bridges:
    br20:
      dhcp4: no
      dhcp6: no
      interfaces: [ vlan20 ]
      addresses: [ 192.168.20.5/24 ]
      gateway4: 192.168.20.1
      nameservers:
        addresses:
          - "192.168.20.1"
    br40:
      dhcp4: no
      dhcp6: no
      interfaces: [ vlan40 ]
  vlans:
    vlan20:
      id: 20
      link: eno1
      dhcp4: no
      dhcp6: no
    vlan40:
      id: 40
      link: eno1
      dhcp4: no
      dhcp6: no

Bonus .vimrc settings for yaml

autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab