Customizing DHCP options
IMPORTANT: Use caution when customizing DHCP options because the configuration might affect DHCP operation. | ||
You can customize options for the following purposes:
Add newly released options.
Add options for which the vendor defines the contents, for example, Option 43.
Add options for which the CLI does not provide a dedicated configuration command. For example, you can use the option 4 ip-address 1.1.1.1 command to define the time server address 1.1.1.1 for DHCP clients.
Add all option values if the actual requirement exceeds the limit for a dedicated option configuration command. For example, the dns-list command can specify up to eight DNS servers. To specify more than eight DNS servers, you must use the option 6 command to define all DNS servers.
To customize a DHCP option in a DHCP address pool:
Step | Command | Remarks |
---|---|---|
1. Enter system view. | system-view | N/A |
2. Create a DHCP address pool and enter its view. | dhcp server ip-pool pool-name | By default, no DHCP address pool exists. |
3. Customize a DHCP option. | option code { ascii ascii-string | hex hex-string | ip-address ip-address&<1-8> } | By default, no DHCP option is customized in a DHCP address pool. DHCP options specified in DHCP option groups take precedence over those specified in DHCP address pools. |
To customize a DHCP option in a DHCP option group:
Step | Command | Remarks |
---|---|---|
1. Enter system view. | system-view | N/A |
2. Create a DHCP user class and enter DHCP user class view. | dhcp class class-name | By default, no DHCP user class exists. |
3. Configure a match rule for the DHCP user class. | if-match rule rule-number { hardware-address hardware-address mask hardware-address-mask | option option-code [ ascii ascii-string [ offset offset | partial ] | hex hex-string [ mask mask | offset offset length length | partial ] ] | relay-agent gateway-address } | By default, no match rule is configured for a DHCP user class. |
4. Return to system view. | quit | N/A |
5. Create a DHCP option group and enter DHCP option group view. | dhcp option group option-group-number | By default, no DHCP option group exists. |
6. Customize a DHCP option. | option code { ascii ascii-string | hex hex-string | ip-address ip-address&<1-8> } | By default, no DHCP option is customized in a DHCP option group. DHCP options specified in DHCP option groups take precedence over those specified in DHCP address pools. |
7. Create a DHCP address pool and enter DHCP address pool view. | dhcp server ip-pool pool-name | By default, no DHCP address pool exists. |
8. Specify the DHCP option group for the DHCP user class. | class class-name option group option-group-number | By default, no DHCP option group is specified for a DHCP user class. |
Table 2: Common DHCP options
Option | Option name | Corresponding command | Recommended option command parameters |
---|---|---|---|
3 | Router Option | gateway-list | ip-address |
6 | Domain Name Server Option | dns-list | ip-address |
15 | Domain Name | domain-name | ascii |
44 | NetBIOS over TCP/IP Name Server Option | nbns-list | ip-address |
46 | NetBIOS over TCP/IP Node Type Option | netbios-type | hex |
66 | TFTP server name | tftp-server | ascii |
67 | Boot file name | bootfile-name | ascii |
43 | Vendor Specific Information | N/A | hex |