2

I would like to know if there is a way to hardcode a DHCP client id inside /etc/network/interfaces. Preferably in a way that would supersede the client's mac address as a determiner for obtaining a lease.

My Ubuntu 16.04 VM is getting the same IP lease as its host (Windows 10, running hyper-V). The virtual interface for the VM (setup as a virtual Ethernet device) is bridged with the host's Wifi interface. I suspect my home wifi can't support more than one mac address per connection or something like that (non-WDS).

It would be convenient to differentiate the dhcp clients using a client option passed from /etc/network/interfaces. I'm not exactly sure how I should be passing this parameter to dhclient from the command line nor the config files either.

Things I've tried (unsuccessfully):

  • dhclient -i doesn't seem to do anything different. (even after deleting all lease files)
  • Enabling mac address spoofing on the adapter settings for the VM in hyper-v. (I think that applies to stuff happening inside the guest though).

In case it matters, my home router is running OpenWrt Chaos Calmer 15.05.1. I'm not sure which particular dhcpd server runs on it.

Related issue:

Hyper-V Virtual Switch issue: Same IP on guest and host

1

I came across your post while I was trying to figure out the same thing for Ubuntu 18.04. In 18.04, there is a file /etc/dhcp/dhclient.conf that allowed me to change DHCP options. On my VMs, the default client id was generated using the hostname and I didn't change my hostname after cloning the VMs. Changing the hostname fixed the problem.

It looks like the same file exists in Ubuntu 16.04 http://manpages.ubuntu.com/manpages/xenial/man5/dhclient.conf.5.html

1
  • that looks very promising. I see an example in that man page: send dhcp-client-identifier 1:0:a0:24:ab:fb:9c; . I'll give it a spin when I get to it. I may not be able to pass that option down from /etc/network/interfaces directly, but hopefully if I mark it as "dhcp" in the interfaces file, and add the key in dhclient.conf for the particular interface, it should pick it up.
    – init_js
    Sep 28 '18 at 5:25
0

In ubuntu 18.04-20.04 DHCP client-id generates from /etc/mashine-id

After cloning VMs you must change /etc/mashine-id , /etc/hostname and /etc/hosts

If you forget to change /etc/mashine-id , you will get same client-id and ip-address.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.