Can we change the DHCP client-id from /etc/network/interfaces?

6,736

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

Share:
6,736

Related videos on Youtube

init_js
Author by

init_js

Computer Scientist, Experienced Software Engineer.

Updated on September 18, 2022

Comments

  • init_js
    init_js over 1 year

    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

  • init_js
    init_js over 5 years
    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.
  • Michael Firth
    Michael Firth about 2 years
    Is mashine-id a typo or a localisation feature? On my Ubuntu 18.04 system it is spelt in the standard English way /etc/machine-id