DEV Community

Cover image for Set a VLAN interface in your Proxmox node
Daniel
Daniel

Posted on

Set a VLAN interface in your Proxmox node

Introduction

First of all, install Proxmox.

If you haven't and need a guide on how to do so, I can't recommend Network Chuck's video enough:


Proxmox network basics

Once that's out of the way, you need to know some basics about your Proxmox node networking stuff.

Go to your Node -> System -> Network

It will probably look something like this (don't worry if your IP address is different):

Default node network tab

What are those?

  • enp1s0 -> This is your actual, physical, network device in the hardware you installed Proxmox on. Note that you might have more physical interfaces if your hardware has several ethernet ports or a wifi card.
  • vmbr0 -> This is what's called "Linux Bridge", it's like a virtual switch, that bridges (thus the name) the physical interface with all the virtual networking within Proxmox.

One important thing:

The vmbr0 interface is NOT VLAN aware. Which means that it has no clue on how to handle VLAN packets and thus not know where to route stuff.

Making the Linux Bridge VLAN aware

Edit the vmbr0 interface, enabling VLAN aware:

Enabling VLAN aware on vmbr0

Then hit "OK" and then "Apply Configuration".

This will make vmbr0 a trunking bridge, meaning that it will pass all VLAN for all VLANs.

Editing the network interfaces in the GUI, like we just did, makes changes in /etc/network/interfaces. There, we can what changes have been made:

iface enp1s0 inet manual

auto vmbr0
iface vmbr0 inet static
        address 192.168.1.17/24
        gateway 192.168.1.1
        bridge-ports enp1s0
        bridge-stp off
        bridge-fd 0
        bridge-vlan-aware yes   <-- new line
        bridge-vids 2-4094      <-- new line
Enter fullscreen mode Exit fullscreen mode

As you can see, our vmbr0 now passes traffic for all vlans in the 2 to 4094 range. Great!

If you wanted, you can set what specific vlans you want to pass by modifying the last line:

bridge-vids 2,12,24
Enter fullscreen mode Exit fullscreen mode

This will now pass traffic for vlans 2, 12 and 24.

This configuration will work out of the bat. You can now create containers and VMs with the vmbr0 as the bridge and set VLAN IP addresses to them.

But what if you ALSO want your node to have an IP address in one of those VLANs? Keep reading!

The VLAN interface

The previous setup allows us to assign VLAN IPs to containers and VMs, but you might also want to assign a specific VLAN IP to the Proxmox Node?

It's easy!

First we need to edit the vmbr0 interface and remove the static IP information, like this:

Removing vmbr0 static ip info

Then we hit "Create" and create a VLAN interface:

Creating a new VLAN interface

Inserting VLAN interface data

Insert your VLAN data

  • In the name, by setting vlanX, where "X" is the VLAN number, Proxmox already detects it and puts it into the VLAN field
  • Then just fill out the IP you want to assign to this Proxmox node in your VLAN and the gateway
  • Finally, set the VLAN raw device to your linux bridge vmbr0 in my case

Then hit "Apply Configuration" to set the changes.

Note that this will immediately configure your node on the VLAN IP you just set, so you might want to navigate to that new IP to get to the GUI again.

If we now have a look at /etc/network/interfaces:

iface enp1s0 inet manual

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

auto vlan2
iface vlan2 inet static
        address 192.168.2.12/24
        gateway 192.168.2.1
        vlan-raw-device vmbr0
Enter fullscreen mode Exit fullscreen mode

We can see how we have a new interface that lets the Proxmox node live under the VLAN 2 IP address 192.168.2.12

And that's pretty much it!

One last note: When creating containers and VMs, the interface you need to select is still vmbr0, not the VLAN interface!

Top comments (0)