264
hex hex-string: Matches the specified string in the option, which must be a hex string of even
numbers in the range of 2 to 256. If you do not specify the hex-string argument, the DHCP server
only checks whether the specified option exists in the received packets.
mask mask: Specifies the mask used to match the option content. The mask argument is a hex
string of even numbers in the range of 2 to 256. The length of mask must be the same as that of
hex-string.
offset offset: Specifies the offset to match the option, in the range of 0 to 254 bytes. If you do not
specify the offset argument, the server matches the entire option with the rule.
length length: Matches the specified length of the option, in the range of 1 to 128 bytes. The
specified length must be the same as the hex-string length.
Usage guidelines
You can configure multiple match rules for a DHCP user class. Each match rule is uniquely identified
by a rule ID. Different match rules can include the same option code, but they cannot have the exact
same matching criteria.
The DHCP server matches DHCP requests against the match rules. A DHCP client matches a DHCP
user class when its request matches one of the specified match rules.
The match operation follows these guidelines:
If only the option-code argument is specified in the rule, packets containing the option match the
rule.
If only the option-code and hex-string arguments are specified in the rule, packets that have the
specified hex string in the specified option match the rule.
If the option-code, hex-string, offset and length arguments are specified in the rule, packets
match the rule as long as their content from offset+1 bit to offset+length bit in the specified
option is the same as the specified hex string.
If the option-code, hex-string, and mask arguments are specified in the rule, the DHCP server
ANDs the content from the first bit to the mask-1 bit in the specified option with the mask, and
then compares the result with the result of the AND operation between hex-string and mask. If
the two results are the same, the received packet matches the rule.
Examples
# Configure match rule 1 to match DHCP requests that contain Option 82 for DHCP user class
contain-option82.
<Sysname> system-view
[Sysname] dhcp class contain-option82
[Sysname-dhcp-class-contain-option82] if-match rule 1 option 82
# Configure match rule 2 to match DHCP requests that contain Option 82 whose first three bytes is
0x13ae92 for DHCP user class exam.
<Sysname> system-view
[Sysname] dhcp class exam
[Sysname-dhcp-class-exam] if-match rule 2 option 82 hex 13ae92 offset 0 length 3