实验要求
考察知识:MGRE基本实验配置、PPP的PAP认证、CHAP认证、MGRE、GRE网络搭建
配置内容
基础配置
R1接口ip
<R1>sys
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.158.1.1 24
[R1-GigabitEthernet0/0/0]interface Serial 4/0/0
[R1-Serial4/0/0]ip address 15.0.0.1 8
R2接口ip
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ip address 192.158.2.1 24
[R2-GigabitEthernet0/0/0]interface Serial 4/0/0
[R2-Serial4/0/0]ip address 25.0.0.1 8
R3接口ip
[R3]interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]ip address 192.168.3.1 24
[R3-GigabitEthernet0/0/0]interface Serial 4/0/0
[R3-Serial4/0/0]ip address 35.0.0.1 8
R4接口ip
[R4]interface GigabitEthernet 0/0/0
[R4-GigabitEthernet0/0/0]ip address 192.168.4.1 24
[R4-GigabitEthernet0/0/0]interface GigabitEthernet 0/0/1
[R4-GigabitEthernet0/0/1]ip address 45.0.0.1 8
R5接口ip
[R5]interface Serial 3/0/0
[R5-Serial3/0/0]ip address 15.0.0.2 8[R5-Serial3/0/0]interface Serial 3/0/1
[R5-Serial3/0/1]ip address 25.0.0.2 8[R5-Serial3/0/1]interface Serial 4/0/0
[R5-Serial4/0/0]ip address 35.0.0.2 8[R5-Serial4/0/0]interface GigabitEthernet 0/0/0
[R5-GigabitEthernet0/0/0]ip address 45.0.0.2 8
R1和R5间使用PPP的PAP认证
认证方--R5
[ISP]aaa #进入aaa空间
[ISP-aaa]local-user huawei1 password cipher 123456 #创建账号、密码
[ISP-aaa]local-user huawei1 service-type ppp #定义账号服务对象
[ISP]interface Serial 3/0/0 #进入端口
[ISP-Serial3/0/0]link-protocol ppp #修改链路层协议
[ISP-Serial3/0/0]ppp authentication-mode pap #定义PPP的认证模式
被认证方--R1
[R1]interface Serial 4/0/0 #进入接口
[R1-Serial4/0/0]ppp pap local-user huawei1 password cipher 123456
#设置账号与密码用于PPP连接
R2与R5之间使用PPP的chap认证
认证方--R5
[ISP]aaa #进入aaa空间
[ISP-aaa]local-user huawei2 password cipher 1234567 #创建账号以及密码
[ISP-aaa]local-user huawei2 service-type ppp #定义账号的服务对象
[ISP]interface Serial 3/0/1 #进入端口
[ISP-Serial3/0/1]link-protocol ppp #修改链路层协议为ppp
[ISP-Serial3/0/1]ppp authentication-mode chap #端口选择认证协议
被认证方--R2
[R2]interface Serial 4/0/0 #进入端口
[R2-Serial4/0/0]ppp chap user huwei2 #添加账号
[R2-Serial4/0/0]ppp chap password cipher 1234567 #添加账号对应密码
R3与R5之间使用HDLC封装
R3
[R3]interface Serial 4/0/0 #进入端口
[R3-Serial4/0/0]link-protocol hdlc #修改端口默认二层协议为HDLC
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]
:y
R5
[ISP]interface Serial 4/0/0 #进入端口
[ISP-Serial4/0/0]link-protocol hdlc #修改端口协议
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]
:y
...
配缺省路由
R1
[R1]ip route-static 0.0.0.0 0 15.0.0.2
R2
[R2]ip route-static 0.0.0.0 0 25.0.0.2
R3
[R3]ip route-static 0.0.0.0 0 35.0.0.2
R4
[R4]ip route-static 0.0.0.0 0 45.0.0.2
R1/R2/R3构建一个MGRE环境,R1为中心站点
R1
[R1]interface Tunnel 0/0/0 #创建隧道
[R1-Tunnel0/0/0]ip address 192.168.5.1 24 #添加隧道IP
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp #定义封装协议
[R1-Tunnel0/0/0]source 15.0.0.1 # 定义封装内容源IP地址为自身物理接口IP地址(公网地址)
Jul 7 2024 21:55:42-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R1-Tunnel0/0/0]nhrp network-id 1 #使用NHRP协议获取目的IP
R2
[R2]interface Tunnel 0/0/0 #创建隧道
[R2-Tunnel0/0/0]ip address 192.168.5.2 24 #隧道端口配置IP
[R2-Tunnel0/0/0]tunnel-protocol gre p2mp #定义封装协议
[R2-Tunnel0/0/0]source 25.0.0.1 #定义源
Jul 7 2024 22:06:49-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R2-Tunnel0/0/0]nhrp network-id 1 #使用NHRP协议获取目标IP
[R2-Tunnel0/0/0]nhrp entry 192.168.5.1 15.0.0.1 register #明确中心
R3
[R3]interface Tunnel 0/0/0 #创建隧道
[R3-Tunnel0/0/0]ip address 192.168.5.3 24 #隧道端口配IP
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp #定义封装协议
[R3-Tunnel0/0/0]source 35.0.0.1 #定义源
Jul 7 2024 22:13:47-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R3-Tunnel0/0/0]nhrp network-id 1 #使用NHRP协议获取目标IP
[R3-Tunnel0/0/0]nhrp entry 192.168.5.1 15.0.0.1 register #明确中心
R1、R4间为点到点的GRE
R1
[R1]interface Tunnel 0/0/1 #创建隧道
[R1-Tunnel0/0/1]ip address 192.168.6.1 24 #隧道端口配置IP
[R1-Tunnel0/0/1]tunnel-protocol gre #定义封装协议
[R1-Tunnel0/0/1]source 15.0.0.1 #定义源
[R1-Tunnel0/0/1]destination 45.0.0.1 #定义目标
Jul 7 2024 22:19:51-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/1 has entered the UP state.
[R1]ip route-static 192.168.4.0 24 192.168.6.2 #配置路由表
R4
[R4]interface Tunnel 0/0/0 #创建隧道
[R4-Tunnel0/0/0]ip address 19.168.6.2 24 #隧道端口配置地址
[R4-Tunnel0/0/0]tunnel-protocol gre #定义封装协议
[R4-Tunnel0/0/0]source 45.0.0.1 #定义源
[R4-Tunnel0/0/0]destination 15.0.0.1 #定义目标
Jul 7 2024 22:24:53-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R4]ip route-static 192.168.1.0 24 192.168.6.1 #配置路由表
配置rip
R1
[R1]rip #开启RIP
[R1-rip-1]version 2 #RIP设置版本2
[R1-rip-1]network 192.168.1.0 #宣告网络
[R1-rip-1]network 192.168.5.0
[R1-rip-1]network 192.168.6.0
R2
[R2]rip
[R2-rip-1]version 2
[R2-rip-1]network 192.168.2.0
[R2-rip-1]network 192.168.5.0
R3
[R3]rip
[R3-rip-1]version 2
[R3-rip-1]network 192.168.3.0
[R3-rip-1]network 192.168.5.0
R4
[R4]rip
[R4-rip-1]version 2
[R4-rip-1]network 192.168.4.0
[R4-rip-1]network 192.168.6.0
测试
#R1 ping R2的192.168.2.0网段的192.168.2.2
[R1]ping 192.168.2.2
PING 192.168.2.2: 56 data bytes, press CTRL_C to break
Request time out
Reply from 192.168.2.2: bytes=56 Sequence=2 ttl=127 time=30 ms
Reply from 192.168.2.2: bytes=56 Sequence=3 ttl=127 time=30 ms
Reply from 192.168.2.2: bytes=56 Sequence=4 ttl=127 time=40 ms
Reply from 192.168.2.2: bytes=56 Sequence=5 ttl=127 time=40 ms
--- 192.168.2.2 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 20/30/40 ms
#R1 ping R3的192.168.3.0网段的192.168.3.2[R1]ping 192.168.3.2
PING 192.168.3.2: 56 data bytes, press CTRL_C to break
Request time out
Reply from 192.168.3.2: bytes=56 Sequence=2 ttl=127 time=20 ms
Reply from 192.168.3.2: bytes=56 Sequence=3 ttl=127 time=30 ms
Reply from 192.168.3.2: bytes=56 Sequence=4 ttl=127 time=20 ms
Reply from 192.168.3.2: bytes=56 Sequence=5 ttl=127 time=30 ms--- 192.168.3.2 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 20/25/30 ms
#R1 ping R4的192.168.4.0网段的192.168.4.2
[R1]ping 192.168.4.2
PING 192.168.4.2: 56 data bytes, press CTRL_C to break
Request time out
Reply from 192.168.4.2: bytes=56 Sequence=2 ttl=127 time=30 ms
Reply from 192.168.4.2: bytes=56 Sequence=3 ttl=127 time=40 ms
Reply from 192.168.4.2: bytes=56 Sequence=4 ttl=127 time=30 ms
Reply from 192.168.4.2: bytes=56 Sequence=5 ttl=127 time=30 ms
--- 192.168.4.2 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 20/22/30 ms