< Home

Example for Configuring a Device as the DHCP Server (Based on the Global Address Pool)

DHCP Server Overview

Users require that all terminals on a network dynamically obtain network parameters such as IP addresses, DNS server IP address, routing information, and gateway information. The users do not need to manually configure the network parameters including terminal IP addresses. In addition, some mobile terminals (for example, mobile phones, tablets, and laptops) should support plug-and-play, without modification on network parameters each time. To meet these requirements, the DHCP server function can be configured on an aggregation-layer user gateway or a core-layer device to assign network parameters such as IP addresses to terminals.

The Dynamic Host Configuration Protocol (DHCP) uses the client/server mode to dynamically configure and uniformly manage network parameters for users. The DHCP server uses an address pool to assign network parameters such as IP addresses to the users. The global address pool or an interface address pool can be used.

The configuration of an interface address pool is simple, which can be used only when the users and DHCP server belong to the same network segment and the server can only assign network parameters to the users on the interface. It is applicable to small networks with a limited number of devices and controllable configuration and maintenance workload. After the DHCP server function based on the interface address pool is configured on the user gateway, the hosts and mobile terminals on the interface can automatically obtain network parameters such as IP addresses, without manual configuration and modification.

Compared with an interface address pool, the global address pool can be applied to large networks. The DHCP server function based on the global address pool should be configured on a core device, or an exclusive DHCP server be used to assign network parameters such as IP addresses. The user gateway only needs to be enabled with the DHCP relay function. For details, see Example for Configuring the Device as a DHCP Relay (on the Same Network).

Configuration Notes

For applicable product models and versions, see Applicable Product Models and Versions.

For details about software mappings, visit Hardware Query Tool and search for the desired product model.

Networking Requirements

As shown in Figure 1, an enterprise has two offices, to save network resources, the switch functions as the DHCP server to allocate IP addresses to hosts in the two offices. Hosts in office 1 are on the network segment 10.1.1.0/25 and are added to VLAN 10, the lease of IP addresses for these hosts is ten days; hosts in office 2 are on the network segment 10.1.1.128/25 and are added to VLAN 11, the lease of IP addresses for these hosts is two days.

Figure 1 Networking diagram for configuring a device as the DHCP server

Configuration Roadmap

The configuration roadmap is as follows:

Configure the switch as the DHCP server to dynamically allocate IP addresses and the DNS server address to hosts in the two offices. PCs on the network segment 10.1.1.0/25 are for employees in office 1 and obtain IP addresses with a lease of ten days. PCs on the network segment 10.1.1.128/25 are for employees in office 2 and obtain IP addresses with a lease of two days.

Procedure

  1. Enable the DHCP service.

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

  2. Add interfaces to a VLAN.

    # Add GE0/0/1 to VLAN 10.

    [Switch] vlan batch 10 to 11
    [Switch] interface gigabitethernet 0/0/1
    [Switch-GigabitEthernet0/0/1] port link-type hybrid
    [Switch-GigabitEthernet0/0/1] port hybrid pvid vlan 10
    [Switch-GigabitEthernet0/0/1] port hybrid untagged vlan 10
    [Switch-GigabitEthernet0/0/1] quit

    # Add GE0/0/2 to VLAN 11.

    [Switch] interface gigabitethernet 0/0/2
    [Switch-GigabitEthernet0/0/2] port link-type hybrid
    [Switch-GigabitEthernet0/0/2] port hybrid pvid vlan 11
    [Switch-GigabitEthernet0/0/2] port hybrid untagged vlan 11
    [Switch-GigabitEthernet0/0/2] quit

  3. Configure IP addresses for VLANIF interfaces.

    # Configure an IP address for VLANIF 10.

    [Switch] interface vlanif 10
    [Switch-Vlanif10] ip address 10.1.1.1 25
    [Switch-Vlanif10] quit

    # Configure an IP address for VLANIF 11.

    [Switch] interface vlanif 11
    [Switch-Vlanif11] ip address 10.1.1.129 25
    [Switch-Vlanif11] quit

  4. Configure global address pools.

    # Configure the IP addresses and relevant network parameters of the global address pool pool1.

    [Switch] ip pool pool1
    [Switch-ip-pool-pool1] network 10.1.1.0 mask 255.255.255.128
    [Switch-ip-pool-pool1] dns-list 10.1.2.3
    [Switch-ip-pool-pool1] gateway-list 10.1.1.1
    [Switch-ip-pool-pool1] lease day 10
    [Switch-ip-pool-pool1] quit

    # Configure the IP addresses and relevant network parameters of the global address pool pool2.

    [Switch] ip pool pool2
    [Switch-ip-pool-pool1] network 10.1.1.128 mask 255.255.255.128
    [Switch-ip-pool-pool1] dns-list 10.1.2.3
    [Switch-ip-pool-pool1] gateway-list 10.1.1.129
    [Switch-ip-pool-pool1] lease day 2
    [Switch-ip-pool-pool1] quit

  5. Enable the DHCP server.

    # Enable the DHCP server on VLANIF 10.

    [Switch] interface vlanif 10
    [Switch-Vlanif10] dhcp select global
    [Switch-Vlanif10] quit

    # Enable the DHCP server on VLANIF 11.

    [Switch] interface vlanif 11
    [Switch-Vlanif11] dhcp select global
    [Switch-Vlanif11] quit

  6. Verify the configuration.

    # Run the display ip pool name pool1 command on the switch to view IP address allocation in the global address pool pool1. The Used field displays the number of allocated IP addresses. The following uses the command output in V200R011C10 as an example.

    [Switch] display ip pool name pool1
      Pool-name        : pool1
      Pool-No          : 0
      Lease            : 10 Days 0 Hours 0 Minutes
      Domain-name      : -
      DNS-server0      : 10.1.2.3        
      NBNS-server0     : -               
      Netbios-type     : -               
      Position         : Local           
      Status           : Unlocked
      Gateway-0        : 10.1.1.1        
      Network          : 10.1.1.0
      Mask             : 255.255.255.128
      VPN instance     : --
      Logging          : Disable
      Conflicted address recycle interval: -
      Address Statistic: Total       :125       Used        :2          
                         Idle        :123       Expired     :0          
                         Conflict    :0         Disabled    :0      
    
     -------------------------------------------------------------------------------
      Network section 
             Start           End       Total    Used Idle(Expired) Conflict Disabled
     -------------------------------------------------------------------------------
            10.1.1.1      10.1.1.126     125       2        123(0)       0     0
     -------------------------------------------------------------------------------

    # Run the display ip pool name pool2 command on the switch to view IP address allocation in the global address pool pool2. The Used field displays the number of allocated IP addresses. The following uses the command output in V200R011C10 as an example.

    [Switch] display ip pool name pool2
      Pool-name        : pool2
      Pool-No          : 1
      Lease            : 2 Days 0 Hours 0 Minutes
      Domain-name      : -
      DNS-server0      : 10.1.2.3        
      NBNS-server0     : -               
      Netbios-type     : -               
      Position         : Local           
      Status           : Unlocked
      Gateway-0        : 10.1.1.129      
      Network          : 10.1.1.128
      Mask             : 255.255.255.128
      VPN instance     : --
      Logging          : Disable
      Conflicted address recycle interval: -
      Address Statistic: Total       :125       Used        :2          
                         Idle        :123       Expired     :0          
                         Conflict    :0         Disabled    :0      
    
     -------------------------------------------------------------------------------
      Network section 
             Start           End       Total    Used Idle(Expired) Conflict Disabled
     -------------------------------------------------------------------------------
          10.1.1.129      10.1.1.254     125       2        123(0)       0     0
     -------------------------------------------------------------------------------

Configuration Files

Switch configuration file

#
sysname Switch
#
vlan batch 10 to 11
#
dhcp enable
#
ip pool pool1
 gateway-list 10.1.1.1
 network 10.1.1.0 mask 255.255.255.128
 lease day 10 hour 0 minute 0
 dns-list 10.1.2.3
#
ip pool pool2
 gateway-list 10.1.1.129
 network 10.1.1.128 mask 255.255.255.128
 lease day 2 hour 0 minute 0
 dns-list 10.1.2.3
#
interface Vlanif10
 ip address 10.1.1.1 255.255.255.128
 dhcp select global
#
interface Vlanif11
 ip address 10.1.1.129 255.255.255.128
 dhcp select global
#
interface GigabitEthernet0/0/1
 port hybrid pvid vlan 10
 port hybrid untagged vlan 10
#
interface GigabitEthernet0/0/2
 port hybrid pvid vlan 11
 port hybrid untagged vlan 11
#
return

Applicable Product Models and Versions

Table 1 Applicable product models and versions

Series

Product Model

Software Version

S2700

S2720-EI

V200R009C00, V200R010C00, V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10

S2750-EI

V200R005C00SPC300, V200R006C00, V200R007C00, V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00

S3700

S3700-SI, S3700-EI

V100R006C05

S3700-HI

V200R001C00

S5700

S5700-LI

V200R005C00SPC300, V200R006C00, V200R007C00, V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00

S5700S-LI

V200R005C00SPC300, V200R006C00, V200R007C00, V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00

S5700-SI

V200R001C00, V200R002C00, V200R003C00, V200R005C00

S5700-EI

V200R001(C00&C01), V200R002C00, V200R003C00, V200R005(C00&C01&C02&C03)

S5700-HI

V200R001(C00&C01), V200R002C00, V200R003C00, V200R005(C00SPC500&C01&C02)

S5710-X-LI

V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00

S5710-EI

V200R001C00, V200R002C00, V200R003C00, V200R005(C00&C02)

S5710-HI

V200R003C00, V200R005(C00&C02&C03)

S5720-LI, S5720S-LI

V200R010C00, V200R011C00, V200R011C10, V200R012(C00&C20), V200R013C00, V200R019C00, V200R019C10

S5720-SI, S5720S-SI

V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10

S5720I-SI

V200R012C00, V200R013C00, V200R019C00, V200R019C10

S5720-EI

V200R007C00, V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10

S5720-HI

V200R006C00, V200R007(C00&C10), V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10

S5730-HI

V200R012C00, V200R013C00, V200R019C00, V200R019C10

S5730-SI

V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10

S5730S-EI

V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10

S5731-H

V200R013C02, V200R019C00, V200R019C10

S5731-S, S5731S-S

V200R019C00, V200R019C10

S5731S-H

V200R019C00, V200R019C10

S5732-H

V200R019C00, V200R019C10

S5735-L, S5735S-L

V200R019C00, V200R019C10

S5735S-L-M

V200R019C00, V200R019C10

S5735-S, S5735S-S

V200R019C00, V200R019C10

S5700

S5735-S-I

V200R019C10

S6700

S6700-EI

V200R001(C00&C01), V200R002C00, V200R003C00, V200R005(C00&C01&C02)

S6720-LI, S6720S-LI

V200R011C00, V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10

S6720-SI, S6720S-SI

V200R011C00, V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10

S6720-EI

V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10

S6720S-EI

V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10

S6720-HI

V200R012C00, V200R013C00, V200R019C00, V200R019C10

S6730-H

V200R013C02, V200R019C00, V200R019C10

S6730-S, S6730S-S

V200R019C00, V200R019C10

S6730S-H

V200R019C10

S7700

S7703, S7706, S7712

V200R001(C00&C01), V200R002C00, V200R003C00, V200R005C00, V200R006C00, V200R007C00, V200R008C00, V200R009C00, V200R010C00, V200R011C10, V200R012C00, V200R013C00, V200R013C02, V200R019C00, V200R019C10

S7703 PoE

V200R013C00, V200R019C00, V200R019C10

S7706 PoE

V200R013C00, V200R019C00, V200R019C10

S9700

S9703, S9706, S9712

V200R001(C00&C01), V200R002C00, V200R003C00, V200R005C00, V200R006C00, V200R007(C00&C10), V200R008C00, V200R009C00, V200R010C00, V200R011C10, V200R012C00, V200R013C00

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