[How to] set VLAN in the management interface

Bruno Garcia

Member
Mar 13, 2017
20
2
23
54
Brazil
Hi all,

After some researching ive come to this solution.
Here is my interfaces file. It contains 2 interfaces, one for managemento and another to service traffic.

Hope it helps!

## interfaces file begin ##
auto lo
iface lo inet loopback

iface enp3s0f0 inet manual
#MANAGEMENT

auto vlan666
iface vlan666 inet manual
vlan_raw_device enp3s0f0

iface enp3s0f1 inet dhcp

iface enp4s0f0 inet manual

iface enp4s0f1 inet manual
#SERVICES

auto vmbr0
iface vmbr0 inet static
address 10.0.0.2
netmask 255.255.255.0
gateway 10.0.0.1
bridge_ports vlan666
bridge_stp off
bridge_fd 0
bridge_vlan_aware yes
#MANAGEMENT

auto vmbr1
iface vmbr1 inet manual
bridge_ports enp4s0f1
bridge_stp off
bridge_fd 0
#SERVICES
## interfaces file end ##
 
with bridge vlan aware,you can simply create a tagged bridge interface


Code:
auto vmbr0
iface vmbr0 inet manual
    bridge_ports enp3s0f0
    bridge_stp off
    bridge_fd 0
    bridge_vlan_aware yes

auto vmbr0.666
iface vmbr0.666 inet static
   address 10.0.0.2
   netmask 255.255.255.0
   gateway 10.0.0.1
 
update:

It's more suitable to bind vlan to bridge instead to physical interface because it is usable by VM guests too. Above example works for management only.

auto vmbr1.333
iface vmbr1.333 inet static
address 192.168.33.2
netmask 24
vlan-raw-device vmbr1
 
with bridge vlan aware,you can simply create a tagged bridge interface


Code:
auto vmbr0
iface vmbr0 inet manual
    bridge_ports enp3s0f0
    bridge_stp off
    bridge_fd 0
    bridge_vlan_aware yes

auto vmbr0.666
iface vmbr0.666 inet static
   address 10.0.0.2
   netmask 255.255.255.0
   gateway 10.0.0.1
this doesnt work in my server
 
You have to adjust to your network (address, netmask, gateway) and hardware (bridged port), of course.
Plus, your switch has to be configured accordingly.
 
I just found out how to setup VLAN. it worked. all vlan mode is tagged inside the switch port.

View attachment 27269
you only need to tag vmbr0.X if you need a an ip address on the hypervisor for this vlan.
for the vm, you don't need to configure vmbr0.X interfaces for vm networks (simply add a tag in the vm nic options is enough, proxmox will tag the virtual vm port inside the vmbr0 directly).
 
If you have a vlan that the host is part of but none of the VMs, you can even define the vlan on the interface rather than the bridge.
 
you only need to tag vmbr0.X if you need a an ip address on the hypervisor for this vlan.
for the vm, you don't need to configure vmbr0.X interfaces for vm networks (simply add a tag in the vm nic options is enough, proxmox will tag the virtual vm port inside the vmbr0 directly).
Oh, Yeah, it worked too. thanks.
 
with bridge vlan aware,you can simply create a tagged bridge interface


Code:
auto vmbr0
iface vmbr0 inet manual
    bridge_ports enp3s0f0
    bridge_stp off
    bridge_fd 0
    bridge_vlan_aware yes

auto vmbr0.666
iface vmbr0.666 inet static
   address 10.0.0.2
   netmask 255.255.255.0
   gateway 10.0.0.1

I previously used this text-based configuration successfully on Proxmox 6, but setting up a new server with Proxmox 7 today it did not work; outbound frames appeared to go out on the tagged bridge interface, but were never seen on the underlying interface, and inbound frames were seen on the underlying interface, but never appeared on the tagged bridge interface.

I reverted the config to an untagged management interface so I could get access and, at pilapoernomo's suggestion, configured the VLAN through the web interface. This worked. Upon inspection, it appears that it is necessary to specify the bridge-vids property. My config now looks like this, which works:

Code:
iface eno1 inet manual

auto vmbr0
iface vmbr0 inet manual
    bridge-ports eno1
    bridge-stp off
    bridge-fd 0
    bridge-vlan-aware yes
    bridge-vids 2-4094

auto vmbr0.100
iface vmbr0.100 inet static
    address 192.168.100.101/24
    gateway 192.168.100.1

There must be a default that has changed from one version of Debian or Linux that caused this to be required when it wasn't before.
 
There must be a default that has changed from one version of Debian or Linux that caused this to be required when it wasn't before.
ifupdown2 require bridge-vids to be defined. (if you configure network with proxmox gui, it's done automaticaly).
documentation has been updated too.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!