filmov
tv
VLAN Management 101
Показать описание
Up till now, I have focused on LXD containers using VLANs. This video takes a step back and describes the basics of VLAN Management and also shows how to use "Netplan" to connect to VLANs.
Netplan files are located in /etc/netplan
To find the name of your physical adapter:
sudo apt install net-tools
ifconfig
My adapter name for my VM is ens3.
The name of your adapter and your Netplan YAML file will probably differ from mine. Once you edit your YAML file, you execute it with:
sudo netplan apply
A default YAML file for a DHCP address on the untagged LAN is:
network:
ethernets:
ens3:
dhcp4: true
version: 2
To have a static address on your server:
network:
version: 2
renderer: networkd
ethernets:
ens3:
dhcp4: no
addresses: [172.16.1.245/16]
gateway4: 172.16.0.1
Here is my example to connect to my existing VLAN100:
network:
version: 2
ethernets:
ens3: {}
vlans:
MyVLAN100:
id: 100
link: ens3
addresses: [192.168.100.10/24]
gateway4: 192.168.100.1
nameservers:
addresses: [1.1.1.1,1.0.0.1]
Here is my example to create multiple VLAN adapters and leave my VLAN100 address as the default gateway:
network:
version: 2
ethernets:
ens3: {}
vlans:
MyVLAN100:
id: 100
link: ens3
addresses: [192.168.100.10/24]
gateway4: 192.168.100.1
nameservers:
addresses: [1.1.1.1,1.0.0.1]
MyVLAN50:
id: 50
link: ens3
addresses: [192.168.50.5/24]
nameservers:
addresses: [1.1.1.1,1.0.0.1]
----------
Netplan files are located in /etc/netplan
To find the name of your physical adapter:
sudo apt install net-tools
ifconfig
My adapter name for my VM is ens3.
The name of your adapter and your Netplan YAML file will probably differ from mine. Once you edit your YAML file, you execute it with:
sudo netplan apply
A default YAML file for a DHCP address on the untagged LAN is:
network:
ethernets:
ens3:
dhcp4: true
version: 2
To have a static address on your server:
network:
version: 2
renderer: networkd
ethernets:
ens3:
dhcp4: no
addresses: [172.16.1.245/16]
gateway4: 172.16.0.1
Here is my example to connect to my existing VLAN100:
network:
version: 2
ethernets:
ens3: {}
vlans:
MyVLAN100:
id: 100
link: ens3
addresses: [192.168.100.10/24]
gateway4: 192.168.100.1
nameservers:
addresses: [1.1.1.1,1.0.0.1]
Here is my example to create multiple VLAN adapters and leave my VLAN100 address as the default gateway:
network:
version: 2
ethernets:
ens3: {}
vlans:
MyVLAN100:
id: 100
link: ens3
addresses: [192.168.100.10/24]
gateway4: 192.168.100.1
nameservers:
addresses: [1.1.1.1,1.0.0.1]
MyVLAN50:
id: 50
link: ens3
addresses: [192.168.50.5/24]
nameservers:
addresses: [1.1.1.1,1.0.0.1]
----------
Комментарии