DHCP on vm

truc

Member
Aug 7, 2024
33
0
6
I installed proxmox on a vm with ip range 10.200.10.0/24 and on this range there is 1 DHCP server, then I created a vm using proxmox with vmbr0 but it does not grant dhcp ip to my vm, how do I fix it? What is this error and its cause?
i fixediface vmbr0 inet static
to inet dhcp I can't access proxmox's web ui
Screenshot 2024-08-07 120056.png
 
Hey,

the bridge configuration has nothing to do with DHCP for VMs. The bridge basically forwards everything that arrives on one port to all the other ports, so the bridge doesn't really know what it has to forward, it just forwards it. You don't need any configuration on the PVE host for DHCP to work, everything it done in the VM. I assume ens192 is connected to the network that has a DHCP server in it. So the simplest configuration would look something like this:

Code:
auto lo
iface lo inet loopback
iface ens192 inet manual
iface ens224 net manual
iface ens256 inet manual

auto vmbr0
iface vmbr0 inet static
    address 10.200.10.171/24
    gateway 10.200.10.254
    bridge-ports ens192
    bridge-stp off
    bridge-fd 0

VMs are connected to vmbr0, they will send a request for an IP address that the bridge then forwards to ens192 where the DHCP server sees it and and answers with an IP address the VM can use, this response than ends up at the bridge again which forwards it back to the VM. The VM doesn't know there was a bridge involved, and it also doesn't care.
 
hi Hannes,
I fixed them back to the original like this
Code:
auto lo
iface lo inet loopback

iface ens192 inet manual

iface ens224 inet manual

iface ens256 inet manual

auto vmbr0
iface vmbr0 inet static
        address 10.200.10.171/24
        gateway 10.200.10.254
        bridge-ports ens192
        bridge-stp off
        bridge-fd 0
but they still don't work ,
As soon as I initialized proxmox, the configuration file was the same as above and the vms I created was not given an ip.
 
Can the VMs ping your router?
 
How did the VM get its IP? Did you configure it statically? What is the output of dhclient -v when you run it in the VM?
 
I configured static ip for this vm
and this is the result when running the command
Code:
dhclient -v
1723014365652.png
 
This doesn't look like it was run in the VM. And there is still vmbr1, so your changes to the interfaces file don't seem to be applied, you can run ifreload -a to apply them. If that's all the output, then it looks like there is no DHCP server on your network. Do you have different devices that got an IP assigned in 10.200.10.0/24?
 
I have 3 network cards and I only use a bridge to connect to 1 card, ens1921723019304871.png
 
Last edited:
Did you run the command in the VM as I asked? Not on the PVE host.
 
Maybe you are confused with my problem
I have an ip range of 10.200.10.0/24, DHCP server 10.200.10.199, gateway 10.200.10.254, then I installed proxmox on 1 vm and this vm has an ip of 10.200.10.171, now I want to create 1vm from proxmox and want this vm to be given a DHCP ip when installed
 

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!