一、实验拓扑
二、实验需求
1.R2为ISP,其上只能配置IP地址
2.R1-R2之间为HDLC封装
3.R2-R3之间为ppp封装,pap认证,R22为主认证方
4.R2-R4之间为ppp封装,chap认证,R2为主认证方
5.R1、R2、R3、构建MGRE环境,仅R1 IP地址固定
6.内网使用RIP获取路由,所有PC可以互相访问,并且可访问R2的环回。
三、实验思路
1.配置各路由器的接口IP
2.R1、R3、R4路由器上写缺省路由到达公网
3.在serial接口上做题目要求的封装和认证
4.构建MGRE使R1、R3、R4在一个网段并互通
5.内网用RIP获取路由,使各个PC之间能互相访问
四、实验步骤
1.配置IP并写缺省路由
r1
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]int s4/0/0
[R1-Serial4/0/0]ip address 14.1.1.1 24
[R1-Serial4/0/0]q
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip address 192.168.1.1 24
Aug 3 2023 23:16:46-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R1-GigabitEthernet0/0/1]q
[R1]
R2
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname R2
[R2]int s4/0/0
[R2-Serial4/0/0]ip address 14.1.1.2 24
[R2-Serial4/0/0]
Aug 3 2023 23:17:51-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol PPP
IPCP on the interface Serial4/0/0 has entered the UP state.
[R2-Serial4/0/0]q
[R2]int s4/0/1
[R2-Serial4/0/1]ip add
[R2-Serial4/0/1]ip address 24.1.1.2 24
[R2-Serial4/0/1]q
[R2]int s3/0/0
[R2-Serial3/0/0]ip add
[R2-Serial3/0/0]ip address 34.1.1.2 24
[R2-Serial3/0/0]q
[R2]
[R2]int lo0
[R2-LoopBack0]ip address 4.4.4.4 24
[R2-LoopBack0]
Aug 3 2023 23:22:20-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol PPP
IPCP on the interface Serial4/0/1 has entered the UP state.
[R2-LoopBack0]
R3
<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R3
[R3]int s4/0/0
[R3-Serial4/0/0]ip address 24.1.1.1 24
[R3-Serial4/0/0]
Aug 3 2023 23:22:20-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol PPP
IPCP on the interface Serial4/0/0 has entered the UP state.
[R3-Serial4/0/0]q
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]ip address 192.168.2.1 24
Aug 3 2023 23:23:03-08:00 R3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R3-GigabitEthernet0/0/1]q
[R3]
[R3]ip route-static 0.0.0.0 0 24.1.1.2
[R3]
R4
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R4
[R4]int s4/0/0
[R4-Serial4/0/0]ip address 34.1.1.1 24
[R4-Serial4/0/0]
Aug 3 2023 23:23:53-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol PPP
IPCP on the interface Serial4/0/0 has entered the UP state.
[R4-Serial4/0/0]q
[R4]int g0/0/1
[R4-GigabitEthernet0/0/1]ip address 192.168.3.1 24
Aug 3 2023 23:24:20-08:00 R4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R4-GigabitEthernet0/0/1]q
[R4]ip route-static 0.0.0.0 0 34.1.1.2
[R4]
2.ppp封装和HDLC封装
2.1.R1-R2之间配置HDLC封装
R1
[R1]interface s4/0/0
[R1-Serial4/0/0]lin
[R1-Serial4/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]
:y
Aug 4 2023 00:52:01-08:00 R1 %%01IFNET/4/CHANGE_ENCAP(l)[0]:The user performed
the configuration that will change the encapsulation protocol of the link and th
en selected Y.
[R1-Serial4/0/0]
[R1-Serial4/0/0]
Aug 4 2023 00:52:01-08:00 R1 %%01PPP/4/PHYSICALDOWN(l)[1]:On the interface Seri
al4/0/0, PPP link was closed because the status of the physical layer was Down.[R1-Serial4/0/0]
Aug 4 2023 00:52:01-08:00 R1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol PPP
on the interface Serial4/0/0 has entered the DOWN state.
[R1-Serial4/0/0]
Aug 4 2023 00:52:01-08:00 R1 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol PPP
IPCP on the interface Serial4/0/0 has entered the DOWN state.
[R1-Serial4/0/0]
Aug 4 2023 00:52:01-08:00 R1 %%01IFPDT/4/IF_STATE(l)[4]:Interface Serial4/0/0 h
as turned into DOWN state.
[R1-Serial4/0/0]
Aug 4 2023 00:52:01-08:00 R1 %%01IFNET/4/LINK_STATE(l)[5]:The line protocol IP
on the interface Tunnel0/0/0 has entered the DOWN state.
[R1-Serial4/0/0]
Aug 4 2023 00:52:01-08:00 R1 %%01RM/4/IPV4_DEFT_RT_CHG(l)[6]:IPV4 default Route
is changed. (ChangeType=Delete, InstanceId=0, Protocol=Static, ExitIf=Unknown,
Nexthop=14.1.1.2, Neighbour=0.0.0.0, Preference=1006632960, Label=NULL, Metric=0
)
[R1-Serial4/0/0]
Aug 4 2023 00:52:01-08:00 R1 %%01IFPDT/4/IF_STATE(l)[7]:Interface Serial4/0/0 h
as turned into UP state.
[R1-Serial4/0/0]
Aug 4 2023 00:52:01-08:00 R1 %%01IFNET/4/LINK_STATE(l)[8]:The line protocol IP
on the interface Serial4/0/0 has entered the UP state.
[R1-Serial4/0/0]
Aug 4 2023 00:52:01-08:00 R1 %%01IFNET/4/LINK_STATE(l)[9]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R1-Serial4/0/0]
[R1-Serial4/0/0]
R2
[R2]int
[R2]interface s4/0/0
[R2-Serial4/0/0]lin
[R2-Serial4/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]
:y
Aug 4 2023 00:52:35-08:00 R2 %%01IFNET/4/CHANGE_ENCAP(l)[0]:The user performed
the configuration that will change the encapsulation protocol of the link and th
en selected Y.
[R2-Serial4/0/0]
[R2-Serial4/0/0]
Aug 4 2023 00:52:35-08:00 R2 %%01IFPDT/4/IF_STATE(l)[1]:Interface Serial4/0/0 h
as turned into DOWN state.
[R2-Serial4/0/0]
Aug 4 2023 00:52:36-08:00 R2 %%01IFPDT/4/IF_STATE(l)[2]:Interface Serial4/0/0 h
as turned into UP state.
[R2-Serial4/0/0]
Aug 4 2023 00:52:36-08:00 R2 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface Serial4/0/0 has entered the UP state.
[R2-Serial4/0/0]
[R2-Serial4/0/0]
2.2.R2-R3之间做ppp封装,pap认证,R22为主认证方
R2(主认证方)
[R2]
[R2]aaa
[R2-aaa]local-user a password cipher 123456
Info: Add a new user.
[R2-aaa]local-user a service-type ppp
[R2-aaa]int s4/0/1
[R2-Serial4/0/1]ppp authentication-mode pap
[R2-Serial4/0/1]
R3(被认证方)
[R3]int s4/0/0
[R3-Serial4/0/0]ppp pap local-user a password cipher 123456
[R3-Serial4/0/0]
2.3.R2-R4之间为ppp封装,chap认证,R2为主认证方
R2(主认证方)
[R2]aaa
[R2-aaa]local-user a password cipher 123456
[R2-aaa]local-user a service-type ppp
[R2-aaa]int s3/0/0
[R2-Serial3/0/0]ppp chap password cipher 123456
[R2-Serial3/0/0]
R3(被认证方)
[R4]int s4/0/0
[R4-Serial4/0/0]ppp chap password cipher 123456
[R4-Serial4/0/0]
3.构建MGRE
R1
[R1]
[R1]interface Tunnel 0/0/0
[R1-Tunnel0/0/0]ip address 192.168.3.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp
[R1-Tunnel0/0/0]source 14.1.1.1
Aug 3 2023 23:34:25-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]ip address 192.168.4.1 24
[R1-Tunnel0/0/0]
Aug 3 2023 23:44:00-08:00 R1 %%01IFNET/4/LINK_STATE(l)[5]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R1-Tunnel0/0/0]
[R1-Tunnel0/0/0]q
[R1]
R3
[R3]interface Tunnel 0/0/0
[R3-Tunnel0/0/0]ip address 192.168.4.2 24
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source Serial 4/0/0
Aug 3 2023 23:45: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 entry 192.168.4.1 14.1.1.1 register
[R3-Tunnel0/0/0]nhrp network-id 100
[R3-Tunnel0/0/0]
R4
[R4]interface Tunnel 0/0/0
[R4-Tunnel0/0/0]ip address 192.168.4.3 24
[R4-Tunnel0/0/0]tunnel-protocol gre p2mp
[R4-Tunnel0/0/0]source Serial 4/0/0
Aug 3 2023 23:51:15-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 entry 192.168.4.1 14.1.1.1 register
[R4-Tunnel0/0/0]nhrp network-id 100
[R4-Tunnel0/0/0]
4.rip宣告内网
R1
<R1>sys
Enter system view, return user view with Ctrl+Z.
[R1]rip
[R1-rip-1]vers 2
[R1-rip-1]network 192.168.1.0
[R1-rip-1]network 192.168.4.0
[R1-rip-1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 17 Routes : 17Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 60 0 RD 14.1.1.2 Serial4/0/0
14.1.1.0/24 Direct 0 0 D 14.1.1.1 Serial4/0/0
14.1.1.1/32 Direct 0 0 D 127.0.0.1 Serial4/0/0
14.1.1.2/32 Direct 0 0 D 14.1.1.2 Serial4/0/0
14.1.1.255/32 Direct 0 0 D 127.0.0.1 Serial4/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.0/24 Direct 0 0 D 192.168.1.1 GigabitEthernet
0/0/1
192.168.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.2.0/24 RIP 100 1 D 192.168.4.2 Tunnel0/0/0
192.168.3.0/24 RIP 100 1 D 192.168.4.3 Tunnel0/0/0
192.168.4.0/24 Direct 0 0 D 192.168.4.1 Tunnel0/0/0
192.168.4.1/32 Direct 0 0 D 127.0.0.1 Tunnel0/0/0
192.168.4.255/32 Direct 0 0 D 127.0.0.1 Tunnel0/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0[R1-rip-1]
R3
<R3>sys
Enter system view, return user view with Ctrl+Z.
[R3]
[R3]rip
[R3-rip-1]vers 2
[R3-rip-1]network 192.168.4.0
[R3-rip-1]network 192.168.2.0
[R3-rip-1]q
[R3]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 16 Routes : 16Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 60 0 RD 24.1.1.2 Serial4/0/0
24.1.1.0/24 Direct 0 0 D 24.1.1.1 Serial4/0/0
24.1.1.1/32 Direct 0 0 D 127.0.0.1 Serial4/0/0
24.1.1.2/32 Direct 0 0 D 24.1.1.2 Serial4/0/0
24.1.1.255/32 Direct 0 0 D 127.0.0.1 Serial4/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.0/24 RIP 100 1 D 192.168.4.1 Tunnel0/0/0
192.168.2.0/24 Direct 0 0 D 192.168.2.1 GigabitEthernet
0/0/1
192.168.2.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.4.0/24 Direct 0 0 D 192.168.4.2 Tunnel0/0/0
192.168.4.2/32 Direct 0 0 D 127.0.0.1 Tunnel0/0/0
192.168.4.255/32 Direct 0 0 D 127.0.0.1 Tunnel0/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0[R3]
R4
<R4>sys
Enter system view, return user view with Ctrl+Z.
[R4]
[R4]rip
[R4-rip-1]vers 2
[R4-rip-1]network 192.168.4.0
[R4-rip-1]network 192.168.3.0
[R4-rip-1]q
[R4]dis
[R4]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 16 Routes : 16Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 60 0 RD 34.1.1.2 Serial4/0/0
34.1.1.0/24 Direct 0 0 D 34.1.1.1 Serial4/0/0
34.1.1.1/32 Direct 0 0 D 127.0.0.1 Serial4/0/0
34.1.1.2/32 Direct 0 0 D 34.1.1.2 Serial4/0/0
34.1.1.255/32 Direct 0 0 D 127.0.0.1 Serial4/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.0/24 RIP 100 1 D 192.168.4.1 Tunnel0/0/0
192.168.3.0/24 Direct 0 0 D 192.168.3.1 GigabitEthernet
0/0/1
192.168.3.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.3.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.4.0/24 Direct 0 0 D 192.168.4.3 Tunnel0/0/0
192.168.4.3/32 Direct 0 0 D 127.0.0.1 Tunnel0/0/0
192.168.4.255/32 Direct 0 0 D 127.0.0.1 Tunnel0/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0[R4]
五、测试