Using DHCP Option 12 to send a hostname

This feature allows you to include the hostname in the DHCP packet sent to the DHCP server. This is disabled by default. The command must be executed from the global configuration level.

Syntax:


dhcp host-name-option
no dhcp host-name-option

Sends the hostname option with DHCP packets. Use the no form of the command to not include the hostname in the packet.

The maximum size of the hostname is 32 characters.

Default: disabled

DHCP Option 12 command

switch(config)# dhcp host-name-option

SNMP support

A MIB object supports enabling and disabling the DHCP Option 12 feature. It is added in the hpicfDhcpclient.mib. The hostname is retrieved from the MIB variable SYSNAME. Validity checks on the name include:

  • The name starts with a letter, ends with a letter or a digit, and can have letters, hyphens, or digits in between the first and last characters.

  • The maximum size supported for a hostname is 30 characters. If SYSNAME is more than 30 characters, then DHCP Option 12 will not be included in the packet.

  • The minimum number of characters supported for a hostname is one character. If the SYSNAME in the MIB is null, then DHCP Option 12 will not be included in the packet.