brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: netplan vlans need an id and a link to a parent interface

Netplan
~/tips/tip-netplan-vlan-id-link

network: {version: 2, ethernets: {enp3s0: {}}, vlans: {vlan20: {id: 20, link: enp3s0, addresses: [10.20.0.5/24]}}}

Adds a tagged VLAN interface on top of a physical port in netplan.

A tagged VLAN on a trunk port is only a few lines in netplan, and two keys carry the meaning.

# /etc/netplan/62-vlan.yaml
network: {version: 2, ethernets: {enp3s0: {}}, vlans: {vlan20: {id: 20, link: enp3s0, addresses: [10.20.0.5/24]}}}

id is the VLAN number, between 0 and 4094, and link is the netplan ID of the parent interface. The name vlan20 is free to choose, but a name like enp3s0.20 is easier to recognise in ip a. The parent must also be defined, even if it is empty. The switch port needs to carry the tag, or the VLAN stays silent.

Further reading: Netplan YAML configuration reference

More Netplan tips – to: 192.168.3.0/24 hidden: true lacp-rate: fast link-local: [] wakeonlan: true All Netplan tips (21) All topics

Link