This post is the basic configuration needed to setup a static IP address on Ubuntu Server using a VLAN. It is VERY important to note that when using Netplan spacing must be exact. DO NOT use tabs to fill out spaces. Make sure to change the interface name to the interface presented in your installation otherwise this will not work.
- Edit the netplan configuration which is located at /etc/netplan most files are named 00-installer-config.yaml I prefer to use nano but any text editor will work.
network:
ethernets:
ens160: {}
version: 2
vlans:
ens160.99:
addresses:
- 192.168.60.2/24
gateway4: 192.168.60.1
nameservers:
addresses:
- 8.8.8.8
search: []
id: 99
link: ens160
2. Apply the configuration using sudo netplan apply . If the configuration fails to apply check your spacing as everything must be spaced properly.
Hi,
I am trying to configure static IP on an interface with tagged VLAN.
I use below configuration in yaml file
cat 03-vlan.yaml
network:
version: 2
renderer: networkd
ethernets:
eno12429: {}
vlans:
eno12429.108:
addresses: [x.x.x.x/28]
gateway4: “x.x.x.x”
nameservers:
addresses:
– x.x.x.x
– x.x.x.x
id: 108
link: eno12429
There is no error in netplan apply. Issue is that I am unable to ping gateway. VLAN configuration in switch is correct.
I am unable to comment more as screenshot not possible here and typing here is bit challenging. Any other scenario you can think so which I should check here.
It is possible that the network card you are using doesn’t support using VLAN tags. Are you doing this in a virtual environment or are you using a physical host? Does the configuration work if you try to do a static untagged interface as shown here? https://grohler.com/ubuntu-server-netplan-static-ip-settings/