VLAN for Proxmox and VMs -- VM not getting an IP

Bastian987

New Member
Mar 31, 2025
10
1
3
Hi,

Im new to Proxmox and I'm lost on the VLAN setup despite quite some reading :( :
I have created a new VLAN "4" on my Unifi controller (on a Dream machine), this VLAN 4 is configured to not use DHCP. I assigned VLAN 4 to the the switch port the Proxmox VE hardware is connected to. Finally, I used a static IP for the Proxmox VM, 192.168.4.40. So far, this setup is working.

As a last step, I activated 'VLAN aware' in the Proxmox GUI for the network. The interfaces file looks like this
Code:
auto lo
iface lo inet loopback

iface enp86s0 inet manual

auto vmbr0
iface vmbr0 inet static
        address 192.168.4.40/24
        gateway 192.168.4.1
        bridge-ports enp86s0
        bridge-stp off
        bridge-fd 0
        bridge-vlan-aware yes
        bridge-vids 2-4094

iface wlo1 inet manual

Now I tried to spin up a home assistant OS VM. However, the new VM does not seem to get a IP. My assumption: the new container expects to get a IP from DHCP, but the machine in the VLAN 4 does not have a DHCP.

How can this problem be solved?

I see two options:
- give also each VM a static IP address manually
- assign VMs the default VLAN 1 to get it to the default VLAN with active DHCP

Is that correct? I tried to go the second path and added "tag=1" to network of the HA VM. I assume that overwrites the setting I made for the switch port of the dream machine. However, the HA VM does still not get an IP address.

Any advice how to solve that issue as a beginner in the topic?
 
if you want dhcp you can set your vm's network to be on another vlan that has dhcp

1743424833111.png


in general i would use static ip's for something like that - you want your services to have a static ip, especially if other devices access it.
 
Thanks for your reply! I have set this VLAN tag. But the HA VM still did not get an IP. Then, I changed the configuration of the switch port from network with VLAN 4 to 'NONE' in my Unifi controller. Now the HA VM spins up and gets an 192.168.1.x IP address. However, I can then no longer access Proxmox on 192.168.4.40 :(
 
Last edited:
switch ports have a native (untagged) vlan and a tagged vlan
proxmox uses by default the native vlan (in your case vlan 40), if you set a vlan on your vm then proxmox "tags" the traffic with a vlan header and the switch will filter the traffic to that specific vlan. you can try to add vlan 1 as tagged vlan on that switch port but i'm not sure if unifi will let you do that because vlan 1 is somewhat "special"
 
  • Like
Reactions: Bastian987
ah, I see. How about that approach, as I want to have my VMs in the vlan 1: I remove the native vlan in Unifi to do all IP / vlan assignments in proxmox:

Code:
auto lo
iface lo inet loopback

iface enp86s0 inet manual

auto vmbr0
iface vmbr0 inet static
        address 192.168.1.3/24
        gateway 192.168.1.1
        bridge-ports enp86s0
        bridge-stp off
        bridge-fd 0

auto vmbr0.4
iface vmbr0.4 inet static
    address 192.168.4.40/24
    gateway 192.168.4.1

That should expose the Proxmox VE as 192.168.4.40, to have a static IP outside of any DHCP (I have read that's a recommendation to have). All VMs I will create can use the vmbr0 interface to get an IP assigned by DHCP in the 192.168.1.3/24 range.

Could that work and makes sense?

Edit: updated the code, address removed in vmbr0 and gateway added in vmbr0.4
 
Last edited:
you should set a gateway for vmbr0.4 otherwise you cant connect to the internet with proxmox (no updates)

remove the gateway and ip address from vmbr0, you don't need an ip address on a vlan aware bridge if only your vlan tagged vm's will use it
in general you should only assign one gateway otherwise you get connectivity issues
 
  • Like
Reactions: Bastian987
That's the setting I use now:

Code:
auto lo
iface lo inet loopback

iface enp86s0 inet manual

auto vmbr0
iface vmbr0 inet static
        bridge-ports enp86s0
        bridge-stp off
        bridge-fd 0
        bridge-vlan-aware yes
        bridge-vids 2-4092

auto vmbr0.4
iface vmbr0.4 inet static
    address 192.168.4.40/24
    gateway 192.168.4.1
iface wlo1 inet manual
 
initial test: Proxmox available at 192.168.4.40, home assistant OS VM gets an IP in vlan 1 and is accessible as well => looks good to me, thanks a lot for your help!
 
  • Like
Reactions: MarkusKo