VLANs with Network Manager

Again a quick and compact copypaste how to on how to make your VLAN interfaces with Network Manager. In this case we have interface “eno2” which receives VLANS 2,3,4,5 and name them traditionally like network-scripts configuration used to do.

nmcli con add type vlan ifname eno2.2 dev eno2 id 2
nmcli con add type vlan ifname eno2.3 dev eno2 id 3
nmcli con add type vlan ifname eno2.4 dev eno2 id 4
nmcli con add type vlan ifname eno2.5 dev eno2 id 5

Check the details of the connection with

nmcli -p con show vlan-eno2.2

To set static ip4 address do

nmcli con mod eno2.2 ipv4.addresses 1.2.3.4
nmcli con mod eno2.2 ipv4.gaterwau 1.2.3.1
nmcli con mod eno2.2 ipv4.dnf 1.2.3.2
nmcli con mod eno2.2 ipv4.method manual
nmcli con up eno2.2

That's it.