Is there a way to relate the mac address of a machine to it's hostname when deploying images over a network?
This is a os-agnostic question; When deploying to a large number of machines, the only thing you have to differentiate them with is a mac address; DHCP can assign an IP to each machine based on it's mac address, and then DNS will assign it a FQDN but if you deploy the same image to many machines over a network, the OS on the image itself has to know how to set the hostname of the machine when it boots up; so how does the booted / written os image determine how to set its own hostname?
Solution 1:
dhcp protocol can send hostname. It can be set with request host-name
option in gnu/linux.
https://www.rfc-editor.org/rfc/rfc1533#section-3.14
Solution 2:
As you already said: it either does a reverse lookup of the ip-address that gets assigned by DHCP and sets the hostname from there or it sets the hostname that gets sent as DHCP option 12