Can't get Proxmox-based DHCP server to work inside guest VM's

cparke

New Member
Nov 28, 2023
3
0
1
I have a Dedicated Server (i.e Bare Metal) at Contabo with a static IP, and no KVM (can't run the DVD installer). Contabo didn't know how to install Proxmox correctly, and so basically they just gave me a customized Debian 'bookworm' install but no Proxmox and they're clueless at the moment. So I've had to manually install the packages from the Proxmox repository into Debian to get Proxmox running, but the system still is definitely not installed the correct way that the Installer DVD or an Unattended Installation script would do it. It looks like that puts me on Proxmox VE 8.1.3.

One issue I'm struggling with at the moment is getting DHCP to work inside the VM's. I am not a network engineer or expert, but have a good understanding of the basics. Because of the situation described above, I had to define the network bridge myself with no help from the Proxmox installer. Here is my /etc/network/interfaces file as it stands now (IP addresses anonymized):

Code:
auto lo
iface lo inet loopback

iface eth0 inet manual
    dns-search invalid
    dns-nameservers 11.11.11.1 11.11.1.2
    up ip route replace 128.128.128.0/24 via 128.128.128.1 dev eth0

auto vmbr0
iface vmbr0 inet static
    address 128.128.128.211/24
    gateway 128.128.128.1
    bridge-ports eth0
    bridge-stp off
    bridge-fd 0

iface vmbr0 inet6 static
    address abcd:1234:0000:1011:0000:0000:0000:0001/64
    gateway fedc::1
Against this example, the Proxmox host is located at static IP address 128.128.128.211.

In the VM configurations, the Network Device is set to use the 'vmbr0' Linux Bridge as the adapter. I haven't pondered yet if I need a separate bridge for each VM?

At any rate, it seems like the network bridge itself is configured here correctly, as I was able to get networking to work in the guest VM's if I assign static IP's within each VM (though I really don't know how to setup a subnet for them correctly to avoid conflicts with other machines). The problem, I think, is Proxmox isn't providing a DHCP server for the guest VM's, and the host machine has static IP and no DHCP server on its own gateway. I understand that the dnsmasq package is used by Proxmox to make this work, but all I know how to do is install the package! I can't find anything in Proxmox itself describing configuration for DHCP for guests where the main network doesn't provide it.

What am I missing here? How to get Proxmox 8.1.3 to provide its own DHCP to the guests?
 
Last edited:
this is a fairly new feature introduced with PVE 8.1, but there is a pretty good step by step tutorial in our wiki:

https://pve.proxmox.com/wiki/Setup_Simple_Zone_With_SNAT_and_DHCP
Yes, an unexpected surprise for me, at least the hard work of installing without the installer caused me to get the latest version with this needed feature.

Q: When I hit APPLY to load the newly defined Vnet0, I get an error status. But where is the log to find out what went wrong?
 
the task log should contain additional information, if not, check the system logs using journalctl (also available over the web UI ;)).
 
Ok, I figured the problem out!

PROBLEM:
This is the main error message I was seeing in the web UI:
vnet is not generated. Please check the 'reload network' task log.

In the 'Tasks' section on the bottom of the web UI, there was also one WARNING messageunder 'SRV networking - reload'.
Double-click the warning and this details box appear:
WARN: missing 'source /etc/network/interfaces.d/sdn' directive for SDN support!
Removed "/etc/systemd/system/multi-user.target.wants/dnsmasq@one.service".
Created symlink /etc/systemd/system/multi-user.target.wants/dnsmasq@one.service -> /lib/systemd/system/dnsmasq@.service.
vmbr0 : warning: vmbr0: up cmd 'ip route replace 128.128.128.0/24 via 128.128.128.1 dev vmbr0' failed: returned 2 (Error: Nexthop has invalid gateway.

TASK WARNINGS: 1

RESOLUTION:
The first line in the details box explained it, needed to *manually* add a line to the end of the /etc/network/interfaces file:
source /etc/network/interfaces.d/*

This is briefly mentioned in Chapter 12, "Software-Defined Network" of the Documentation "Proxmox VE Administration Guide" included on my server with the Proxmox installation. However, I kind of expected that the Web UI would add that when it makes the other edits to the 'interfaces' file, but I guess not.


I still have two much simpler questions to address:
  1. Is it correct that the host's main ethernet adapter ('eth0' in my case) is set to 'manual' and not auto-connect?
  2. Is one Linux network bridge connection enough for all the VM's to share, or should each VM get a separate bridge to the main adapter? Do I really need even need the 'vmbr0' bridge when using SDN with SNAT?

Much appreciation for your help!
 
Last edited:
Is it correct that the host's main ethernet adapter ('eth0' in my case) is set to 'manual' and not auto-connect?
Yes, since the connection is configured via vmbr0 and eth0 is a port on that bridge. I can see you are configuring DNS servers in the interfaces file, as well as manually adding a route. Usually you would configure DNS by adding it via the Web UI ('<Node> -> System -> DNS -> Edit') or editing /etc/resolv.conf and adding your name servers there instead of adding it to the interfaces configuration. The route should be unnecessary as well, since it would get automatically created when applying the network configuration for vmbr0.

Is one Linux network bridge connection enough for all the VM's to share, or should each VM get a separate bridge to the main adapter? Do I really need even need the 'vmbr0' bridge when using SDN with SNAT?
It should suffice to create one bridge via SDN that all VMs are using. But since you are using SNAT, it would still make sense to have a network connection configured and PVE does that via vmbr0 by default (and not on the interface itself). It acts like a normal network interface anyway, as long as you don't have any VMs connected to it.
 

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!