< Home

option

Function

The option command configures the user-defined option that a DHCP server assigns to a DHCP client.

The undo option command deletes the user-defined option that a DHCP server assigns to a DHCP client.

By default, no user-defined option that a DHCP server assigns to a DHCP client is configured.

Format

option code [ sub-option sub-code ] { ascii ascii-string | hex hex-string | cipher cipher-string | ip-address ip-address &<1-8> }

undo option [ code [ sub-option sub-code ] ]

Parameters

Parameter

Description

Value

code

Specifies the code of a user-defined option.

The value is an integer that ranges from 1 to 254, except the values 1, 3, 6, 15, 44, 46, 50, 51, 52, 53, 54, 55, 57, 58, 59, 61, 82, 120, 121, and 184.
NOTE:

There are well-known options and user-defined options. For details about well-known options, see RFC 2132.

When the switch functions as a DHCP client, Option 147 can be used in an EasyDeploy scenario and is not recommended in other scenarios.

sub-option sub-code

Specifies the code of a user-defined sub-option.

The value is an integer that ranges from 1 to 254. For details about well-known options, see RFC 2132.

ascii ascii-string

Specifies the user-defined option code as an ASCII character string.

The value is a string of case-sensitive characters with spaces supported. If sub-option is not specified, the value is a string of 1 to 255 characters. If sub-option is specified, the value is a string of 1 to 253 characters.

hex hex-string

Specifies the user-defined option code as a hexadecimal character string.

The value is a hexadecimal string with an even number of characters, for example, hh or hhhh. If sub-option is not specified, the value without spaces ranges from 1 to 254 characters; if sub-option is specified, the value without spaces ranges from 1 to 252. The value can be a combination of digits (0-9), uppercase letters (A-F), and lowercase letters (a-f).

cipher cipher-string

Specifies the user-defined option code as a ciphertext character string.

The value is a character string either in plain text or cipher text.

  • The character string in plain text is a string of 1 to 64 characters.
  • The character string in cipher text is a string of 32 to 104 characters.

No matter whether the character string is entered in plain or cipher text, the character string is displayed in cipher text in the configuration file and in plain text in packets.

ip-address ip-address

Specifies the user-defined option code as an IP address.

The value is in dotted decimal notation.

Views

IP address pool view, DHCP Option template view

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

This command applies to DHCP servers. The option field in a DHCP packet carries control information and parameters. If a DHCP server is configured with options, when a DHCP client applies for an IP address, the client can obtain the configurations in the option field of the DHCP response packet from the DHCP server. To configure user-defined options for an interface address pool, run the dhcp server option command.

Precautions

  • To ensure configuration accuracy, read the Request For Comments (RFC) before configuring options.

  • When an option contains a password, the option code in ascii or hex type is insecure. You are advised to set the option code type to cipher. For security purposes, a password must contain at least two types of the following: lowercase letters, uppercase letters, digits, and special characters. In addition, the password must consist of at least six characters.

  • Note the following if the option code [ sub-option sub-code ] { ascii ascii-string | hex hex-string | cipher cipher-string | ip-address ip-address &<1-8> } command is not executed for the first time:
    • If the new code is different from the existing code, both the new and existing configurations take effect.
    • If the new code is the same as the existing code, the following situations may occur:
      • When a sub-code is specified in the existing command, the new configuration overrides the existing configuration if the new and existing sub-codes are the same, and both the new and existing configurations take effect if the new and existing sub-codes are different. If no sub-code is specified in the new command, the new configuration overrides the existing configuration.
      • When no sub-code is specified in the existing command, the new configuration overrides the existing configuration.
  • If the device functions as the DHCP server to assign IP addresses to APs, and the AC and APs are on different network segments, you need to configure the Option 43 field to specify the AC IP address for the APs. Otherwise, the APs cannot discover the AC. Run the option 43 { hex hex-string | [ sub-option 1 hex hex-string | sub-option 2 ip-address ip-address &<1-8> | sub-option 3 ascii ascii-string ] } command to configure the device to specify the AC IP address for APs in one of the following methods:
    1. Run the option 43 hex 031D3139322e3136382e3139342e35302c3139322e3136382e3139342e3534 command to configure the device to specify AC IP addresses 192.168.194.50 and 192.168.194.54 for APs. In this command, 03 is a fixed value; 1D indicates that the length of IP addresses (192.168.194.50,192.168.194.54) including dots (.) and the comma (,) is 29, and multiple IP addresses are separated by the comma (,); 3139322e3136382e3139342e3530 indicates the ASCII value of 192.168.194.50; 2C indicates the ASCII value of the comma (,); 3139322e3136382e3139342e3534 indicates the ASCII value of 192.168.194.54.
    2. Run the option 43 sub-option 1 hex C0A80001C0A80002 command to configure the device to specify AC IP addresses 192.168.0.1 and 192.168.0.2 for APs. In the command, C0A80001 indicates the hexadecimal format of 192.168.0.1, and C0A80002 indicates the hexadecimal format of 192.168.0.2.
    3. Run the option 43 sub-option 2 ip-address 192.168.0.1 192.168.0.2 command to configure the device to specify AC IP addresses 192.168.0.1 and 192.168.0.2 for APs.
    4. Run the option 43 sub-option 3 ascii 192.168.0.1,192.168.0.2 command to configure the device to specify AC IP addresses 192.168.0.1 and 192.168.0.2 for APs.

      If you need to configure multiple IP addresses when the option is specified as an ASCII character string, use commas (,) to separate the IP addresses.

    If the AC and APs are on the same network segment, you do not need to configure the Option 43 field, and the APs can discover the AC in broadcast mode. After Option 43 is configured, the APs unicast Discover Request packets to the IP address carried in Option 43 to discover the AC. If the APs do not receive any Discovery Response packet after sending unicast Discovery Request packets 10 consecutive times, the APs then broadcast packets to discover the AC.
  • When users on an enterprise's intranet use a proxy server to connect to the Internet, you need to configure proxy server parameters so that users can use browsers to access the network. The Web Proxy Auto-Discovery Protocol (WPAD) implements automatic configuration of these parameters. The administrator does not need to manually configure these parameters on each client. To implement the WPAD function, the administrator needs to deploy the configuration file of the proxy server in advance, and then run the option 252 asciiascii-string command to specify the URL of the configuration file. The ascii-string parameter specifies the URL of the configuration file, in the format of http://xxx/proxy.pac. Set ascii-string according to the actual location of the configuration file. When a browser accesses the network, the browser requests the DHCP server to send the URL of the configuration file on the proxy server, and then downloads the configuration file to conduct automatic configuration. After the configuration is completed, the browser can access the network.

    The value of ascii-string cannot be enclosed in double quotation marks as "ascii-string". Otherwise, terminals cannot parse Option252.

Example

# In the global address pool global1, configure Option64 to 0x11 (a hexadecimal number).
<HUAWEI> system-view
[HUAWEI] ip pool global1
[HUAWEI-ip-pool-global1] option 64 hex 11
# In the DHCP Option template template1, configure Option64 to 0x11 (a hexadecimal number).
<HUAWEI> system-view
[HUAWEI] dhcp option template template1
[HUAWEI-dhcp-option-template-template1] option 64 hex 11
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >