1. The switch starts the dhcp service
[Huawei] dhcp enable
2. Configure the user gateway and enable the dhcp global mode under the interface
[Huawei] interface vlanif 10
[Huawei-Vlanif10] ip address 192.168.10.254 255.255.255.0
[Huawei-Vlanif10] dhcp select global Select the global dhcp type
[Huawei-Vlanif10] quit
3. Create an address pool
[Huawei] ip pool vlan10
[Huawei-ip-pool-pool1] network 192.168.10.0 mask 255.255.255.0
[Huawei-ip-pool-pool1] dns-list 114.114.114.114 Placement DNS
[Huawei-ip-pool-pool1] gateway-list 192.168.10.254 Configure the gateway
[Huawei-ip-pool-pool1] lease day 3 Set the lease
4. Reserve 192.168.10.1-192.168.10.10 and not issue
[Huawei-ip-pool-pool1] excluded-ip-address 192.168.10.1 192.168.10.10
[Huawei] dis ip pool name vlan10 used Check the IP usage of the address pool
<Huawei>reset ip pool name pool1 192.168.2.1 Reclaims the IP address 192.168.2.1
5. Configure DHCP to obtain the address through the interface under the vlanif interface
<Huawei> system-view Enter the system view
[Huawei] interface Vlanif 20
[Huawei-Vlanif20] ip address 192.168.20.1 255.255.255.0 vlan address
[Huawei-Vlanif20]dhcp select interface select interface-based dhcp type
[Huawei-Vlanif20]dhcp server excluded-ip-address 192.168.20.200 192.168.20.253 Excluded
left address
[Huawei-Vlanif20] dhcp server static-bind ip-address 192.168.20.100 mac-address 5489-98b7-7378 Bind MAC static IP
[Huawei-Vlanif20]dhcp server lease day 8 hour 0 minute 0 Set the lease
[Huawei-Vlanif20] dhcp server dns-list 114.114.114.114 placement DNS
6. Huawei switch configuration dhcp relay
Topology
SW2 configuration:
vlan batch 10 20 50
dhcp enable
dhcp server group yukong
dhcp-server 10.3.50.50 0
interface Vlanif10
ip address 10.0.0.1 255.255.255.0
dhcp select relay
dhcp relay server-ip 10.3.50.50
interface Vlanif20
ip address 20.0.0.1 255.255.255.0
dhcp select relay
dhcp relay server-ip 10.3.50.50
interface Vlanif50
ip address 10.3.50.1 255.255.255.0
interface Vlanif10
ip address 10.0.0.1 255.255.255.0
dhcp select relay
dhcp relay server-ip 10.3.50.50
interface Vlanif20
ip address 20.0.0.1 255.255.255.0
dhcp select relay
dhcp relay server-ip 10.3.50.50
interface Vlanif50
ip address 10.3.50.1 255.255.255.0
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20
interface GigabitEthernet0/0/3
port link-type access
port default vlan 50
AR1 configuration:
dhcp enable
ip pool vlan10
gateway-list 10.0.0.1
network 10.0.0.0 mask 255.255.255.0
dns-list 114.114.114.114
ip pool vlan20
gateway-list 20.0.0.1
network 20.0.0.0 mask 255.255.255.0
dns-list 114.114.114.114
interface GigabitEthernet0/0/0
ip address 10.3.50.50 255.255.255.0
dhcp select global
ip route-static 10.0.0.0 255.255.255.0 10.3.50.1
ip route-static 20.0.0.0 255.255.255.0 10.3.50.1