實驗要求
1.R5為ISP,隻能進行IP位址配置;其所有接口配置為公有ip位址
2.R1與R5之間使用PPP的PAP認證,R5為主認證方;R2與R5間使用PPP的chap認證,R5為主認證方;R3與R5之間使用HDLC封裝
3.R1/2/3建構一個MGRE環境,R1為中心站點;R1/R4間為點到點GRE
4.整個私有網絡基于RIP全網可達
5.所有路由器基于環回私有位址為源IP時,可以正常通路R5環回

R1與R5之間使用PPP的PAP認證,R5為主認證方
R5為主認證方,先在R5發起PAP認證, 華為裝置接口封裝預設為PPP ,配置PAP認證不需要修改接口封裝
[ISP]aaa
[ISP-aaa]local-user xiaowang password cipher 123456
建立賬戶
Info: Add a new user.
[ISP-aaa]local-user xiaowang service-type ppp
定義賬戶用途
[ISP]int s3/0/0
進入與R1 相連的接口
[ISP-Serial3/0/0]ip add 15.1.1.2 24
[ISP-Serial3/0/0]ppp authentication-mode pap
對R1 發起PAP認證
[R1]int s4/0/0
進入R1 與R5 相連的接口
[R1-Serial4/0/0]ip add 15.1.1.1 24
[R1-Serial4/0/0]q [R1]dis ip interface brief
檢視接口狀态
Serial4/0/0 15.1.1.1/24 up up
Serial4/0/1 unassigned down down
發現與R5相連的接口還處于UP狀态,回到R5 與R4相連的接口上重新開機接口
重新開機後檢視接口
Serial4/0/0 15.1.1.1/24 up down
Serial4/0/1 unassigned down down
該接口實體上處于UP狀态 但接口協定處于down狀态,說明R5上的PAP認證生效了,接下來在R1上完成PAP認證
[R1-Serial4/0/0]ppp pap local-user xiaowang password cipher 123456
再檢視接口狀态為雙UP 認證完成
[R1]ping 15.1.1.2
PING 15.1.1.2: 56 data bytes, press CTRL_C to break
Reply from 15.1.1.2: bytes=56 Sequence=1 ttl=255 time=30 ms
Reply from 15.1.1.2: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 15.1.1.2: bytes=56 Sequence=3 ttl=255 time=10 ms
Reply from 15.1.1.2: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 15.1.1.2: bytes=56 Sequence=5 ttl=255 time=20 ms
R2與R5間使用PPP的chap認證,R5為主認證方
[ISP-Serial3/0/1]ppp authentication-mode chap
啟用chap 認證
[ISP-Serial3/0/1]ip add 25.1.1.2 24
[ISP-Serial3/0/1]shutdown
重新開機接口
[ISP-Serial3/0/1]undo shutdown
.
[R2-Serial4/0/0]ip add 25.1.1.1 24
[R2-Serial4/0/0]ping 25.1.1.2
PING 25.1.1.2: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
[R2-Serial4/0/0]ppp chap user xiaowang
賬戶
[R2-Serial4/0/0]ppp chap password cipher 123456
密碼
完成R2 R5 之間的chap 認證, 測試一下
[R2-Serial4/0/0]ping 25.1.1.2PING 25.1.1.2: 56 data bytes, press CTRL_C to breakReply from 25.1.1.2: bytes=56 Sequence=1 ttl=255 time=30 msReply from 25.1.1.2: bytes=56 Sequence=2 ttl=255 time=30 msReply from 25.1.1.2: bytes=56 Sequence=3 ttl=255 time=40 msReply from 25.1.1.2: bytes=56 Sequence=4 ttl=255 time=20 msReply from 25.1.1.2: bytes=56 Sequence=5 ttl=255 time=20 ms
R3與R5之間使用HDLC封裝
華為預設為ppp 封裝
[ISP]int s4/0/0
[ISP-Serial4/0/0]ip add 35.1.1.2 24
[ISP-Serial4/0/0]link-protocol hdlc
将該接口設定為HDLC封裝
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
确認
檢視接口狀态
Serial4/0/0 35.1.1.2/24 up down
接口協定為down狀态,因為對端封裝方式為預設的PPP封裝,接下來修改R3 上與R5相接的接口封裝
[R3]int s4/0/0` `[R3-Serial4/0/0]ip add 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
R1/2/3建構一個MGRE環境,R1為中心站點
公網位址配置
[ISP]int l0
[ISP-LoopBack0]ip add 5.5.5.5 24
[ISP-LoopBack0]int g0/0/0
[ISP-GigabitEthernet0/0/0]ip add 45.1.1.2 24
[R4-GigabitEthernet0/0/0]ip add 45.1.1.1 24
私網位址配置
[R1-GigabitEthernet0/0/2]ip add 192.168.1.1 24
[R2-GigabitEthernet0/0/2]ip add 192.168.2.1 24
[R3-GigabitEthernet0/0/2]ip add 192.168.3.1 24
[R4-GigabitEthernet0/0/2]ip add 192.168.4.1 24
首先使公網可以聯通(可以ping通R5的環回)
用靜态寫一條指向R5的預設路由
[R1]ip route-static 0.0.0.0 0 15.1.1.2
[R2]ip route-static 0.0.0.0 0 25.1.1.2
[R3]ip route-static 0.0.0.0 0 35.1.1.2
[R4]ip route-static 0.0.0.0 0 45.1.1.2
測試:pingR5的環回
在R1~3建立MGRE,R1/4建立GRE
注意兩個GRE要建立在兩個不同的網段上
先建立R 1 R4 GRE
[R1]int Tunnel 0/0/0
進入隧道接口
[R1-Tunnel0/0/0]ip add 10.1.1.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre
定義隧道接口協定為GRE
因為實際流量需要從公網傳輸,是以要為私網位址的封包中加上攜帶公網源和目的位址的IP報頭
[R1-Tunnel0/0/0]source 15.1.1.1
源
[R1-Tunnel0/0/0]description 45.1.1.1
目的
[R4-Tunnel0/0/0]ip add 10.1.1.2 24
[R4-Tunnel0/0/0]tunnel-protocol gre
[R4-Tunnel0/0/0]source 45.1.1.1
[R4-Tunnel0/0/0]description 15.1.1.1
建立R1~3 之間的MGRE
[R1]int Tunnel 0/0/1
[R1-Tunnel0/0/1]ip add 10.1.2.1 24
[R1-Tunnel0/0/1]tunnel-protocol gre p2mp
GRE的點到多點模式
[R1-Tunnel0/0/1]source 15.1.1.1
[R1-Tunnel0/0/1]nhrp entry multicast dynamic
使R1成為中心站點
[R2-Tunnel0/0/0]ip add 10.1.2.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.2.1 15.1.1.1 register
到
[R2-Tunnel0/0/0]nhrp network-id 12
[R3-Tunnel0/0/0]ip add 10.1.2.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.2.1 15.1.1.1 register
[R3-Tunnel0/0/0]nhrp network-id 12
使整個私有網絡基于RIP全網可達
[R1]rip 1
[R1-rip-1]version 2
[R1-rip-1]un summary
[R1-rip-1]network 192.168.1.0
[R1-rip-1]network 10.0.0.0
[R2]rip 1
[R2-rip-1]version 2
[R2-rip-1]un summary
[R2-rip-1]network 192.168.2.0
[R2-rip-1]network 10.0.0.0
[R3]rip 1
[R3-rip-1]version 2
[R3-rip-1]un summary
[R3-rip-1]network 192.168.3.0
[R3-rip-1]network 10.0.0.0
[R4]rip 1
[R4-rip-1]version 2
[R4-rip-1]un summary
[R4-rip-1]network 10.0.0.0
[R4-rip-1]network 192.168.4.0
此時檢視RIP的路由表發現R2上沒有R3 的路由 R3 上沒有R2的路由,原因是RIP的水準分割阻隔了R2 R3 的路由共享,
[R1-Tunnel0/0/1]undo rip split-horizon
關閉這個接口的水準分割
所有路由器基于環回私有位址為源IP時,可以正常通路R5環回
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R1]int s4/0/0
[R1-Serial4/0/0]nat outbound 2000
[R2-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[R2-acl-basic-2000]int s4/0/0
[R2-Serial4/0/0]nat outbound 2000
[R3-acl-basic-2000]rule permit source 192.168.3.0 0.0.0.255
[R3-acl-basic-2000]int s4/0/0
[R3-Serial4/0/0]nat outbound 2000
[R4-acl-basic-2000]rule permit source 192.168.4.0 0.0.0.255
[R4-acl-basic-2000]int g0/0/0
[R4-GigabitEthernet0/0/0]nat outbound 2000