< Home

Configuring Defense Against DHCP Server DoS Attacks

Context

If attackers maliciously apply for IP addresses from the DHCP server, the IP address pool becomes exhausted, preventing authorized users from obtaining IP addresses. This can happen if attackers continuously apply for IP addresses by changing the client hardware address (CHADDR) field, which is the field that DHCP servers generally use to identify the MAC address of a DHCP client.

To prevent DHCP users on some interfaces from maliciously applying for IP addresses, you can limit the number of DHCP snooping binding entries that can be learned by an interface to control the number of users connected through that interface. When the number of DHCP snooping binding entries reaches the maximum value, no DHCP client can obtain an IP address through the interface. To prevent attacks carried out by continuously changing the CHADDR field in the DHCP Request message, enable the device to check whether the MAC address in the Ethernet frame header matches the CHADDR field in the DHCP message. With this function enabled, the message is only forwarded if the two values match.

Procedure

  1. Run system-view

    The system view is displayed.

  2. Set the maximum number of DHCP snooping binding entries to be learned by an interface in the system, VLAN, or interface view.

    • In the system view:

    1. Run dhcp snooping max-user-number max-user-number vlan { vlan-id1 [ to vlan-id2 ] } &<1-10>

      The maximum number of DHCP snooping binding entries is set on the device.

      After running this command, the value specified in this command is the total number of DHCP snooping binding entries learned by all interfaces on the device.

      By default, the maximum number of DHCP snooping binding entries that can be learned on an interface is 512 for S2720-EI, 2048 for S5720-LI, S5735-L, S5735S-L, S5735S-L-M, S5720S-LI, S5720-SI, S5735-S, S5735S-S, S5735-S-I, S5720I-SI, S5720S-SI, S5730-SI, S5730S-EI, S6720-LI, S6720S-LI, S6720-SI, and S6720S-SI, and 8192 for other models.

    2. (Optional) Run dhcp snooping user-alarm percentage percent-lower-value percent-upper-value

      The alarm thresholds for the percentage of DHCP snooping binding entries are configured.

      By default, the lower alarm threshold for the percentage of DHCP snooping binding entries is 50, and the upper alarm threshold for the percentage of DHCP snooping binding entries is 100.

    • In the VLAN view and interface view:

    1. Run vlan vlan-id

      The VLAN view is displayed.

      Or run interface interface-type interface-number

      The interface view is displayed.

    2. Run dhcp snooping max-user-number max-user-number

      The maximum number of DHCP snooping binding entries is set on the interface.

      If you run this command in the VLAN view, the command takes effect for all the interfaces in the VLAN.

      By default, the maximum number of DHCP snooping binding entries that can be learned on an interface is 512 for S2720-EI, 2048 for S5720-LI, S5735-L, S5735S-L, S5735S-L-M, S5720S-LI, S5720-SI, S5735-S, S5735S-S, S5735-S-I, S5720I-SI, S5720S-SI, S5730-SI, S5730S-EI, S6720-LI, S6720S-LI, S6720-SI, and S6720S-SI, and 8192 for other models.

      If you run this command in the VLAN view, the command takes effect on all the DHCP messages in the specified VLAN received by all the interfaces on the device. If you run this command in the interface view, the command takes effect on all the DHCP messages received by the specified interface.

      If you run this command in the system view, VLAN view, and interface view, the smallest value takes effect.

  3. Enable the device to check the CHADDR field in the message in the system view, VLAN view, or interface view.

    • In the system view:

    1. Run dhcp snooping check dhcp-chaddr enable vlan { vlan-id1 [ to vlan-id2 ] } &<1-10>

      The device is enabled to check whether the MAC address in the Ethernet frame header matches the CHADDR field in the DHCP message.

      By default, the device does not check whether the MAC address in the Ethernet frame header matches the CHADDR field in the DHCP message.

    2. (Optional) Run dhcp snooping alarm threshold threshold

      The global alarm threshold for the number of discarded messages by DHCP snooping is set.

      If you run this command in the system view, the command takes effect for all the interfaces on the device.

      By default, the global alarm threshold for the number of messages discarded by DHCP snooping is 100.

    • In the VLAN view or interface view:

    1. Run vlan vlan-id

      The VLAN view is displayed.

      Or run interface interface-type interface-number

      The interface view is displayed.

    2. Run dhcp snooping check dhcp-chaddr enable

      The device is enabled to check whether the MAC address in the Ethernet frame header matches the CHADDR field in the DHCP message.

      By default, the device does not check whether the MAC address in the Ethernet frame header matches the CHADDR field in the DHCP message.

      If you run the dhcp snooping check dhcp-chaddr enable command in the VLAN view, the command takes effect on all the DHCP messages in the specified VLAN received by all the interfaces on the device. If you run the dhcp snooping check dhcp-chaddr enable command in the interface view, the command takes effect for all the DHCP messages received on the interface.

    3. (Optional) Run dhcp snooping alarm dhcp-chaddr enable

      The device is configured to generate a DHCP snooping alarm when the number of packets dropped in CHADDR field check reaches the alarm threshold.

      By default, the DHCP snooping alarm function is disabled.

      This command can only be used in the interface view.

    4. (Optional) Run dhcp snooping alarm dhcp-chaddr threshold threshold

      The alarm threshold for the number of DHCP messages discarded because the CHADDR field in the DHCP messages does not match the source MAC address in the Ethernet frame header is set.

      By default, an alarm is generated in the system when at least 100 DHCP snooping messages are discarded, and the alarm threshold on an interface is set using the dhcp snooping alarm threshold command in the system view.

      If the alarm threshold is set in the system view and interface view, the smaller value takes effect.

      This command can only be used in the interface view.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >