< Home

dhcpv6 option37 format

Function

The dhcpv6 option37 format command configures the format of the Option 37 field in a DHCPv6 message.

The undo dhcpv6 option37 format command restores the default format of the Option 37 field in a DHCPv6 message.

By default, the format of the Option 37 field is not configured in a DHCPv6 message.

Format

dhcpv6 option37 [ vlan vlan-id ] [ ce-vlan ce-vlan-id ] format user-defined text

undo dhcpv6 option37 { [ vlan vlan-id ] [ ce-vlan ce-vlan-id ] format | format all }

Parameters

Parameter Description Value

user-defined text

Indicates the user-defined format of the Option 37 field.

The value is a string of 1 to 247 characters.

The details about the user-defined format string are provided in the Usage Guidelines.

vlan vlan-id

Specifies the outer VLAN ID.

NOTE:
  • If a VLAN is specified, only the format of the Option 37 field in DHCPv6 messages that belong to this VLAN is configured. If no VLAN is specified, the format of the Option 37 field in all DHCPv6 messages received by the interface is configured.
  • If the format of the Option 37 field is configured on an interface and the VLAN to which it belongs, the configuration on the interface takes effect.
  • This parameter is not supported in the VLAN view.

The value is an integer that ranges from 1 to 4094.

ce-vlan ce-vlan-id

Specifies the inner VLAN ID.
NOTE:

This parameter is not supported in the VLAN view.

The value is an integer that ranges from 1 to 4094.

all

Deletes all formats of the Option 37 field.

-

Views

System view, VLAN 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

Default Level

2: Configuration level

Usage Guidelines

After the dhcpv6 option37 { insert | rebuild } enable command is executed to enable the device to insert the Option 37 field to a DHCPv6 message, you can run the dhcpv6 option37 format command to configure the format of the Option 37 field in a DHCPv6 message.

You can use the following keywords to define the Option 37 field. The format string can use the hexadecimal notation, ASCII format, or combination of the two formats.
  • sysname: indicates the ID of the access point. This keyword is valid only in ASCII format.
  • portname: indicates the name of a port, for example, GE0/0/1. This keyword is valid only in ASCII format.
  • porttype: indicates the type of a port. This keyword is a character string or in hexadecimal notation. For example, if the value is Ethernet in ASCII format, it is 15 in hexadecimal notation.
  • iftype: indicates the type of an interface, which can be eth or trunk. This keyword is valid only in ASCII format.
  • mac: indicates the MAC address of a port. In ASCII format, the value is in the format of H-H-H; in hexadecimal notation, the value is a number of six bytes.
  • slot: indicates the slot ID. This keyword is valid in ASCII format or in hexadecimal notation.
  • subslot: indicates the subslot ID. This keyword is valid in ASCII format or in hexadecimal notation.
  • port: indicates the port number. This keyword is valid in ASCII format or in hexadecimal notation.
  • svlan: indicates the outer VLAN ID. The value ranges from 1 to 4094. If this field is not required, this field is 0. This keyword is valid in ASCII format or in hexadecimal notation.
  • cvlan: specifies the inner VLAN ID. The value ranges from 1 to 4094. If this field is not required, this field is 0. This keyword is valid in ASCII format or in hexadecimal notation.
  • length: indicates the total length of the keywords following the keyword length.
  • n: indicates the value of the keyword svlan or cvlan if the SVLAN or CVLAN does not exist. The keyword n is on the left of the keyword svlan or cvlan. If the corresponding VLAN does not exist, the default value of the keyword svlan or cvlan is 4096 in ASCII format and is all Fs in hexadecimal notation. If the n keyword is added to the left of the keyword svlan or cvlan, the keyword svlan or cvlan is 0. This keyword is valid in ASCII format or in hexadecimal notation.

Delimiters must be added between keywords; otherwise, the device cannot parse the keywords. The delimiters cannot be numbers.

The symbols used in the format string are as follows:
  • The symbol % followed by a keyword indicates the format of the keyword.
  • A number to the left of the symbol % indicates the length of the keyword following the symbol %. In an ASCII character string, %05 has the same meaning as %05d in the C language. In a hexadecimal character string, the number indicates the keyword length in bits.
  • The symbol [] indicates an optional keyword. Each pair of brackets can contain only one keyword, svlan or cvlan. The keyword in the symbol [] is added to the Option 37 field only if the corresponding VLAN ID exists. To facilitate syntax check, the system does not support nesting of symbols [].
  • The symbol \ indicates an escape character. The symbols %, \, and [] following the escape character indicate themselves. For example, \\ represents \.
  • The contents in quotation marks (" ") are encapsulated in an ASCII string, and the contents outside the quotation marks are encapsulated in hexadecimal notation.
  • Other symbols are processed as common characters. The rules for setting the format string in ASCII format or hexadecimal notation are as follows:
    • An ASCII character string can contain Arabic numerals, uppercase letters, lowercase letters, and the following symbols: ! @ # $ % ^ & * ( ) _ + | - = \ [ ] { } ; : ' " / ? . , < > `.
    • By default, the length of each keyword in an ASCII character string is the actual length of the keyword.
    • A hexadecimal notation string can contain numerals, spaces, and % + keywords.
    • In a hexadecimal notation string, numbers are encapsulated in the Option 37 field in hexadecimal notation. A number from 0 to 255 occupies 1 byte; a number from 256 to 65535 occupies 2 bytes; a number from 65536 to 4294967295 occupies 4 bytes. Numbers larger than 4294967295 are not supported. Multiple numbers must be separated by spaces; otherwise, they are considered as one number.
    • All the spaces in a hexadecimal character string are ignored.
    • By default, the slot ID, subslot ID, port number, and VLAN ID in a hexadecimal character string occupy 2 bytes; the field length occupies 1 byte.
    • If the length of each keyword in a hexadecimal character string is specified, the total length of the hexadecimal character string must be a multiple of 8. If the length of a specified keyword is longer than 32 bits, the first 32 bits of the keyword are the actual keyword value, and other bits are set to 0.
    • A hexadecimal notation string can contain only the keywords whose values are numbers. Other keywords, such as port name, cannot be added to the hexadecimal notation string.
    • If a string is not contained in quotation marks, it is encapsulated in hexadecimal notation. To encapsulate the string in the ASCII format, use a pair of quotation marks to contain the string. For example, the slot ID is 3, and the port number is 4. If the string is in the %slot %port format, the value of the encapsulated string is a hexadecimal number 00030004. If the string is in the "%slot %port" format, the value of the encapsulated string is 3 4.
    • A format string can contain both hexadecimal strings and ASCII strings, for example, %slot %port "%sysname %portname:%svlan.%cvlan."

Example

# Configure the format of the Option 37 field in a DHCPv6 message in VLAN 10.

<HUAWEI> system-view
[HUAWEI] dhcp snooping enable
[HUAWEI] vlan 10
[HUAWEI-vlan10] dhcpv6 option37 format user-defined "%length %svlan %5slot %3subslot %8port"

# Configure the format of the Option 37 field in a DHCPv6 message on GE0/0/1.

<HUAWEI> system-view
[HUAWEI] dhcp snooping enable
[HUAWEI] interface gigabitethernet 0/0/1
[HUAWEI-GigabitEthernet0/0/1] dhcpv6 option37 format user-defined "%length %svlan %5slot %3subslot %8port"
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >