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 routes: - to: default via: 192.168.1.1 on-link: true metric: 100 vlans: eno50: id: 50 link: eno1 routes: - to: 192.168.50.0/24 via: 192.168.50.1 on-link: true
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.
No comments to display
No comments to display