要求
物理上

逻辑上

第一步:
R1与R5间使用PPP的PAP认证,R5为主认证方;
R5:
[r5-LoopBack0]ip address 5.5.5.5 24
[r5]aaa
[r5-aaa]local-user ikta privilege level 15 password cipher 123123
[r5-aaa]local-user ikta service-type ppp 
[r5-Serial3/0/0]ip address 15.1.1.2 24
[r5-Serial3/0/0]ppp authentication-mode pap    R5向R1提起PAP认证
[r5-Serial3/0/0]shutdown
[r5-Serial3/0/0]undo shutdown
 
R1:
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 24
[r1-Serial4/0/0]ip address 15.1.1.1 24
R1必须做一个提交PAP认证的账号
[r1-Serial4/0/0]ppp pap local-user ikta password cipher 123123
 
测试:
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Qz1FTE9o-1642083833305)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220113210705468.png)]](https://file.cfanz.cn/uploads/png/2022/01/13/14/17d508X5M0.png)
R2与R5间使用PPP的chap认证,R5为主认证方;
R5:
[r5]aaa
[r5-aaa]local-user iktb privilege level 15 password cipher 123123
[r5-aaa]local-user iktb service-type ppp
[r5]int Serial 3/0/1
[r5-Serial3/0/1]ip address 25.1.1.2 24
[r5-Serial3/0/1]ppp authentication-mode chap 
[r5-Serial3/0/1]shutdown 
[r5-Serial3/0/1]undo shutdown              目的是让对方必须进行一次认证不然无法上网
 
R2:
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip address 192.168.2.1 24
[r2-Serial4/0/0]ip address 25.1.1.1 24
[r2-Serial4/0/0]ppp chap user iktb 
[r2-Serial4/0/0]ppp chap password cipher 123123
 
R3与R5间使用HDLC封装
R5:
[r5-Serial4/0/0]ip address 35.1.1.2 24
[r5-Serial4/0/0]link-protocol hdlc 
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
 
R3:必须也改封装不然ping不通
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip address 192.168.3.1 24
[r3-Serial4/0/0]ip address 35.1.1.1 24
[r3-Serial4/0/0]link-protocol hdlc 
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
 
R4 R5是以太网封装
R5:
[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]ip address 45.1.1.2 24
 
R4:
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip address 192.168.4.1 24
[r4-GigabitEthernet0/0/2]ip address 45.1.1.1 24
 
测试:[r5]ping 15.1.1.1 ping 25.1.1.1 ping 35.1.1.1 ping 45.1.1.1
第二步:
缺省路由:
R1:
[r1]ip route-static 0.0.0.0 0 15.1.1.2
 
R2:
[r2]ip route-static 0.0.0.0 0 25.1.1.2
 
R3:
[r3]ip route-static 0.0.0.0 0 35.1.1.2
 
R4:
[r4]ip route-static 0.0.0.0 0 45.1.1.2
 
R1/2/3构建一个MGRE环境,R1为中心站点;
R1:
[r1-Tunnel0/0/0]ip address 10.1.1.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r1-Tunnel0/0/0]source 15.1.1.1                   源IP
[r1-Tunnel0/0/0]nhrp entry multicast dynamic  目标IP不确定所以让R2R3过来找我注册,R1是主方
[r1-Tunnel0/0/0]nhrp network-id 100				工作半径
 
R2:
[r2-Tunnel0/0/0]ip address 10.1.1.2 24
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r2-Tunnel0/0/0]source Serial 4/0/0 
[r2-Tunnel0/0/0]nhrp entry 10.1.1.1 15.1.1.1 register
[r2-Tunnel0/0/0]nhrp network-id 100
 
R3:
[r3-Tunnel0/0/0]ip address 10.1.1.3 24	
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp 	
[r3-Tunnel0/0/0]source Serial 4/0/0
[r3-Tunnel0/0/0]nhrp entry 10.1.1.1 15.1.1.1 register 
[r3-Tunnel0/0/0]nhrp network-id 100
 
测试:
R1 ping10.1.1.2 ping10.1.1.3
R1/4间为点到点GRE
R1:
[r1]int Tunnel 0/0/1
[r1-Tunnel0/0/1]ip address 10.1.2.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre 
[r1-Tunnel0/0/1]source 15.1.1.1
[r1-Tunnel0/0/1]destination 45.1.1.1
 
R4:
[r4]int Tunnel 0/0/1
[r4-Tunnel0/0/1]ip address 10.1.2.2 24
[r4-Tunnel0/0/1]tunnel-protocol gre 
[r4-Tunnel0/0/1]source 45.1.1.1
[r4-Tunnel0/0/1]destination 15.1.1.1
 
测试:R1ping 10.1.2.2
整个私有网络基于RIP全网可达
R1:
[r1]rip 1 
[r1-rip-1]ver 2
[r1-rip-1]network 192.168.1.0                   RIP是主类宣告
[r1-rip-1]network 10.0.0.0
 
R2:
[r2]rip 1
[r2-rip-1]ver 2
[r2-rip-1]network 192.168.2.0
[r2-rip-1]network 10.0.0.0
 
R3:
[r3]rip 1
[r3-rip-1]ver 2
[r3-rip-1]network 192.168.3.0
[r3-rip-1]network 10.0.0.0
 
R4:
[r4]rip 1
[r4-rip-1]ver 2
[r4-rip-1]network 192.168.4.0
[r4-rip-1]network 10.0.0.0
 
查看R1的rip路由:齐了

查看R4的rip路由:齐了

但是发现R2没有学到R3的路由,R3没有学到R2的路由
 

去R1上开启水平分割
[r1-Tunnel0/0/0]undo rip split-horizon
 
测试:R2 ping R3

也可以拿PC2去pingPC3
ping 192.168.3.2
nat
R1的外部接口,s4/0/0口
[r1]acl 2000
[r1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r1-acl-basic-2000]q
[r1]int Serial 4/0/0
[r1-Serial4/0/0]nat outbound 2000
 

同理R2R3R4 做nat后也都可以上网了!
实验完成!










