1、DHCP服务器配置思路(基于接口地址池):适用场景:配置简单,适用于DHCP服务器、DHCP客户端处于同一网段。
1、使能DHCP功能 | <HUAWEI> system-view
[HUAWEI] dhcp enable |
2、进入接口创建接口地址池,并使能接口地址池的DHCP功能 | [HUAWEI] interface gigabitethernet 0/0/1 [HUAWEI-GigabitEthernet0/0/1] undo portswitch[HUAWEI-GigabitEthernet0/0/1] ip address 10.1.1.1 255.255.255.0 [HUAWEI-GigabitEthernet0/0/1] dhcp select interface |
3、配置DNS服务器地址、网关地址等相关参数,排除不参与分配的IP地址,为部分主机分配固定IP | [HUAWEI-GigabitEthernet0/0/1] dhcp server dns-list 10.1.1.2 [HUAWEI-GigabitEthernet0/0/1] dhcp server lease day 2[HUAWEI-GigabitEthernet0/0/1] dhcp server excluded-ip-address 10.1.1.20 10.1.1.30 [HUAWEI-GigabitEthernet0/0/1] dhcp server static-bind ip-address 10.1.1.4 |
2、DHCP服务器配置思路(基于全局地址池):适用场景:一般适用于DHCP服务器、DHCP客户端处于不同网段。
注:服务器与中继之间还应当配置路由,使其能够正常通信。
1、使能DHCP功能 | <SwitchB> system-view
[SwitchB] dhcp enable |
2、创建全局地址池,配置DNS服务器地址、网关地址、租期等参数,排除不参与分配的IP地址,为部分主机分配固定IP地址 | [SwitchB] ip pool pool1
[SwitchB-ip-pool-pool1] network 10.1.1.0 mask 255.255.255.0 [SwitchB-ip-pool-pool1] dns-list 10.1.1.2 [SwitchB-ip-pool-pool1] gateway-list 10.1.1.1 [SwitchB-ip-pool-pool1] lease day 2 [SwitchB-ip-pool-pool1] excluded-ip-address 10.1.1.20 10.1.1.30 [SwitchB-ip-pool-pool1] static-bind ip-address 10.1.1.4 mac-address dcd2-fc96-e4c0 [SwitchB-ip-pool-pool1] quit |
3、进入接口,使能接口采用全局地址池的DHCP服务器功能 | [SwitchB] interface gigabitethernet 0/0/1 [SwitchB-GigabitEthernet0/0/1] undo portswitch [SwitchB-GigabitEthernet0/0/1] ip address 10.1.2.1 255.255.255.0 [SwitchB-GigabitEthernet0/0/1] |
3、DHCP中继配置思路
注:中继与服务器之间还应当配置路由,使其能够正常通信。
1、使能DHCP功能 | <SwitchA> system-view
[SwitchA] dhcp enable |
2、进入接口GE0/0/1,配置接口IP并使能中继功能,配置DHCP服务器地址 | [SwitchA] interface gigabitethernet 0/0/1 [SwitchA-GigabitEthernet0/0/1] undo portswitch [SwitchA-GigabitEthernet0/0/1] ip address 10.1.1.1 255.255.255.0 [SwitchA-GigabitEthernet0/0/1] dhcp select relay [SwitchA-GigabitEthernet0/0/1] dhcp relay server-ip 10.1.2.1 [SwitchA-GigabitEthernet0/0/1] |