DHCP on VMs with different VLANs to PVE

mdjaved

New Member
Feb 6, 2024
1
0
1
Hi all,

Apologies in advance if this has been asked before but I couldn't find any info about it in any of my searches so far.

I have a basic Proxmox setup at home and I am trying to get my head around assigning IPs to PVE and VMs via DHCP. Adding to the confusion is the fact that I am trying to use VLANs too. Here is my current set up so far.

Opnsense --> Managed Switch (Netgear) port 19 --> OP7070 Micro (Proxmox server with single NIC only)

Here are the VLANs I intend to use:
VLAN 1 (192.168.1.1/24) - Management VLAN - for Proxmox PVE
VLAN 30 (192.168.30.1/24) - IOT - For VMs
VLAN 50 (192.168.50.1/24) - TEST - For VMs

All MACs will have static IPs on Opnsense (except the TEST VLAN) which is why I wanted to get DHCP working. I managed to update the /etc/network/interfaces to include DHCP for the PVE system (VLAN 1) and it has received the expected IP address (192.168.1.9) which is perfect.

iface eno2 inet manual

auto vmbr0
iface vmbr0 inet dhcp
bridge-ports eno2
bridge-stp off
bridge-fd 0
bridge-vlan-aware yes
bridge-vids 10,30,50


Now what I want to do is to have VMs on different VLANs. Based on my readings so far, I tried adding this additonal line in /etc/network/interfaces so I could get a DHCP assigned address for the VM which would be on VLAN 50.

auto vmbr0.50
iface vmbr0.50 inet dhcp


However this is not working and it is having a random IP on it and it is not able to ping the gateway (192.168.50.1). I double checked that the VLAN tag is 50 for the VM in Proxmox and also confirmed that the MAC address is in Opnsense (the static IP is for testing only). Also checked the Netgear switch and verified that port 19 has VLANs 1, 30 and 50 assigned to it. When I change the VLAN tag to 1 for the VM, I get the expected IP on the VM. Just not able to get the IP I want via DHCP on the VLANs. What am I doing wrong here? Really appreciate any advice to resolve this.
 
Last edited:

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!