1.实验要求
1.R2为ISP,其上只能配置Ip地址
2.R1-R2之间为HDLC封装
3.R2-R3之间为ppp封装,pap认证,R2为主认证方
4.R2-R4之间为PPP封装,chap认证,R2为主认证方
5.R1、R2、R3构建MGRE环境,仅R1IP地址固定
6.内网使用RIP获取路由,所有PC可以互相访问,并且可访问R2的环回
2.拓扑结构
路由器硬件配置
3.实验步骤
R2:
1.配置IP并开启各项服务
2.创建账户用于ppp验证
3.因为R4和其他的路由器都是直连,所以无需配置路由,其余三台路由器分别建立一条缺省路由通过R4传输即可
The device is running!
<Huawei>
<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname r2
[r2]int lo0
[r2-LoopBack0]ip add 4.4.4.4 24
[r2-LoopBack0]q
[r2]int s3/0/0
[r2-Serial3/0/0]ip add 34.1.1.2 24
[r2-Serial3/0/0]q
[r2]int s4/0/0
[r2-Serial4/0/0]ip add 14.1.1.2 24
[r2-Serial4/0/0]link
[r2-Serial4/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]
:y
[r2-Serial4/0/0]q
[r2]aaa
[r2-aaa]lo
[r2-aaa]local-user a pa
[r2-aaa]local-user a password ci
[r2-aaa]local-user a password cipher 123456
Info: Add a new user.
[r2-aaa]lo
[r2-aaa]local-user a ser
[r2-aaa]local-user a service-type ppp
[r2-aaa]local-user b password cipher 654321
Info: Add a new user.
[r2-aaa]local-user b service-type ppp
[r2-aaa]q
[r2]int s4/0/1
[r2-Serial4/0/1]ip add 24.1.1.1 24
[r2-Serial4/0/1]ppp au
[r2-Serial4/0/1]ppp authentication-mode pap
[r2-Serial4/0/1]q
[r2]int s3/0/0
[r2-Serial3/0/0]ip add 34.1.1.2 24
[r2-Serial3/0/0]ppp au
[r2-Serial3/0/0]ppp authentication-mode chap
[r2-Serial3/0/0]q
[r2]dis
[r2]display ip int
[r2]display ip interface br
[r2]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 4
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 5
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 unassigned down down
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 4.4.4.4/24 up up(s)
NULL0 unassigned up up(s)
Serial3/0/0 34.1.1.2/24 up up
Serial3/0/1 unassigned down down
Serial4/0/0 14.1.1.2/24 up down
Serial4/0/1 24.1.1.1/24 up up
[r2]
R1:
1.开启hdlc服务
2.配置缺省路由
3.R1 IP地址固定,以其作为中心站点,进入虚拟端口配置IP,点到多点的GRE,源IP为14.1.1.1,目标IP每天都在变 description不确定,所以无法配置,配置命令让其余路由器依靠nhrp协议自行索要map,做一个network-id为100
4.私网之间路由器通过rip协议互相宣告对方网段,动态获取路由。
5.关闭水平分割
The device is running!
<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname r1
[r1]int g0/0/1
[r1-GigabitEthernet0/0/1]ip add 192.168.1.1 24
[r1-GigabitEthernet0/0/1]int s4/0/0
[r1-Serial4/0/0]ip add 14.1.1.1 24
[r1-Serial4/0/0]link
[r1-Serial4/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]
:y
[r1-Serial4/0/0]q
[r1]ip rou
[r1]ip route
[r1]ip route-static 0.0.0.0 0 14.1.1.2
[r1]int
[r1]interface T
[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]ip add 192.168.4.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 14.1.1.1
Aug 9 2023 18:54:46-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]
[r1-Tunnel0/0/0]nhrp entry multicast dynamic
[r1-Tunnel0/0/0]nhrp network-id 100
[r1-Tunnel0/0/0]q
[r1]rip 1
[r1-rip-1]ver 2
[r1-rip-1]net
[r1-rip-1]network 192.168.1.0
[r1-rip-1]net
[r1-rip-1]network 192.168.4.0
[r1-rip-1]q
[r1]int t0/0/0
[r1-Tunnel0/0/0]undo rip sp
[r1-Tunnel0/0/0]undo rip split-horizon
[r1-Tunnel0/0/0]q
[r1]acl 2000
[r1-acl-basic-2000]ru
[r1-acl-basic-2000]rule per
[r1-acl-basic-2000]rule permit sou
[r1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r1-acl-basic-2000]q
[r1]int s4/0/0
[r1-Serial4/0/0]nat ou
[r1-Serial4/0/0]nat outbound 2000
[r1-Serial4/0/0]q
R3:
1.开启ppp封装,pap认证
2.GRE:源目标IP不固定,就写端口号s4/0/0口,目标IP通过nhrp协议获取,如何获取map呢? register的意思是注册(不可省略),要每天去R1那里报道,R1虚拟端口IP 192.168.4.1,实际IP 14.1.1.1
3.配置缺省路由
4.私网之间路由器通过rip协议互相宣告对方网段,动态获取路由
The device is running!
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname r3
[r3]int g0/0/1
[r3-GigabitEthernet0/0/1]ip add 192.168.2.1 24
Aug 9 2023 18:32:40-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r3-GigabitEthernet0/0/1]int s4/0/0
[r3-Serial4/0/0]ip add 24.1.1.2 24
[r3-Serial4/0/0]
Aug 9 2023 18:33:22-08:00 r3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol PPP
IPCP on the interface Serial4/0/0 has entered the UP state.
[r3-Serial4/0/0]ppp pap lo
[r3-Serial4/0/0]ppp pap local-user a pa
[r3-Serial4/0/0]ppp pap local-user a password ci
[r3-Serial4/0/0]ppp pap local-user a password cipher 123456
[r3-Serial4/0/0]q
[r3]ip route-static 0.0.0.0 0 24.1.1.1
[r3]int T
[r3]int Tunnel 0/0/0
[r3-Tunnel0/0/0]ip add 192.168.4.2 24
[r3-Tunnel0/0/0]tu
[r3-Tunnel0/0/0]tunnel-protocol g
[r3-Tunnel0/0/0]tunnel-protocol gre p
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]sou
[r3-Tunnel0/0/0]source S
[r3-Tunnel0/0/0]source Serial 4/0/0
Aug 9 2023 19:01:34-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]
[r3-Tunnel0/0/0]nhrp en
[r3-Tunnel0/0/0]nhrp entry 192.168.4.1 14.1.1.1 r
[r3-Tunnel0/0/0]nhrp entry 192.168.4.1 14.1.1.1 register
[r3-Tunnel0/0/0]q
[r3]rip 1
[r3-rip-1]vers 2
[r3-rip-1]net
[r3-rip-1]network 192.168.4.0
[r3-rip-1]net
[r3-rip-1]network 192.168.2.0
[r3-rip-1]q
[r3]acl 2001
[r3-acl-basic-2001]ru
[r3-acl-basic-2001]rule per
[r3-acl-basic-2001]rule permit sou
[r3-acl-basic-2001]rule permit source 192.168.2.0 0.0.0.255
[r3-acl-basic-2001]q
R4:
1.开启ppp封装,chap认证
2.配置缺省路由
3.构建MGRR环境
4.通过rip协议互相宣告对方网段,动态获取路由
Please press enter to start cmd line!
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname r4
[r4]int g0/0/1
[r4-GigabitEthernet0/0/1]ip add 192.168.3.1 24
Aug 9 2023 18:37:31-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r4-GigabitEthernet0/0/1]int s4/0/0
[r4-Serial4/0/0]ip add 34.1.1.1 24
[r4-Serial4/0/0]
Aug 9 2023 18:37:58-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol PPP
IPCP on the interface Serial4/0/0 has entered the UP state.
[r4-Serial4/0/0]ppp chap password cipher 654321
[r4-Serial4/0/0]q
[r4]ip route-static 0.0.0.0 0 34.1.1.2
[r4]int
[r4]interface T
[r4]interface Tunnel 0/0/0
[r4-Tunnel0/0/0]ip add 192.168.4.3 24
[r4-Tunnel0/0/0]tu
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp
[r4-Tunnel0/0/0]sou
[r4-Tunnel0/0/0]source s4/0/0
Aug 9 2023 19:04:39-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-Tunnel0/0/0]
[r4-Tunnel0/0/0]nhrp en
[r4-Tunnel0/0/0]nhrp entry 192.168.4.1 14.1.1.1 r
[r4-Tunnel0/0/0]nhrp entry 192.168.4.1 14.1.1.1 register
[r4-Tunnel0/0/0]q
[r4]rip 1
[r4-rip-1]vers 2
[r4-rip-1]net
[r4-rip-1]network 192.168.4.0
[r4-rip-1]net
[r4-rip-1]network 192.168.3.0
[r4-rip-1]q
[r4]acl 2002
[r4-acl-basic-2002]ru
[r4-acl-basic-2002]rule pe
[r4-acl-basic-2002]rule permit sou
[r4-acl-basic-2002]rule permit source 192.168.3.0 0.0.0.255
[r4-acl-basic-2002]q
[r4]int s4/0/0
[r4-Serial4/0/0]nat ou
[r4-Serial4/0/0]nat outbound 2002
[r4-Serial4/0/0]q
PC1,PC2,PC3
4.运行测试
全网可达
路由表
MGRE路由
至此实验结束