DHCP on Vm not working

suhail

New Member
Apr 22, 2024
12
0
1
My VM can connect to internet using static but not using dhcp
my server is with hetzner

i followed this
https://community.hetzner.com/tutorials/install-and-configure-proxmox_ve

and setup like it says in Masquerading (NAT) with iptables



Code:
source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

auto eno1
iface eno1 inet static
        address 127.180.246.94/24
        gateway 127.180.246.65
        #post-up iptables -t nat -A PREROUTING -i eno1 -p tcp -m multiport ! --dports 22,8006 -j DNAT --to 172.16.246.2
        #post-down iptables -t nat -D PREROUTING -i eno1 -p tcp -m multiport ! --dports 22,8006 -j DNAT --to 172.16.246.2


iface eno1 inet6 static
        address 2a02:4f9:3070:3ed7::2/64
        gateway fe90::1


auto vmbr0
iface vmbr0 inet static
        address 172.16.246.1/24
        bridge-ports none
        bridge-stp off
        bridge-fd 0
        post-up   echo 1 > /proc/sys/net/ipv4/ip_forward
        post-up   iptables -t nat -A POSTROUTING -s '172.16.246.0/24' -o eno1 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '172.16.246.0/24' -o eno1 -j MASQUERADE
#NAT/Masq
 
>> In bridged mode, DHCP can also be used to automatically configure the network settings. However, it is essential to configure the virtual machine to use the virtual MAC address obtained from the Robot Panel for the specific IP configuration. <<

DHCP in that context means - not an internal DHCP server for your natted '172.16.246.0/24'

Hetzner sells additional IPs. In the Robot you can ask Hetzner to associated virtual Mac Adresss to these IPs. Machines (not natted) can then (by just setting the Mac Adress) get an IP from Hetzner via DHCP.

I guess you want an internal DHCP for your '172.16.246.0/24'.

Well - bad news - you have to build it.

---

At this point I am experimenting with SDN in Proxmox 8.2.x ... in theory the SDN has (at last) for the Simple Zone a DHCP Support - however - there is no NAT (or I am too stupid).

---

Solution to your question. Create a VM / LXC / and install ah dhcp server. You can even do iton the Promox Host for vmbr0 only!


The DHCP for SDN is a thing that eventually will come. Probably all these Ex VMware customers will bring developer money
 

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!