After DHCP snooping is configured on a device, interfaces can be classified as Trusted and Untrusted interfaces. DHCP snooping allows only DHCP request and response packets on Trusted interfaces to be sent to the CPU. DHCP snooping uses packet information on trusted interfaces to build and maintain a DHCP snooping binding table. DHCP snooping binding table is used for checking DHCP packets. Option 82, a field in a DHCP packet, specifies the forwarding paths of the DHCP packet. This field helps create DHCP snooping binding entries with accurate interface information. In addition, you can configure the whitelist function for DHCP snooping to implement whitelist-based filtering for packets to be sent to the CPU on the trusted client or server.
After DHCP snooping is enabled on a device, a device interface can be configured as trusted or untrusted. Generally, the interfaces connected to legitimate DHCP servers are configured as trusted, and all other interfaces are configured as untrusted. By default, all interfaces are untrusted.
A DHCP snooping binding table records hosts' media access control (MAC) addresses, IP addresses, IP address lease time, virtual local area network (VLAN) IDs, and interface information. DHCP snooping binding tables can be dynamic or static. Dynamic DHCP snooping binding tables are dynamically generated after DHCP snooping is enabled. Static DHCP snooping binding tables are manually configured.
Dynamic DHCP snooping binding table
If hosts obtain IP addresses from a DHCP server, the device dynamically learns the host information by parsing the DHCP reply packets received from trusted interfaces and uses the information to generate a dynamic DHCP snooping binding table.
Static DHCP snooping binding table
If hosts have statically configured IP addresses, you must use the hosts' MAC addresses, IP addresses, VLAN IDs, and interface information to configure a DHCP snooping binding table.
Option 82 is a field in a DHCP packet. This field carries specific interface information and therefore specifies the forwarding paths of DHCP packets. A host (DHCP client) generates a DHCP request packet and broadcasts it on the network. If a device receives the DHCP request packet and the device has the option 82 insertion function enabled, the device inserts an option 82 field into the DHCP request packet and sends the packet to a DHCP server. After receiving the packet, the DHCP server echoes the option 82 field in the DHCP reply packet and sends it to the device. The device removes the option 82 field and forwards the packet to the DHCP client interface that sent the DHCP request packet.
Option 82 field format
Option fields in a DHCP packet carry control information and parameters that are not defined in some protocols. Figure 1 shows the format of a DHCP packet. Figure 2 shows the format of an option field. The option 82 field code is 82. Devices use the option 82 field to determine the path along which DHCP packets are transmitted.
An option field consists of type, length, and value. The following table lists their meanings.
Field |
Length |
Description |
---|---|---|
Code |
1 byte |
Attribute of the message content |
Length |
1 byte |
Length of the message content |
Value |
Determined by the Length field |
Message content |
Figure 3 shows the option 82 field format. The option 82 field consists of one or more suboptions. Figure 4 shows the format of a suboption. At least one suboption must be defined in the option 82 field, and the suboption value can be null. Therefore, the minimum length of the option 82 field is 2.
A DHCP server uses the agent circuit ID suboption for allocating IP addresses and other parameters.
In addition to suboption 1, the NetEngine 8000 F supports suboption 9 for showing the vendor customization information.
Field |
Description |
---|---|
Code |
Attribute of the message content |
Length |
Length of the message content |
Agent Information Field |
Message content |
Field |
Description |
---|---|
SubOpt |
Attribute of the message content |
Length |
Length of the message content |
Sub-Option Value |
Message content |
The option 82 field can be applied to Layer 2 or Layer 3 devices. When the option 82 field is applied to a Layer 2 device, the device determines to which interface a DHCP packet is sent by parsing the option 82 field, and creates a corresponding entry in the DHCP snooping binding table. When the option 82 field is applied to a DHCP server at Layer 3, the server performs the IP address allocation policy by identifying the option 82 field.
Inserting the Option 82 field to packets at Layer 2
As shown in Figure 5, the DHCP client connects to the DeviceA, and the DeviceA connects to the DHCP relay agent or the DHCP server through a Layer 2 network.
The DeviceA is enabled with DHCP snooping globally. After receiving a DHCP discover or request packet, the device records the option 82 field carried in the packet and reconstructs the option 82 field based on the insertion policy. Then, the DeviceA sends the packet with the modified option 82 field to the DHCP server. After receiving the packet, the DHCP server echoes the option 82 field in the DHCP reply packet and sends it to the DeviceA. The DeviceA replaces the option 82 field in the DHCP reply packet with the recorded option 82 field (which is carried in the DHCP discover or request packet), determines the interface to which the DHCP reply packet is to be sent, creates a corresponding entry in the DHCP snooping binding table, and then sends the packet to the DHCP client.
Inserting the option 82 field to packets at Layer 3
On a Layer 3 network shown in Figure 6, the device functions as a DHCP relay agent.
With the option 82 function enabled, the device inserts the option 82 field to the DHCP discover packet and request packet. The DHCP server then implements IP address assignment policies and other policies based on the option 82 field.
After receiving the DHCP reply packet from the DHCP server, the device replaces the option 82 field in the DHCP reply packet with the recorded option 82 field (which is carried in the DHCP discover or request packet) and sends the packet to the DHCP client.
Option 82 implementation
If the option 82 field exists, the device checks the option 82 inserting mode. The mode is either Insert or Rebuild.
If the option 82 field does not exist:
The device inserts option 82 field with suboption 1 to the message, regardless of the appending configuration.
After a whitelist is configured for DHCP snooping, only DHCP packets listed in the whitelist are sent to the CPU, and the DHCP packets not listed in the whitelist are simply forwarded, without being sent to the CPU. This protects the device against attacks.