Do Dnsmasq's static DHCP entries match on client-id or MAC by default?

I've had some strange lease assignments seemingly at random, and reading through the manpage, it shows the syntax can be:

  • dhcp-host=34:27:01:5d:60:ad, test-pc, 192.168.1.10
  • dhcp-host=id:some_client_id, test-pc, 192.168.1.10
  • dhcp-host=34:27:01:5d:60:ad, id:*, test-pc, 192.168.1.10

My question mostly hinges on the optional "id:*" portion. The manpage says that it means, "ignore any client-id and use MAC addresses only."

The syntax and the docs do seem to point to the MAC being the default, so why would anyone ever need to say, "ignore the optional thing that I've already omitted, and use the default thing that I supplied?"

What am I missing about this option? If I've not supplied anything prefixed with "id:", it seems clear that I'm not intending to match on a client-id, so what exactly is it that I'm ignoring by specifying the asterisk?


Solution 1:

What am I missing about this option?

How can I take the advantage of it, why a wildcard could be good or bad.

Let's say you have some host with Windows or Linux. DHCP client requests for IP lease (MAC & ID are included in the request) and your server saves it as combination of MAC address and OS ID in the database (some file usually for dnsmasq and dhcpd). Then you decide to make it static DHCP entry and change the IP to keep it in specified place in your IP space. Sometime later you discover that the host has Intel AMT interface which allows you to remote control the machine at the BIOS level. You want to configure the interface IP from DHCP as well. Confusingly the DHCP server assigns different IP from OS (not the same combination of MAC - same, ID - not), then you realize meaning of ID field in DHCP request. You reconfigure DHCP server and change ID for wildcard, the peace has come, AMT interface and the OS itself share the same IP. Similar thing applies for PXE boot as well.

PS. I believe (from what I can recall) that those DHCP servers in default configuration use MAC & ID pair to decide about the IP assignment:

  • dhcpd
  • dnsmasq
  • mikrotik DHCP (seems like some clone of dnsmasq, very similar limitations)