配置基于全局地址池的DHCP
原理概述:
? ? ? 基于接口地址池的DHCP服务器,连接这个接口网段的用户都从该接口地址池中获取IP地址等配置信息,由于地址池绑定在特定的接口上,可以限制用户的使用条件,因为在保障了安全性的同时也存在一定局限性。当用户从不同接口接入DHCP服务器且需要从同一个地址池里获取IP地址池时,就需要配置基于全局地址池的DHCP。
? ? ? 配置基于全局地址池的DHCP服务器,从所有接口上连接的用户都可以选择该地址池中的地址,也就是说全局地址池是一个公共地址池。在DHCP服务器上创建地址池并配置相关属性(包括地址范围、地址租期、不参与自动分配的IP地址等),再配置接口工作在全局地址池模式,路由器支持工作在全局地址池模式的接口有三层接口及其子接口,三层Ethernet接口及其子网接口、三层Eth-Trunk接口及其子接口和VLANIF接口。
实验目的:
掌握DHCP Server配置方法
掌握基于全局地址池的DHCP Server配置方法
掌握配置DHCP租期/网关地址/不参与自动分配地址方法
掌握配置和检测DHCP客户端的方法
我们接下来开始实验:
?
接口配置如下:
#
interface GigabitEthernet0/0/0
?ip address 192.168.1.254 255.255.255.0 //配置接口地址
#
interface GigabitEthernet0/0/1
?ip address 192.168.2.254 255.255.255.0
#
interface NULL0
#
user-interface con 0
?authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
[Huawei]dh
[Huawei]dhcne
[Huawei]dh
[Huawei]dhcp en
[Huawei]dhcp enable ?//开启DHCP服务
Info: The operation may take a few seconds. Please wait for a moment.done.
[Huawei]dis th?//查看
[V200R003C00]
#
?snmp-agent local-engineid 800007DB03000000000000
?snmp-agent
#
?clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
?drop illegal-mac alarm
#
?set cpu-usage threshold 80 restore 75
#
dhcp enable
#
return
[Huawei]ip pool w1???//创建地址池为W1
Info: It's successful to create an IP address pool.?//创建成功
[Huawei-ip-pool-w1]net
[Huawei-ip-pool-w1]network 192.168.1.0
[Huawei-ip-pool-w1]le
[Huawei-ip-pool-w1]lease d
[Huawei-ip-pool-w1]lease day 2??//地址租期为2天
[Huawei-ip-pool-w1]g
[Huawei-ip-pool-w1]gateway-list 192.168.1.254?//配置DHCP客户端的出口网关
[Huawei-ip-pool-w1]ex
[Huawei-ip-pool-w1]excluded-ip-address 192.168.1.250 192.168.1.253?
//配置地址池中192。168.1.250到192.168.1.253这些地址不参与自动分配;
[Huawei-ip-pool-w1]dh
[Huawei-ip-pool-w1]dn
[Huawei-ip-pool-w1]dns-list 8.8.8.8??//配置DNS服务器地址
[Huawei-ip-pool-w1]dis th??//查看当前配置信息
[V200R003C00]
#
ip pool w1
?gateway-list 192.168.1.254
?network 192.168.1.0 mask 255.255.255.0
?excluded-ip-address 192.168.1.250 192.168.1.253
?lease day 2 hour 0 minute 0
?dns-list 8.8.8.8
#
Return
开启接口的DHCP功能;
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]dh
[Huawei-GigabitEthernet0/0/0]dhcp se
[Huawei-GigabitEthernet0/0/0]dhcp select g
[Huawei-GigabitEthernet0/0/0]dhcp select global //开启接口DHCP服务模式
[Huawei-GigabitEthernet0/0/0]dis th
[V200R003C00]
#
interface GigabitEthernet0/0/0
?ip address 192.168.1.254 255.255.255.0
?dhcp select global
配置另一个:同理,命令如下
[Huawei]ip pol
[Huawei]ip policy-based-rout
[Huawei]ip policy-based-route
[Huawei]ip pool
[Huawei]ip pool w2
Info: It's successful to create an IP address pool.
[Huawei-ip-pool-w2]net
[Huawei-ip-pool-w2]netbios-type
[Huawei-ip-pool-w2]network 192.168.2.0
[Huawei-ip-pool-w2]le
[Huawei-ip-pool-w2]lease d
[Huawei-ip-pool-w2]lease day 2
[Huawei-ip-pool-w2]g
[Huawei-ip-pool-w2]gateway-list 192.168.2.254
[Huawei-ip-pool-w2]dh
[Huawei-ip-pool-w2]dn
[Huawei-ip-pool-w2]dns-list 8.8.8.8
[Huawei-ip-pool-w2]dis th
[V200R003C00]
#
ip pool w2
?gateway-list 192.168.2.254
?network 192.168.2.0 mask 255.255.255.0
?lease day 2 hour 0 minute 0
?dns-list 8.8.8.8
#
return
接口开启DHCP服务:
[Huawei-ip-pool-w2]int g0/0/1
[Huawei-GigabitEthernet0/0/1]dh
[Huawei-GigabitEthernet0/0/1]dhcp se
[Huawei-GigabitEthernet0/0/1]dhcp select g
[Huawei-GigabitEthernet0/0/1]dhcp select global
[Huawei-GigabitEthernet0/0/1]dis th
[V200R003C00]
#
interface GigabitEthernet0/0/1
?ip address 192.168.2.254 255.255.255.0
?dhcp select global
#
return
都配置完毕后,我们查看地址池:
?
开启PC的DHCP服务:
打开命令行,输入ipconfig可以观察到,该PC已获取到了DHCP服务;
?
我们在路由上ping一下该PC,如下所示,网络连通性良好;
?
PC2如图所示,DHCP如下所示;
??
网络连通性良好,实验结束;
备注:如有错误,请谅解!
此文章为本人学习笔记,仅供参考!如有重复!!!请联系本人!
|