The dhcp option82 format command configures the format of the Option 82 field in a DHCP message.
The undo dhcp option82 format command restores the default format of the Option 82 field in a DHCP message.
By default, the Option 82 field in a DHCP message is in the format of default.
dhcp option82 [ vlan vlan-id ] [ ce-vlan ce-vlan-id ] [ circuit-id | remote-id ] format { default | common | extend | user-defined text }
undo dhcp option82 [ vlan vlan-id ] [ ce-vlan ce-vlan-id ] [ circuit-id | remote-id ] format
Parameter | Description | Value |
---|---|---|
circuit-id |
Indicates the circuit ID (CID) in the Option 82 field. If the CID is not specified, the format of the Option 82 field is default. |
- |
remote-id |
Indicates the remote ID (RID) in the Option 82 field. If the RID is not specified, the format of the Option 82 field is default. |
- |
default |
Indicates the default format of the Option 82 field.
|
- |
common |
Indicates the common format of the Option 82 field.
|
- |
extend |
Indicates the extended format of the Option 82 field.
In the CID and RID formats, the values without a unit are fixed values of the fields; the values with a unit indicate the field lengths. |
- |
user-defined text |
Indicates the user-defined format of the Option 82 field. |
The value is a string of 1 to 255 characters. For details, see the description in "Usage Guideline." |
vlan vlan-id |
Indicates an outer VLAN ID. If a VLAN ID is specified, only the format of the Option 82 field in the DHCP messages sent from the specified VLAN is configured. If no VLAN is specified, the format of the Option 82 field in all the DHCP messages received by the interface is configured. |
The value is an integer that ranges from 1 to 4094. |
ce-vlan ce-vlan-id |
Indicates an inner VLAN ID. |
The value is an integer that ranges from 1 to 4094. |
System view, Ethernet interface view, GE interface view, XGE interface view, 25GE interface view, MultiGE interface view, 40GE interface view, 100GE interface view, Eth-Trunk interface view, port group view
Usage Scenario
After the function of inserting the Option 82 field to DHCP messages is enabled, you can use the dhcp option82 format command to configure the format of the Option 82 field.
If you run the dhcp option82 format command in the system view, the command takes effect for all the DHCP messages on all the interfaces of the device.
Delimiters must be added between keywords; otherwise, the device cannot parse the keywords. The delimiters cannot be numbers.
The keyword length can be configured only once.
Prerequisites
DHCP has been enabled globally using the dhcp enable command.
All Option82 fields configured in the system view or in the same interface view share a length of 1-255 bytes. If their total length exceeds 255 bytes, some Option82 information will be lost.
There is no limit on the number of Option 82 fields configured on the device. However, a large number of Option 82 fields will occupy a lot of memory and prolong the device processing time. To ensure device performance, you are advised to configure Option 82 fields based on the service requirements and device memory size.
# Configure the default format for the CID in the Option 82 field.
<HUAWEI> system-view [HUAWEI] dhcp enable [HUAWEI] dhcp option82 circuit-id format default
# Configure the extended format for the CID and RID in the Option 82 field.
<HUAWEI> system-view [HUAWEI] dhcp enable [HUAWEI] dhcp option82 format extend
# Configure the user-defined string for the CID in the Option 82 field and encapsulate the port name, outer VLAN ID, inner VLAN ID, and host name in ASCII format.
<HUAWEI> system-view [HUAWEI] dhcp enable [HUAWEI] dhcp option82 circuit-id format user-defined "%portname:%svlan.%cvlan %sysname"
# Configure a hexadecimal notation string for the CID of the Option 82 field and encapsulate the CID type (fixed as 0, indicating the hexadecimal notation), length (excluding the lengths of the CID type and the keyword length itself), outer VLAN ID, slot ID (5 bits), subcard ID (3 bits), and port ID (8 bits).
<HUAWEI> system-view [HUAWEI] dhcp enable [HUAWEI] dhcp option82 circuit-id format user-defined 0 %length %svlan %5slot %3subslot %8port
# Configure the user-defined string for the RID in the Option 82 field and encapsulate the device MAC address in hexadecimal notation.
<HUAWEI> system-view [HUAWEI] dhcp enable [HUAWEI] dhcp option82 remote-id format user-defined %mac
# On GE0/0/1, configure the default format for the CID in the Option 82 field.
<HUAWEI> system-view [HUAWEI] dhcp enable [HUAWEI] interface gigabitethernet 0/0/1 [HUAWEI-GigabitEthernet0/0/1] dhcp option82 circuit-id format default
# On GE0/0/1, configure the extended format for the CID and RID in the Option 82 field of DHCP messages from VLAN 10.
<HUAWEI> system-view [HUAWEI] dhcp enable [HUAWEI] interface gigabitethernet 0/0/1 [HUAWEI-GigabitEthernet0/0/1] dhcp option82 vlan 10 format extend
# On GE0/0/1, configure a user-defined format for the CID in the Option 82 field and encapsulate the port name, outer VLAN ID, inner VLAN ID, and host name in ASCII format.
<HUAWEI> system-view [HUAWEI] dhcp enable [HUAWEI] interface gigabitethernet 0/0/1 [HUAWEI-GigabitEthernet0/0/1] dhcp option82 circuit-id format user-defined "%portname:%svlan.%cvlan %sysname"
# On GE0/0/1, configure a hexadecimal notation string for the CID of the Option 82 field and encapsulate the CID type (fixed as 0, indicating the hexadecimal notation), length (excluding the lengths of the CID type and the keyword length itself), outer VLAN ID, slot ID (5 bits), subcard ID (3 bits), and port ID (8 bits).
<HUAWEI> system-view [HUAWEI] dhcp enable [HUAWEI] interface gigabitethernet 0/0/1 [HUAWEI-GigabitEthernet0/0/1] dhcp option82 circuit-id format user-defined 0 %length %svlan %5slot %3subslot %8port
# On GE0/0/1, configure the user-defined format for the RID in the Option 82 field and encapsulate the device MAC address in hexadecimal notation.
<HUAWEI> system-view [HUAWEI] dhcp enable [HUAWEI] interface gigabitethernet 0/0/1 [HUAWEI-GigabitEthernet0/0/1] dhcp option82 remote-id format user-defined %mac