[SOLVED] VMs not assigned IP via router DHCP, automatically assigned elsewhere

Feynt

New Member
Feb 8, 2022
12
0
1
43
Morning folks. I'm having a persistent problem with my VMs on Proxmox. For some reason, no matter how I set up static routes in my router, the VMs I make in Proxmox all seem to take whatever IP address they please. This is problematic as I'm migrating VMs from one computer to another and would prefer to keep the same IP addresses (less to change). With most of the VMs I've created thus far I've accepted this, and was able to manually set IPs on some of the migrated VMs. But I'm currently attempting to manually set the IP of another migrated VM and it refuses to connect to the internet with the "proper" IP address.

How do I insist that a VM listen to my router and take an IP that it's supposed to rather than just be given one some other way? Is Proxmox also hosting a DHCP server in spite of me choosing not to do that at installation?
 
Hi,
I think we need to know more about your configuration. How many DHCP Servers are running in your environment? How is proxmox installed? (via Proxmox ISO, or on top of e.g. Debian GNU Linux?

How is your network looking like?
 
Hi,
I think we need to know more about your configuration. How many DHCP Servers are running in your environment? How is proxmox installed? (via Proxmox ISO, or on top of e.g. Debian GNU Linux?

How is your network looking like?

Hardware:
  • Homelab rack mounted server (Proxmox) (new)
  • Homelab workstation (CentOS 8) (old)
  • Netgear 8 port router (consumer)
  • Various PCs
All connectivity goes through the router, itself connected to a cable modem in bridge mode. To my knowledge, only the router is a DHCP server.

Proxmox was installed on the new server via remote management interface uploading the latest and greatest (as of a month ago) ISO via PXE. During installation I (believe I) stated the server should be set up on a private network with a remote DHCP server.

The old server I have has no issues with VMs getting DHCP connections when they are started via the router, and I'm able to take their MAC address and assign whatever IP I want. Refresh the network interface and it'll take the appropriate IP. Doing the same procedure with the new Proxmox server and assigning the new MAC address to the old IP, the VMs won't take the IP address, even after multiple reboots (router and VM). I was able to set the IP address of the Proxmox server itself via DHCP on the router, however, which is what really strikes me as odd.

In either case, new and old servers both have a single wired connection to the router. Neither should be configured to be a DHCP server, which is why I'm asking if Proxmox is hosting DHCP in spite of me.
 
Correct, though the old host is running CentOS and not Proxmox (yet). Each host as well has multiple VMs getting IPs for the network. It's just that the new Proxmox server is making VMs which make up their own IPs.

More info on that: The network connection picks up on all the correct info. The gateway is the proper address for my router, the DNS server as well. It has the correct netmask (standard /24), and picks up its appropriate 192.168.0.x address range, if not the specific IP I assigned in the DHCP settings of my router.
 
Correct, though the old host is running CentOS and not Proxmox (yet). Each host as well has multiple VMs getting IPs for the network. It's just that the new Proxmox server is making VMs which make up their own IPs.

More info on that: The network connection picks up on all the correct info. The gateway is the proper address for my router, the DNS server as well. It has the correct netmask (standard /24), and picks up its appropriate 192.168.0.x address range, if not the specific IP I assigned in the DHCP settings of my router.
And what IPs do you get on the new Proxmox VE server?

Is it possible that some (one) of the VMs on the new host is also doing DHCP?

Shot in the blue: do you have activated the firewall on the new host?
 
The VMs all get lower end IPs in no particular order: .16, .21, .7, and so on (again, all under the correct subnet)

None of the migrated VMs would. My only other VM which would have that functionality maybe mistakenly enabled is TrueNAS, but I've confirmed it is not enabled.

There is a firewall listed as enabled on the host machine in Proxmox's web UI, but it is not configured and lists no entries under it. I am naively assuming NAT and my router's firewall are doing a good enough job.
 
The VMs all get lower end IPs in no particular order: .16, .21, .7, and so on (again, all under the correct subnet)
you mean 192.168.0.7, 192.168.0.16, 192.168.0.21.

What if you shut down the old server and only run the new one. What happens to the IPs? I also would try with only one VM up and running (other Proxmox-host down).

Currently I have no idea whats going on there. If you only have one DHCP Server it should work in my opinion. I just tested it here in my lab. Got the same config as you. My internetrouter is the DHCP server.

If I install a VM in Proxmox VE it gets an ip from the router via DHCP. No problem.
 
Last edited:
Correct on the IPs.

If I shut down a VM and start up a new one it maintains its IP. Like the MAC addresses have been auto assigned an IP, and then their IP is recorded in a database somewhere so it'll always have the same IP when it reboots.

This is why I'm asking about Proxmox having a stealth DHCP server. It's very much the kind of behaviour I would expect to see from a DHCP service which auto records MAC addresses, but my router doesn't do that. More annoying than all of this, if I spin up a new VM on my old server or start up a wireless device and connect to the network, they will properly get their DHCP provided address from my router.
 
What if you check where the IP is coming from with (dhcpdump needed):

dhcpdump <ethdevice>
 
Last edited:
More frustrating, it says the DHCP address is rightly my router. In this example the VM should be 192.168.0.6, but it's being assigned .11 instead from.... Somewhere. There is only one page on my router to assign static IP addresses, and none are assigned 11. The virtual card's MAC address is assigned 6 very clearly, and I've even copied and pasted it just to be sure multiple times. I'm just... So confused by this...
 
I think it would help diagnosis if you posted some of your config files

/etc/network/interfaces
/etc/pve/qemu-server/<vm-id>.conf (the vm-id of one of the 'mis-behaving vm's)

Proxmox doesn't have a DHCP server

If the VM's are running windows - then ipconfig /all would display the IP of the DHCP server that issued the IP lease to the VM
If you are running Linux VM then something like
more /var/lib/dhcp/dhclient.leases
might be informative
 
Referencing one of my Windows VMs:

Code:
PS C:\Users\Administrator> ipconfig /all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : WIN-82DL8BGMTLV
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter Ethernet Instance 0:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection
   Physical Address. . . . . . . . . : BE-3D-E3-42-02-18
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::9925:5af0:6a23:57ea%23(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.0.19(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : February 8, 2022 7:44:54 AM
   Lease Expires . . . . . . . . . . : February 9, 2022 7:44:54 AM
   Default Gateway . . . . . . . . . : 192.168.0.254
   DHCP Server . . . . . . . . . . . : 192.168.0.254
   DHCPv6 IAID . . . . . . . . . . . : 398343651
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-28-F6-8B-3F-52-54-00-5B-ED-0F
   DNS Servers . . . . . . . . . . . : 192.168.0.254
   NetBIOS over Tcpip. . . . . . . . : Enabled
(IPv4 Address should be 192.168.0.158)

And an Ubuntu VM:

Code:
  TIME: 2022-02-08 19:23:52.071
    IP: 0.0.0.0 (f6:6e:8d:bc:5b:91) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
    OP: 1 (BOOTPREQUEST)
 HTYPE: 1 (Ethernet)
  HLEN: 6
  HOPS: 0
   XID: dce9be8c
  SECS: 1
 FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: f6:6e:8d:bc:5b:91:00:00:00:00:00:00:00:00:00:00
 SNAME: .
 FNAME: .
OPTION:  53 (  1) DHCP message type         3 (DHCPREQUEST)
OPTION:  61 (  7) Client-identifier         01:f6:6e:8d:bc:5b:91
OPTION:  55 ( 17) Parameter Request List      1 (Subnet mask)
                          2 (Time offset)
                          6 (DNS server)
                         12 (Host name)
                         15 (Domainname)
                         26 (Interface MTU)
                         28 (Broadcast address)
                        121 (Classless Static Route)
                          3 (Routers)
                         33 (Static route)
                         40 (NIS domain)
                         41 (NIS servers)
                         42 (NTP servers)
                        119 (Domain Search)
                        249 (MSFT - Classless route)
                        252 (MSFT - WinSock Proxy Auto Detect)
                         17 (Root path)
                        
OPTION:  57 (  2) Maximum DHCP message size 576
OPTION:  50 (  4) Request IP address        192.168.0.11
OPTION:  12 ( 13) Host name                 minecraft-KVM
---------------------------------------------------------------------------

  TIME: 2022-02-08 19:23:53.116
    IP: 192.168.0.254 (8:36:c9:ed:6b:b5) > 192.168.0.11 (f6:6e:8d:bc:5b:91)
    OP: 2 (BOOTPREPLY)
 HTYPE: 1 (Ethernet)
  HLEN: 6
  HOPS: 0
   XID: dce9be8c
  SECS: 0
 FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 192.168.0.11
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: f6:6e:8d:bc:5b:91:00:00:00:00:00:00:00:00:00:00
 SNAME: .
 FNAME: .
OPTION:  53 (  1) DHCP message type         5 (DHCPACK)
OPTION:  54 (  4) Server identifier         192.168.0.254
OPTION:  51 (  4) IP address leasetime      86400 (24h)
OPTION:   1 (  4) Subnet mask               255.255.255.0
OPTION:   3 (  4) Routers                   192.168.0.254
OPTION:   6 (  4) DNS server                192.168.0.254
(Request IP address should read 192.168.0.6)

And then Proxmox configs.

/etc/network/interfaces
Code:
cat /etc/network/interfaces
auto lo
iface lo inet loopback

iface ens9f3np3 inet manual

auto vmbr0
iface vmbr0 inet static
        address 192.168.0.110/24
        gateway 192.168.0.254
        bridge-ports ens9f3np3
        bridge-stp off
        bridge-fd 0

iface ens9f0np0 inet manual

iface ens9f1np1 inet manual

iface ens9f2np2 inet manual

/etc/pve/qemu-server/105.conf (the Ubuntu VM)
Code:
cat /etc/pve/qemu-server/105.conf
boot: order=scsi1;ide2;net0
cores: 4
ide2: local:iso/ubuntu-20.04.3-live-server-amd64.iso,media=cdrom
memory: 12288
meta: creation-qemu=6.1.0,ctime=1644206936
name: Minecraft
net0: e1000=F6:6E:8D:BC:5B:91,bridge=vmbr0,firewall=1
numa: 0
onboot: 1
ostype: l26
scsi1: TrueNAS:105/vm-105-disk-1.qcow2,size=50G
scsihw: virtio-scsi-pci
smbios1: uuid=a464f851-667f-45d7-a24f-b61a9f7ef4eb
sockets: 1
startup: order=5,up=300
vmgenid: 56f99b07-6bae-4d24-b6bf-40396e4f01e2

/etc/pve/qemu-server/108.conf (the Windows VM)
Code:
cat /etc/pve/qemu-server/108.conf
boot: order=ide0;ide2;net0
cores: 8
efidisk0: TrueNAS:108/vm-108-disk-1.qcow2,efitype=4m,pre-enrolled-keys=1,size=528K
ide0: TrueNAS:108/vm-108-disk-0.qcow2,size=300G
ide2: none,media=cdrom
machine: pc-q35-6.1
memory: 16192
meta: creation-qemu=6.1.0,ctime=1644212065
name: Ark
net0: e1000=BE:3D:E3:42:02:18,bridge=vmbr0,firewall=1
numa: 0
onboot: 1
ostype: win10
scsihw: virtio-scsi-pci
smbios1: uuid=601c3ab2-91a8-4bba-acc2-f6bce2d125ef
sockets: 1
startup: order=5,up=300
tpmstate0: TrueNAS:108/vm-108-disk-0.raw,size=4M,version=v2.0
vmgenid: 19646b8d-9330-484d-b98f-2c983c611bae
 
Well that all looks in order to me, I assume that 192.168.0.254 is your external router/dhcp server - as that is clearly identified by both VM's as the DHCP lease source.

To me, it looks like the issue is with your router, after all the VM has no control over the IP address it is issued with so if the expected IP is not in use, the obvious conclusion is that the VM is using the IP address that was sent.

Have you checked the lease entries on the router - particularly the mac-address associated with both expected and actual leases?

I'd be inclined to reboot your router for good measure......
 
Yes, 254 is my router. DHCP lease time iss hard coded to 24 hours on my router. I gave it a reboot this morning but the IP addresses are still the same. I can confirm the MAC addresses for each lease are identical as I've copied the MAC address out of Proxmox's hardware interface and pasted it into the reservation.

If we're certain the issue isn't some awkwardly interfering DHCP remapping from Proxmox or some other location, then I suppose I'll have to investigate other solutions from my router to those VMs. I still find it really strange though that I can make VMs on one server and have their IPs change, but not this one.
 
Have you got a spare router you can test? I dont think, this is a Proxmox VE problem, after our investigation.
 
Yeah, so, frustrations abound, but DHCP is working again. -.-;

I'm just going to go over there and cry now. I'm a programmer, I should know technology doesn't work how you want it to by now. It does things to spite you until it's satisfied you're broken and then works again...

I'm sorry future readers, there are no answers. I did nothing. It simply started to work again.
 
Last edited:
Yeah, so, frustrations abound, but DHCP is working again. -.-;

I'm just going to go over there and cry now. I'm a programmer, I should know technology doesn't work how you want it to by now. It does things to spite you until it's satisfied you're broken and then works again...

I'm sorry future readers, there are no answers. I did nothing. It simply started to work again.
nice, that it works again!

there always are and will be "ghosts in the machine" ;)
 
Yeah, so, frustrations abound, but DHCP is working again. -.-;

I'm just going to go over there and cry now. I'm a programmer, I should know technology doesn't work how you want it to by now. It does things to spite you until it's satisfied you're broken and then works again...

I'm sorry future readers, there are no answers. I did nothing. It simply started to work again.
Very late but I ran into this same issue. Don't know if it was sheer luck or a solution but after and hour of frustration I assigned a new IP in my router, enabled DHCP in the VM, rebooted the VM and it took the IP, then disabled DHCP in the VM again. Created an account just to post this and it could be entirely wrong but maybe it will help someone else.
 

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!