发布时间: 2017-10-13 18:10:38
在大型企业网络中,会有大量的主机或设备需要获取IP地址等网络参数。如果采用手工配置,工作量大且不好管理,如果有用户擅自修改网络参数,还有可能会造成IP地址冲突等问题。使用动态主机配置协议DHCP(DynamicHost
Configuration Protocol)来分配IP地址等网络参数,可以减少管理员的工作量,避免用户手工配置网络参数时造成的地址冲突。
在华为的DHCP的方式有分为三种,全局地址池,接口地址池,中继模式。
以下是DHCP全局地址池下发方式:
[router]dhcp enable
[router]ip pool globalpool //创建一个地址池名为globalpool的地址池
Info: It's successful to create an IP address pool.
[router-ip-pool-router]network 10.1.1.0 mask 24 //下发的网络号跟掩码
[router-ip-pool-router]gateway-list 10.1.1.1 //网关
[router-ip-pool-router]dns-list 8.8.8.8 //配置DNS
[router-ip-pool-router]excluded-ip-address 10.1.1.100 10.1.1.254 //不下发的地址
[router-ip-pool-router]quit
[router]int g0/0/0
[router-GigabitEthernet0/0/0]dhcp select global //使用全局地址池
接口地址池的配置方法:
[router]dhcp enable
[router]int g0/0/0
[router-GigabitEthernet0/0/0]ip add 10.1.1.1 24
[router-GigabitEthernet0/0/0]dhcp select interface //以接口地址作为网关,发放接口的网段的地址。
[router-GigabitEthernet0/0/0]dhcp server excluded-ip-address 10.1.1.100 10.1.1.254 //不发放10.1.1.100~10.1.1.254的地址
[router-GigabitEthernet0/0/0]dhcp server dns-list 10.1.1.1 //配置DNS服务器为10.1.1.1
DHCP中继:
[r2]dhcp enable
[r2]ip pool pool1
Info: It's successful to create an IP address pool.
[r2-ip-pool-pool1]network 10.1.1.0 mask 24
[r2-ip-pool-pool1]gateway-list 10.1.1.1
[r2-ip-pool-pool1]dns-list 8.8.8.8
[r2-ip-pool-pool1]excluded-ip-address 10.1.1.100 10.1.1.254
[r2]ip pool pool2
Info: It's successful to create an IP address pool.
[r2-ip-pool-pool2]network 172.16.10.0 mask 24
[r2-ip-pool-pool2]gateway-list 172.16.10.1
[r2-ip-pool-pool2]dns-list 114.114.114.114
[r2-ip-pool-pool2]excluded-ip-address 172.16.10.3 172.16.10.254
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[r2-GigabitEthernet0/0/0]dhcp select global
[r2]ospf
[r2-ospf-1]a 0
[r2-ospf-1-area-0.0.0.0]net 192.168.1.0 0.0.0.255
中继配置:
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 192.168.1.2 24
[Huawei-GigabitEthernet0/0/1]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 10.1.1.1 24
[Huawei-GigabitEthernet0/0/1]dhcp select relay //使用中继模式
[Huawei-GigabitEthernet0/0/1]dhcp relay server-ip 192.168.1.1 //指向DHCP服务器
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 172.16.10.1 24
[Huawei-GigabitEthernet0/0/2]dhcp select relay
[Huawei-GigabitEthernet0/0/2]dhcp relay server-ip 192.168.1.1
[Huawei-ospf-1]a 0
[Huawei-ospf-1-area-0.0.0.0]net 10.1.1.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]net 192.168.1.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]net 172.16.10.0 0.0.0.255
做DHCP中继需要保证网络可达,网关以自己的源代替主机像DHCP服务器请求地址,所以此处使用OSPF使其网络可达。
上一篇: {思科CCNA-RS}STP生成树