Example for Configuring a DHCP Client

Created: Feb 28, 2019 17:17:19Latest reply: Mar 10, 2019 18:15:00 237 1 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 
imgDownload?uuid=34bdcfd8de09430484be522

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.

Procedure

  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 192.168.1.1 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 192.168.1.0 mask 24[Switch_2-ip-pool-pool1] gateway-list 192.168.1.126[Switch_2-ip-pool-pool1] dns-list 192.168.1.2[Switch_2-ip-pool-pool1] excluded-ip-address 192.168.1.2[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
    #
    return
    [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                    : 192.168.1.162                                                                                      
     Subnet mask                   : 255.255.255.0                                                                                      
     Gateway ip address            : 192.168.1.126                                                                                      
     DHCP server                   : 192.168.1.1                                                                                        
     Lease obtained at             : 2017-06-23 14:52                                                                                
     Lease expires at              : 2017-06-23 14:52                                                                                
     Lease renews at               : 2017-06-23 14:52                                                                                
     Lease rebinds at              : 2017-06-23 14:52                                                                                
     DNS                           : 192.168.1.2

    # 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      : 192.168.1.2     
      NBNS-server0     : -               
      Netbios-type     : -               
      Position         : Local           
      Status           : Unlocked
      Gateway-0        : 192.168.1.126   
      Network          : 192.168.1.0
      Mask             : 255.255.255.0
      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
     -------------------------------------------------------------------------------
         192.168.1.1   192.168.1.254     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
    #
    return
  • Switch_2 configuration file

    #
    sysname Switch_2
    #
    vlan batch 10
    #
    dhcp enable
    #
    ip pool pool1
     gateway-list 192.168.1.126
     network 192.168.1.0 mask 255.255.255.0
     excluded-ip-address 192.168.1.2
     dns-list 192.168.1.2
    #
    interface Vlanif10
     ip address 192.168.1.1 255.255.255.0
     dhcp select global
    #
    interface GigabitEthernet0/0/1
     port link-type trunk
     port trunk allow-pass vlan 10
    #
    return

See more please click 

https://support.huawei.com/enterprise/en/doc/EDOC1000069520/9aadccc0/comprehensive-configuration-examples


  • x
  • convention:

MHME     Created Mar 10, 2019 18:15:00 Helpful(0) Helpful(0)

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.
  • x
  • convention:

Reply

Reply
You need to log in to reply 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 " Privacy."
If the attachment button is not available, update the Adobe Flash Player to the latest version!
Fast reply Scroll to top