< Home

dhcpv6 interface-id format

Function

The dhcpv6 interface-id format command configures the Interface-ID format in DHCPv6 packets.

The undo dhcpv6 interface-id format command restores the default Interface-ID format in DHCPv6 packets.

By default, the Interface-ID format in DHCPv6 packets is default.

Format

dhcpv6 interface-id format { default | user-defined text }

undo dhcpv6 interface-id format

Parameters

Parameter Description Value
default

Specifies the default Interface-ID format.

The default Interface-ID format is %04svlan.%04cvlan.%mac:%portname. The values of the S-VLAN and C-VLAN are integers containing four characters. If the length is fewer than four characters, the value is prefixed with 0s. For example, if the outer VLAN value in the DHCPv6 packets received by the device is 11, the inner VLAN value is 22, the inbound interface is VLANIF100, and the device MAC address is 6afe-870b-0000, the Interface-ID generated during the system parsing process is 0011.0022.6afe870b0000:vlanif100.

-
user-defined text
Specifies a user-defined format as the Interface-ID format. A user-defined format can be:
  • Format defined by keywords: The Interface-ID is defined based on the keywords supported by the user-defined format. For example, if the name of the device to which the users are connected and the outer VLAN to which the users belong need to be recorded, the user-defined format can be %sysname %svlan. If the device name is HUAWEI and the S-VLAN is 100, the user location information recorded by the Interface-ID is HUAWEI 100.

    For description of the keywords supported by the user-defined format, see Table 1.

  • Format defined by common character strings: The Interface-ID is directly defined as a character string. For example, if all users on an interface are located in the office building named N8, the Interface-ID can be directly defined as N8.

  • Mixed format: The Interface-ID is defined by both the keywords and common character strings. For example, the Interface-ID can be defined as %sysname N8.

The value is a string of case-sensitive characters without spaces. The character string contains 1 to 251 characters, excluding the quotation marks.

Views

System view

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

The Interface-ID records user access information such as the inbound interfaces of the DHCPv6 packets sent from the clients to the device. The device functions as a DHCPv6 relay or lightweight DHCPv6 relay agent (LDRA). When receiving the request packets sent from the DHCPv6 clients and forwarding the packets to the DHCPv6 server, the device can insert the Interface-ID to the packets to identify the DHCPv6 client location information. The location information can be used by the DHCPv6 server to assign IPv6 addresses and network parameters. You can run the dhcpv6 interface-id format command to configure the format of the Interface-ID inserted into DHCPv6 packets.

Table 1 Description of the keywords supported by the user-defined format

Keyword

Description

duid

Specifies the client ID, including information such as the client MAC address.

sysname

Specifies the device name of the client.

portname

Specifies the name of the inbound interface that receives the DHCPv6 packets sent from the client to the device.

porttype

Specifies the type of the inbound interface that receives the DHCPv6 packets sent from the client to the device. The interface type is specified when the NAS interface is configured in certain scenarios.

iftype

Specifies the type of the inbound interface that receives the DHCPv6 packets sent from the client to the device. The interface type is usually GE.

mac

Specifies the device MAC address.

slot

Specifies the slot number of the DHCPv6 packet sent from the client to the device.

subslot

Specifies the sub-slot number of the DHCPv6 packet sent from the client to the device.

port

Specifies the port number of the DHCPv6 packet sent from the client to the device.

svlan

Specifies the outer VLAN of the DHCPv6 packet sent by the client.

cvlan

Specifies the inner VLAN of the DHCPv6 packet sent by the client.

length

Specifies the total length of the keywords following the length keyword. The length of the length keyword is excluded.

Prerequisites

DHCP has been enabled globally using the dhcp enable command.

Precautions

  • The user-defined format content must be specified between the double quotation marks (""). For example, to configure the user-defined format content as mac, run the dhcpv6 interface-id format user-defined "%mac" command.

  • Separators that cannot be digits must be added between the keywords in the user-defined format. Otherwise, the keywords cannot be parsed.

  • The symbol % must be prefixed to the keywords in the user-defined format to differentiate them from common character strings. If a digit exists before the symbol % and keyword, the digit refers to the number of characters in the keyword.

  • The self-defined content is encapsulated in ASCII format. In addition to the preceding precautions, note the following rules:

    • The symbol \ is an escape character. The symbols %, \, and [] following the escape character indicate themselves. For example, \\ represents the character \.
    • 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.

Example

# Configure a user-defined format as the format of the Interface-ID in DHCPv6 packets and the device MAC address as the encapsulated content.

<HUAWEI> system-view
[HUAWEI] dhcp enable
[HUAWEI] dhcpv6 interface-id format user-defined "%mac"
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >