< Home

Enabling the DHCP Server Function

Context

Before a device can function as a DHCP server, you must enable DHCP. You can then enable the DHCP server function to operate based on an interface address pool or based on a global address pool.

Procedure

  • Enable the DHCP server function based on an interface address pool.
    1. Enter the system view.

      system-view

    2. Enter the interface or sub-interface view.

      interface interface-type interface-number[.subinterface-number ]

      Only the S5720-EI, S5720-HI, S5730-HI, S5731-H, S5731S-H, S5731-S, S5731S-S, S6720-HI, S5732-H, S6730-H, S6730S-H, S6730-S, S6730S-S, S6720-EI, and S6720S-EI support sub-interfaces.

    3. (Optional) On an Ethernet interface, run undo portswitch

      The interface is switched to Layer 3 mode.

      By default, an Ethernet interface works in Layer 2 mode.

      Only the S5720-EI, S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720-HI, S6720S-EI, S6730-H, S6730S-H, S6730-S, and S6730S-S support switching between Layer 2 and Layer 3 modes.

    4. Configure an IP address for the interface.

      ip address ip-address { mask | mask-length }

    5. Enable the interface to use the interface address pool for providing the DHCP server function.

      dhcp select interface

      By default, the DHCP server function using the interface address pool is disabled on an interface

      If the device functioning as the DHCP server provides the DHCP service for clients connected to multiple interfaces, repeat this step to enable the DHCP server function on all the interfaces.

  • Enable the DHCP server function based on a global address pool.
    1. Enter the system view.

      system-view

    2. Enter the interface or sub-interface view.

      interface interface-type interface-number[.subinterface-number ]

      Only the S5720-EI, S5720-HI, S5730-HI, S5731-H, S5731S-H, S5731-S, S5731S-S, S6720-HI, S5732-H, S6730-H, S6730S-H, S6730-S, S6730S-S, S6720-EI, and S6720S-EI support sub-interfaces.

    3. (Optional) On an Ethernet interface, run undo portswitch

      The interface is switched to Layer 3 mode.

      By default, an Ethernet interface works in Layer 2 mode.

      Only the S5720-EI, S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720-HI, S6720S-EI, S6730-H, S6730S-H, S6730-S, and S6730S-S support switching between Layer 2 and Layer 3 modes.

    4. Configure an IP address for the interface.

      1. Configure a primary IP address for the interface.
        ip address ip-address { mask | mask-length }
      2. (Optional) Configure a secondary IP address for the interface.
        ip address ip-address { mask | mask-length } sub

      The device can select a global address pool based on the primary and secondary IP addresses of an interface only in scenarios where the DHCP server and DHCP clients are on the same network segment.

      When clients connected to the interface configured with an IP address request IP addresses:

      • If the DHCP client and server are located in the same network segment, the DHCP server selects the address pool based on the primary and secondary interface IP addresses. It preferentially allocates IP addresses from the address pool for the primary IP address. If IP addresses in this address pool are used up or this address pool is not configured, the DHCP server allocates IP addresses from the address pool for the secondary IP address.
      • If the DHCP server and client are located in different network segments (that is, a DHCP relay agent is used), the DHCP server selects the address pool in the same network segment as the IP address specified in the giaddr field of the received DHCP Request message.

    5. Enable the interface to use the global address pool for providing the DHCP server function. (This step is optional if a DHCP relay agent is used.)

      dhcp select global

      By default, an interface does not use the global address pool to provide the DHCP server function.

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