拓扑图如下:
先进行各路由器的IP设置和路由设置,将各主机的IP地址均改为DHCP自动获取以便于验证DHCP服务器
R1配置
en
conf t
no ip domain-lookup
hostname R1
int s0/0/0
ip addr 192.168.12.1 255.255.255.0
clock rate 64000
no shut
int f0/0
ip addr 192.168.1.1 255.255.255.0
no shut
end
conf t
router rip
version 2
no auto-summary
network 192.168.1.0
network 192.168.12.0
R2配置
en
conf t
no ip domain-lookup
hostname R2
int s0/0/0
ip addr 192.168.12.2 255.255.255.0
no shut
int s0/0/1
ip addr 192.168.23.1 255.255.255.0
clock rate 64000
no shut
int f0/0
ip addr 192.168.2.1 255.255.255.0
no shut
end
conf t
router rip
version 2
no auto-summary
network 192.168.2.0
network 192.168.12.0
network 192.168.23.0
R3配置
en
conf t
no ip domain-lookup
hostname R3
int s0/0/1
ip addr 192.168.23.2 255.255.255.0
no shut
int f0/0
ip addr 192.168.3.1 255.255.255.0
no shut
end
conf t
router rip
version 2
no auto-summary
network 192.168.3.0
network 192.168.23.0
在路由配置结束之后接下来我们要进行封装验证配置,封装是配置在接口上的,我们应进入对应接口进行配置
在R1和R2之间 我们配置PAP验证 ,在R2和R3之间我们配置CHAP验证
PAP验证如下:
PAP验证是单向的,故我们需要在R1和R2上互相为对方配置验证
R1配置
en
conf t
int s0/0/0
encapsulation ppp
ppp authentication pap
ppp pap sent-username R1 password 123
ppp pap sent-username R2 password 321
end
conf t
username R2 password 321
R2配置
en
conf t
int s0/0/0
encapsulation ppp
ppp authentication pap
ppp pap sent-username R1 password 123
ppp pap sent-username R2 password 321
end
conf t
username R1 password 123
PAP的验证完成了,接下来我们要配置R2与R3的CHAP验证
CHAP验证本身即是双向的
CHAP验证配置密码时,两端密码必须相同
R2配置
en
conf t
int s0/0/1
encapsulation ppp
ppp authentication chap
end
conf t
username R3 password 123
R3配置
en
conf t
int s0/0/1
encapsulation ppp
ppp authentication chap
end
conf t
username R2 password 123
这样PPP验证就配置结束了,接下来要配置的是DHCP服务器
我们要将R3配置为DHCP服务器,同时还要为R2和R1的F0/0端口配置DHCP-helper端口
R3配置
en
conf t
ip dhcp pool 1
network 192.168.3.0 255.255.255.0
network 192.168.2.0 255.255.255.0
network 192.168.1.0 255.255.255.0
ip dhcp excluded-address 192.168.1.1
ip dhcp excluded-address 192.168.2.1
ip dhcp excluded-address 192.168.3.1
R2配置
en
conf t
int f0/0
ip helper-address 192.168.23.2
R1配置
en
conf t
int f0/0
ip helper-address 192.168.23.2
这样就配置结束啦,可以打开主机获取IP地址了噢