Set hostname in a DHCP Reservation
This article describes how to use the Digital Rebar DHCP mechanisms to set a Machine name. A Machine Reservation must be created for the spcific Machine, to allow for custom setting values like the Machine Name and a consistent ("static") IP Address assignment.
Solution¶
If you create a DHCP Reservation for a system (or convert an active Lease to Reservation), you can also set the Hostname for the Machine. If you are pre-creating Reservations, this will allow you to have a pre-set hostname when the Machine first comes up. Additionally, if you create/destroy your machine objects, but would like a hostname to persist with the Machine Reservation when the machine returns, you can do this.
Note
The UX version (at least as of v1.2.1 and older) does not support setting DHCP options to the Reservation. You will have to perform these actions using either the CLI or API. The CLI method is outlined below.
This procedure assumes you have a Reservation created already, and we are going to update the existing Reservation. You can combine this procedure with creating a new Reservation, but only if you perform the operation via the CLI or API.
# show the current Reservation:
drpcli reservations show 192.168.8.100
# create a Hostname specification in the DHCP Options section of the reservation:
drpcli reservations update 192.168.8.100 '{ "Options": [ { "Code": 12, "Value": "pxe-client-8-100" } ] }'
In the above exmaple, we are assuming our DHCP Reservation is for a
Reservation identified by the IP Address 192.168.8.100
, and that we
are setting the hostname (DHCP Option 12) to pxe-client-8-100
.
Additional Information¶
Additional resources and information related to this Knowledge Base article.
See Also¶
Versions¶
all
Keywords¶
dhcp, machine name, hostname, static reservation, ip address assignment, option 12