Got it

Example for Configuring a DHCP Client

Latest reply: Mar 10, 2019 10:15:00 618 1 0 0 0

DHCP Client Overview

A device can function as a DHCP client and dynamically obtain network parameters including the IP address from a DHCP server. This mechanism lowers manual costs, reduces errors, and facilitates unified management.

Configuration Notes

This example applies to:
  • Chassis switches: V200R005 and later versions
  • Fixed switches: V100R006 and later versions
imgDownload?uuid=b4a928cb16cb4fb0916d4ea NOTE:
For details about software mappings, visit Hardware Query Tool and search for the desired product model.

Networking Requirements

As shown in Figure 7-8, Switch_1 functions as the DHCP client to dynamically obtain information including the IP address, DNS server address, and gateway address from the DHCP server (Switch_2).

Figure 7-8  Networking diagram for configuring a device as the DHCP server 

Configuration Roadmap

  1. Configure Switch_1 as the DHCP client to dynamically obtain the IP address from a DHCP server.
  2. Configure Switch_2 as the DHCP server to dynamically allocate network parameters including IP addresses to Switch_1.


  1. Configure Switch_1 as the DHCP client.

    # Create VLAN 10, and add GE0/0/1 to VLAN 10.

    <HUAWEI> system-view[HUAWEI] sysname Switch_1[Switch_1] vlan 10[Switch_1-vlan10] quit[Switch_1] interface gigabitethernet 0/0/1[Switch_1-GigabitEthernet0/0/1] port link-type trunk[Switch_1-GigabitEthernet0/0/1] port trunk allow-pass vlan 10[Switch_1-GigabitEthernet0/0/1] quit

    # Enable the DHCP client function on VLANIF 10.

    [Switch_1] interface vlanif 10[Switch_1-Vlanif10] ip address dhcp-alloc[Switch_1-Vlanif10] quit

  2. Create a global address pool on Switch_2 and set corresponding attributes.
    1. Enable the DHCP service.

      <HUAWEI> system-view[HUAWEI] sysname Switch_2[Switch_2] dhcp enable

    2. Create VLAN 10, and add GE0/0/1 to VLAN 10.

      [Switch_2] vlan 10[Switch_2-vlan10] quit[Switch_2] interface gigabitethernet 0/0/1[Switch_2-GigabitEthernet0/0/1] port link-type trunk[Switch_2-GigabitEthernet0/0/1] port trunk allow-pass vlan 10[Switch_2-GigabitEthernet0/0/1] quit

    3. Configure VLANIF 10 to work in global address pool mode.

      [Switch_2] interface vlanif 10[Switch_2-Vlanif10] ip address 24[Switch_2-Vlanif10] dhcp select global[Switch_2-Vlanif10] quit

    4. Create an address pool and set corresponding attributes.

      [Switch_2] ip pool pool1[Switch_2-ip-pool-pool1] network mask 24[Switch_2-ip-pool-pool1] gateway-list[Switch_2-ip-pool-pool1] dns-list[Switch_2-ip-pool-pool1] excluded-ip-address[Switch_2-ip-pool-pool1] quit

  3. Verify the configuration.

    # Run the display this command on VLANIF 10 of Switch_1 to view the DHCP client configuration.

    [Switch_1] interface vlanif 10[Switch_1-Vlanif10] display this#
    interface Vlanif10
     ip address dhcp-alloc
    [Switch_1-Vlanif10] quit

    # After VLANIF 10 obtains an IP address, run the display dhcp client command on Switch_1 to view the status of the DHCP client on VLANIF 10. The following uses the command output in V200R011C10 as an example.

    [Switch_1] display dhcp clientDHCP client lease information on interface Vlanif10 :                                                                               
     Current machine state         : Bound                                                                                              
     Internet address assigned via : DHCP                                                                                               
     Physical address              : 0487-ea01-0506                                                                                     
     IP address                    :                                                                                      
     Subnet mask                   :                                                                                      
     Gateway ip address            :                                                                                      
     DHCP server                   :                                                                                        
     Lease obtained at             : 2017-06-23 06:52                                                                                
     Lease expires at              : 2017-06-23 06:52                                                                                
     Lease renews at               : 2017-06-23 06:52                                                                                
     Lease rebinds at              : 2017-06-23 06:52                                                                                
     DNS                           :

    # On Switch_2, run the display ip pool name pool1 command to view IP address allocation in the address pool. The Used field displays the number of used IP addresses in the address pool. The following uses the command output in V200R011C10 as an example.

    [Switch_2] display ip pool name pool1
      Pool-name        : pool1
      Pool-No          : 0
      Lease            : 1 Days 0 Hours 0 Minutes
      Domain-name      : -
      DNS-server0      :     
      NBNS-server0     : -               
      Netbios-type     : -               
      Position         : Local           
      Status           : Unlocked
      Gateway-0        :   
      Network          :
      Mask             :
      VPN instance     : --
      Logging          : Disable
      Conflicted address recycle interval: -
      Address Statistic: Total       :253       Used        :1          
                         Idle        :251       Expired     :0          
                         Conflict    :0         Disabled    :1      
      Network section 
             Start           End       Total    Used Idle(Expired) Conflict Disabled
     -------------------------------------------------------------------------------     253       1        251(0)       0     1

Configuration Files

  • Switch_1 configuration file

    sysname Switch_1
    vlan batch 10
    interface Vlanif10
     ip address dhcp-alloc
    interface GigabitEthernet0/0/1
     port link-type trunk
     port trunk allow-pass vlan 10
  • Switch_2 configuration file

    sysname Switch_2
    vlan batch 10
    dhcp enable
    ip pool pool1
     network mask
    interface Vlanif10
     ip address
     dhcp select global
    interface GigabitEthernet0/0/1
     port link-type trunk
     port trunk allow-pass vlan 10

See more please click

  • x
  • convention:

Created Mar 10, 2019 10:15:00

DHCP offers the following benefits:
Reduced client configurations and costs

Because DHCP is easy to configure, it minimizes operational costs associated with device configurations, eases deployment by nontechnical users, and reduces device configuration and maintenance costs at remote sites.

Centralized management

Because the DHCP server maintains configurations for several subnets, an administrator only needs to update a single, central server when configuration parameters change.
View more
  • x
  • convention:


You need to log in to comment to the post Login | Register

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits


Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Please bind your phone number to obtain invitation bonus.