DHCP中继 为什么要用DHCP中继,因为DHCP请求包是广播请求,但是广播是无法跨越路由器的,这个时候就需要DHCP中继来解决这个问题。拓扑:
配置如下:
R1:
ip dhcp excluded-address 192.168.2.1 //去除网关的地址不让它存在地址池里进行分配
ip dhcp excluded-address 172.16.1.1
ip dhcp pool 1
network 192.168.2.0 255.255.255.0
default-router 192.168.2.1
dns-server 8.8.8.8
ip dhcp pool 2
network 172.16.1.0 255.255.255.0
default-router 172.16.1.1
dns-server 8.8.8.8
interface FastEthernet0/0
ip address 192.168.2.1 255.255.255.0
interface Serial0/0
ip address 192.168.1.1 255.255.255.0
router rip
version 2
network 192.168.1.0
network 192.168.2.0
no auto-summary
R2:
interface FastEthernet0/0
ip address 172.16.1.1 255.255.255.0
ip helper-address 192.168.1.1 //配置的帮助地址(DHCP服务器的地址)就是用来DHCP请求的
interface Serial0/0
ip address 192.168.1.2 255.255.255.0
clock rate 64000
router rip
version 2
network 172.16.0.0
network 192.168.1.0
no auto-summary
结果:PC1
PC1顺利请求到了ip地址。实验顺利完成。