20.28. kb-00027: Set hostname in a DHCP Reservation

20.28.1. Knowledge Base Article: kb-00027

20.28.2. Description

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.

20.28.3. 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.

20.28.4. Additional Information

Additional resources and information related to this Knowledge Base article.

20.28.4.1. See Also

20.28.4.2. Versions

all

20.28.4.3. Keywords

dhcp, machine name, hostname, static reservation, ip address assignment, option 12

20.28.4.4. Revision Information

KB Article     :  kb-00027
initial release:  Wed Jun 10 12:10:55 PDT 2020
updated release:  Wed Jun 10 12:10:55 PDT 2020