I'm aware that you can assign static DNS entry names by doing the following in dnsmasq.conf:
address=/wiki.leerdomain.lan/192.168.1.200
ptr-record=wiki.leerdomain.lan/192.168.1.200
and then assigning a static ip address using the mac address of the machine in question using DHCP (see the UCI configuration from OpenWRT below):
config host
option name 'wiki.leerdomain.lan'
option mac 'xx:xx:xx:xx:xx:xx'
option ip '192.168.1.200'
However, how then can I set the hostname of the Linux machine with option DHCP option 12? (or am I already doing that with the second snippet?)
I'm expecting the machine in question to be able to run the command hostname
and receive the hostname assigned by option 12.
Best Answer
In Dnsmasq, if you can edit the config file directly, you can specify a hostname for dhcp clients as follows:
dhcp-host=f8:da:0c:0a:af:c9,192.168.1.222,SpecialMachine,30d
This will assign client with the MAC address
f8:da:0c:0a:af:c9
the IP 192.168.1.222, the hostname "SpecialMachine" and a DHCP lease time of 30 days.[Apologies. In lieu of deleting this post, I figured, best to explain that in my case, what I wanted to accomplish was ensure that the device hostname showed up in my router as I wanted it. I did not verify that the device actually changed it's hostname].