Adding a VLAN interface with Netplan
Follow the below to add a VLAN through Netplan on a Ubuntu server
1. Open the Netplan Configuration File:
sudo nano /etc/netplan/01-network-manager-all.yaml
2. Edit the File with the Correct Configuration:
network:  version: 2  ethernets:    eno1:      dhcp4: yes  vlans:    vlan50:      id: 50      link: eno1      gateway4: 192.168.50.1      nameservers:        addresses: [192.168.1.9, 192.168.1.8]
3. Apply the Configuration:
sudo netplan apply
4. Verify the Configuration:ip a
You should now see the vlan50 interface.
 
Docker MACVLAN example:
docker network create -d macvlan \  --subnet=192.168.50.0/24 \  --gateway=192.168.50.1 \  -o parent=eno50 \  DockNet
Note: You have to restart docker after editing the netplan.
