Issue with dhcp and netplan

cfnz

Member
Feb 12, 2019
11
2
23
55
Hi,

I am just evaluating Proxmox, and have come across a strange issue.

I have made a template Ubuntu 18.04 server (with netplan by default - setup with DHCP during install, disabled ipv6 after install), and cloned it a few times.

Whenever I clone it, it gets a new mac - good, but it gets the same ip address assigned via dhcp - bad.

I have access to a Xen box, so tried the same thing (fresh install, followed same steps - it is on a different subnet, so that is different, but uses the same DHCP server)... it works. All new vms get a new mac address AND a new ip address - all good.

Went back to the Proxmox VMs, and removed netplan, and everything worked - new clones get new mac addresses and ip addresses, so at least something works.

Cloned some of the original VMs again, and still get new mac addresses but same ip address assigned.

I am not too familiar with netplan or Proxmox, but something strange is happening and I am not sure how to debug it. As mentioned, it does not seem to replicate behaviour on a Xen box.

Any pointers on debugging would be appreciated.

Regards
Colin
 
I have just done a new vm without removing IPv6, so basically use ubuntu 18.04.1 install (not the live install) with pretty much default options. Turn into a template, clone twice, and both clones have different mac addresses but get the same ip address via dhcp.
 
Hi,
maybe have a look at the dhcp server logs and/or capture the dhcp requests/responses via tcpdump and/or wireshark to check what is going on.
 
Thanks for that suggestion... I have managed to get a capture from the server... I am not too sure what it is supposed to say, but think I found something strange... It goes like this:

Guest A and B both go through the DHCP Discover, Offer, Request and Ack process all successfully.

In the DHCP Discover of guest A and B the Client Mac Addresses are correct (i.e. different). In the Offer that comes back, the DHCP server is offering the same IP address... so why is the DHCP server offering the same IP address for different mac addresses?

Digging a little deeper, in the DCHP request, there is an Option 61 Client Identifier... as far as I can tell, these are supposed to be different and somewhat based on the Mac address. However, the Client Identifier for both of the guests is identical.

So it seems that DHCP servers are supposed to use this Option 61 Client Identifier rather than the Mac address... and would I be correct to assume that this identifier is supposed to be different. If so, seems a reasonably fundamental problem.

Where would I look next? Is it a problem with netplan (as mentioned, it does not do it if I use ifup/down). Or is it somehow netplan with proxmox? As mentioned, if I do (almost) the same thing on Xen, it works... almost because it is a different subnet and may be slighly different infrastructure.

Any more help appreciated... I still have the capture file if needed.

Regards
Colin
 
Did you changed the machine-id of the cloned VMs? If not, try it first and check if you then get an different IP.
 
Thank you both very much, firstly, yes it is a Windows DHCP server and yes, the reference example you gave fixed the problem, i.e. updating the net plan to include the dhcp-identifer option:
...
enp3s0:
dhcp4: yes
dhcp-identifier: mac

And, no, I did not change the machine-id of the cloned VMs, and doing this also solved the problem, which might be the better fix... I know about removing ssh keys, but this will also have to be in my to-do list after cloning a linux box... one that uses net plan anyway... i.e. (for people who have found this in a search - in ubuntu 18.04)
sudo rm /etc/machine-id
sudo systemd-machine-id-setup


Thanks again :)
 

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!