< Home

Example for Configuring a DHCP Server to Allocate Different Network Parameters from the Global Address Pool to Dynamic and Static Clients

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, the IP phone and PCs are devices in an office area. To uniformly manage devices and reduce manual configuration costs, the administrator needs to configure hosts to dynamically obtain IP addresses through DHCP. PCs are fixed terminals in the duty room. They need to always be online and use domain names to access network devices. In addition to obtaining an IP address dynamically, the PCs require an unlimited IP address lease and need to obtain information about the DNS server. The IP phone uses a fixed IP address 10.1.1.4/24 and its MAC address is dcd2-fc96-e4c0. In addition to obtaining an IP address, the IP phone needs to dynamically obtain the startup configuration file. The startup configuration file configuration.ini is stored on the FTP server. The routes between the FTP server and IP phone must be reachable. The gateway address of the PCs and IP phone is 10.1.1.1/24.

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

Configuration Roadmap

  1. Create a DHCP Option template on SwitchA. In the DHCP Option template view, configure the startup configuration file for the static client IP phone, and specify the IP address of the FTP server for the IP phone.
  2. Create a global address pool on SwitchA. In the global address pool view, configure the IP address lease and information about the DNS server for the dynamic client PCs. Bind an IP address and the DHCP Option template to the MAC address of the static client IP phone. In this way, the DHCP server can allocate different network parameters to dynamic and static clients.

Procedure

  1. Create a VLAN and configure an IP address for the VLANIF interface.

    <HUAWEI> system-view
    [HUAWEI] sysname SwitchA
    [SwitchA] vlan 10
    [SwitchA-vlan10] quit
    [SwitchA] interface gigabitethernet 0/0/1
    [SwitchA-GigabitEthernet0/0/1] port link-type hybrid
    [SwitchA-GigabitEthernet0/0/1] port hybrid pvid vlan 10
    [SwitchA-GigabitEthernet0/0/1] port hybrid untagged vlan 10
    [SwitchA-GigabitEthernet0/0/1] quit
    [SwitchA] interface vlanif 10
    [SwitchA-Vlanif10] ip address 10.1.1.1 255.255.255.0
    [SwitchA-Vlanif10] quit

  2. Enable the DHCP service.

    [SwitchA] dhcp enable

  3. Create a DHCP Option template. In the DHCP Option template view, configure the startup configuration file for the static client IP phone, and specify the IP address of the file server for the IP phone.

    [SwitchA] dhcp option template template1
    [SwitchA-dhcp-option-template-template1] gateway-list 10.1.1.1
    [SwitchA-dhcp-option-template-template1] bootfile configuration.ini 
    [SwitchA-dhcp-option-template-template1] next-server 10.1.1.3
    [SwitchA-dhcp-option-template-template1] quit

  4. Create an IP address pool. In the IP address pool view, configure the gateway address, IP address lease, and IP address of the DNS server for the PCs. Allocate a fixed IP address to the IP phone and configure the startup configuration file.

    [SwitchA] ip pool pool1
    [SwitchA-ip-pool-pool1] network 10.1.1.0 mask 255.255.255.0
    [SwitchA-ip-pool-pool1] dns-list 10.1.1.2
    [SwitchA-ip-pool-pool1] gateway-list 10.1.1.1
    [SwitchA-ip-pool-pool1] excluded-ip-address 10.1.1.2 10.1.1.3
    [SwitchA-ip-pool-pool1] lease unlimited
    [SwitchA-ip-pool-pool1] static-bind ip-address 10.1.1.4 mac-address dcd2-fc96-e4c0 option-template template1 
    [SwitchA-ip-pool-pool1] quit

  5. Enable the DHCP server function on the VLANIF 10 interface.

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

  6. Enable the device to save DHCP data to the storage device. If a fault occurs on the device, you can run the dhcp server database recover command after the system restarts to restore DHCP data from files on the storage device.

    [SwitchA] dhcp server database enable

  7. Verify the configuration.

    # Run the display ip pool name pool1 command on SwitchA to view the address pool configuration. The following uses the command output in V200R011C10 as an example.

    [SwitchA] display ip pool name pool1
      Pool-name        : pool1
      Pool-No          : 0
      Lease            : unlimited
      Domain-name      : -
      DNS-server0      : 10.1.1.2        
      NBNS-server0     : -               
      Netbios-type     : -               
      Position         : Local           
      Status           : Unlocked
      Gateway-0        : 10.1.1.1        
      Network          : 10.1.1.0
      Mask             : 255.255.255.0
      VPN instance     : --
      Logging          : Disable
      Conflicted address recycle interval: -
      Address Statistic: Total       :253       Used        :1          
                         Idle        :250       Expired     :0          
                         Conflict    :0         Disabled    :2      
    
     -------------------------------------------------------------------------------
      Network section 
             Start           End       Total    Used Idle(Expired) Conflict Disabled
     -------------------------------------------------------------------------------
            10.1.1.1      10.1.1.254     253       4        249(0)       0     2
     -------------------------------------------------------------------------------

    # Run the display dhcp option template name template1 command on SwitchA to view the DHCP Option template configuration.

    [SwitchA] display dhcp option template name template1
     -----------------------------------------------------------------------------  
      Template-Name  : template1                                                    
      Template-No    : 0                                                            
      Next-server    : 10.1.1.3                                                     
      Domain-name    : -                                                            
      DNS-server0    : -                                                            
      NBNS-server0   : -                                                            
      Netbios-type   : -                                                            
      Gateway-0      : 10.1.1.1                                                     
      Bootfile       : configuration.ini                                            

Configuration Files

Configuration file of SwitchA

#
sysname SwitchA
#
vlan batch 10
#
dhcp enable
#
dhcp server database enable
#
dhcp option template template1
 gateway-list 10.1.1.1
 next-server 10.1.1.3
 bootfile configuration.ini  
#
ip pool pool1
 gateway-list 10.1.1.1
 network 10.1.1.0 mask 255.255.255.0
 excluded-ip-address 10.1.1.2 10.1.1.3
 static-bind ip-address 10.1.1.4 mac-address dcd2-fc96-e4c0 option-template template1
 lease unlimited
 dns-list 10.1.1.2
#
interface Vlanif10
 ip address 10.1.1.1 255.255.255.0
 dhcp select global
#
interface GigabitEthernet0/0/1
 port link-type hybrid
 port hybrid pvid vlan 10
 port hybrid untagged vlan 10
#
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 >