网络工程实验三:DHCP的配置
#实验仅供参考,勿直接粘贴复制,用以学习交流#
#对于软件的使用,请移步到实验一观看#
1、实验目的:
(1)掌握DHCP工作原理。
(2)配置路由器作为DHCP服务器。
(3) 配置DHCP中继实现跨网段地址自动配置。
2、实验图像绘制与相应基础配置
绘制本次实验的图像如下所示:
配置路由器AR1,AR2的各接口的地址,如下所示:
AR1:
<Huawei>sys
[Huawei]sysname AR1
[AR1]interface GigabitEthernet 0/0/0
[AR1-GigabitEthernet0/0/0]ip address 192.168.0.1 24
[AR1-GigabitEthernet0/0/0]quit
[AR1]interface GigabitEthernet 0/0/1
[AR1-GigabitEthernet0/0/1]ip address 192.168.1.1 24
[AR1]interface GigabitEthernet 1/0/0
[AR1-GigabitEthernet0/0/1]ip address 172.16.0.1 24
[AR1-GigabitEthernet0/0/1]quit
[AR1]display ip interface brief //用于显示结果自己检查端口IP是否正确
AR2:
<Huawei>sys
[Huawei]sysname AR2
[AR2]interface GigabitEthernet 0/0/0
[AR2-GigabitEthernet0/0/0]ip address 172.16.0.2 24
[AR2-GigabitEthernet0/0/0]quit
[AR2]interface GigabitEthernet 0/0/1
[AR2-GigabitEthernet0/0/1]ip address 192.168.3.1 24
[AR2-GigabitEthernet0/0/1]quit
[AR2]display ip interface brief //用于显示结果自己检查端口IP是否正确
3、配置静态路由,使得PC1和PC2能够通信
配置后的AR1,AR2静态路由器表和代码如下所示:
AR1:
<AR1>sys
[AR1]ip route-static 192.168.3.0 24 172.16.0.2
[AR1]display ip routing-table protocol static //显示静态路由器表,用于自查
AR2:
<AR2>sys
[AR2]ip route-static 192.168.0.0 24 172.16.0.1
[AR2]ip route-static 192.168.1.0 24 172.16.0.1
[AR2]display ip routing-table protocol static //显示静态路由器表,用于自查
4、DHCP配置:
对于office1进行部分地址池配置,分配给PC1的地址
[AR1]dhcp enable
[AR1]ip pool office1
[AR1-ip-pool-office1]network 192.168.0.0 mask 24
[AR1-ip-pool-office1]gateway-list 192.168.0.1
[AR1-ip-pool-office1]dns-list 8.8.8.8
[AR1-ip-pool-office1]lease day 0 hour 8 minute 0
[AR1-ip-pool-office1]excluded-ip-address 192.168.0.50 192.168.0.60
[AR1-ip-pool-office1]display this
[AR1-ip-pool-office1]quit
[AR1]interface GigabitEthernet 0/0/0
[AR1-GigabitEthernet0/0/0]dhcp select global
对于office2进行部分接口地址池配置,分配给PC2的地址
[AR1]interface GigabitEthernet 0/0/1
[AR1-GigabitEthernet0/0/1]dhcp select interface
[AR1-GigabitEthernet0/0/1]dhcp server dns-list 8.8.8.8
[AR1-GigabitEthernet0/0/1]dhcp server lease day 1 hour 0 minute 0
[AR1-GigabitEthernet0/0/1]dhcp server excluded-ip-address 192.168.1.50 192.168.1.60
[AR1-GigabitEthernet0/0/1]quit
对于office3部分使用中继与地址池配置,分配给PC3的地址
[AR1]ip pool office3
[AR1-ip-pool-office3]network 192.168.3.0 mask 24
[AR1-ip-pool-office3]gateway-list 192.168.3.1
[AR1-ip-pool-office3]dns-list 8.8.8.8
[AR1-ip-pool-office3]quit
[AR1]interface GigabitEthernet 1/0/0
[AR1-GigabitEthernet1/0/0]dhcp select global
[AR1-GigabitEthernet1/0/0]quit
[AR2]dhcp enable
[AR2]interface GigabitEthernet 0/0/1
[AR2-GigabitEthernet0/0/1]dhcp select relay
[AR2-GigabitEthernet0/0/1]dhcp relay server-ip 172.16.0.1
[AR2-GigabitEthernet0/0/1]quit
#本实验使用三种配置方式,分别为部分地址池配置、使用接口地址池配置和使用中继与地址池配置,仅供参考,实际应用时应考虑所使用的环境#