Hello everyone,
Today I will share with you how to configure 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.

Networking Requirements
As shown in Figure 7-4, 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.

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
Enable the DHCP service.
<HUAWEI> system-view
[HUAWEI] sysname Switch
[Switch] dhcp enable
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
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
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
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
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
Series | Product Model | Software Version |
---|---|---|
S2700 | S2720EI | V200R009C00, V200R010C00, V200R011C10, V200R012C00, V200R013C00 |
S2750EI | V200R005C00SPC300, V200R006C00, V200R007C00, V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00 | |
S3700 | S3700SI, S3700EI | V100R006C05 |
S3700HI | V200R001C00 | |
S5700 | S5700LI | V200R005C00SPC300, V200R006C00, V200R007C00, V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00 |
S5700S-LI | V200R005C00SPC300, V200R006C00, V200R007C00, V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00 | |
S5700SI | V200R001C00, V200R002C00, V200R003C00, V200R005C00 | |
S5700EI | V200R001(C00&C01), V200R002C00, V200R003C00, V200R005(C00&C01&C02&C03) | |
S5700HI | V200R001(C00&C01), V200R002C00, V200R003C00, V200R005(C00SPC500&C01&C02) | |
S5710-X-LI | V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00 | |
S5710EI | V200R001C00, V200R002C00, V200R003C00, V200R005(C00&C02) | |
S5710HI | V200R003C00, V200R005(C00&C02&C03) | |
S5720LI, S5720S-LI | V200R010C00, V200R011C00, V200R011C10, V200R012(C00&C20), V200R013C00 | |
S5720SI, S5720S-SI | V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00 | |
S5720I-SI | V200R012C00, V200R013C00 | |
S5720EI | V200R007C00, V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00 | |
S5720HI | V200R006C00, V200R007(C00&C10), V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00 | |
S5730HI | V200R012C00, V200R013C00 | |
S5730SI | V200R011C10, V200R012C00, V200R013C00 | |
S5730S-EI | V200R011C10, V200R012C00, V200R013C00 | |
S6700 | S6700EI | V200R001(C00&C01), V200R002C00, V200R003C00, V200R005(C00&C01&C02) |
S6720LI, S6720S-LI | V200R011C00, V200R011C10, V200R012C00, V200R013C00 | |
S6720SI, S6720S-SI | V200R011C00, V200R011C10, V200R012C00, V200R013C00 | |
S6720EI | V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00 | |
S6720S-EI | V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00 | |
S6720HI | V200R012C00, V200R013C00 | |
S7700 | S7703, S7706, S7712 | V200R001(C00&C01), V200R002C00, V200R003C00, V200R005C00, V200R006C00, V200R007C00, V200R008C00, V200R009C00, V200R010C00, V200R011C10, V200R012C00, V200R013C00 |
S7703 PoE | V200R013C00 | |
S7706 PoE | V200R013C00 | |
S9700 | S9703, S9706, S9712 | V200R001(C00&C01), V200R002C00, V200R003C00, V200R005C00, V200R006C00, V200R007(C00&C10), V200R008C00, V200R009C00, V200R010C00, V200R011C10, V200R012C00, V200R013C00 |
See more please click
That is all I want to share with you! Thank you!