一、搭建实验拓扑
二、配置
[R4]int s3/0/0
[R4-Serial3/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
Jul 22 2022 11:52:53-08:00 R4 %%01IFNET/4/CHANGE_ENCAP(l)[0]:The user performed the configuration that will change the encapsulation protocol of the link and then selected Y.
[R4-Serial3/0/0]ip add 14.1.1.2 24
[R4-Serial3/0/0]
[R4-Serial3/0/0]int s3/0/1
[R4-Serial3/0/1]ppp authentication-mode pap
[R4-Serial3/0/1]ip add 24.1.1.2 24
[R4-Serial3/0/1]q
[R4]aaa
[R4-aaa]local-user xixi privilege level 15 password cipher 123456
Info: Add a new user.
[R4-aaa]local-user xixi service-type ppp
[R4-aaa]
[R4-aaa]local-user haha privilege level 15 password cipher 654321
Info: Add a new user.
[R4-aaa]local-user haha service-type ppp
[R4-aaa]
[R4]int s4/0/0
[R4-Serial4/0/0]ppp authentication-mode chap
[R4-Serial4/0/0]ip add 34.1.1.2 24
[R4]int s3/0/1
[R4-Serial3/0/1]shutdown
[R4-Serial3/0/1]undo shutdown
[R4-Serial3/0/1]int s4/0/0
[R4-Serial4/0/0]shutdown
[R4-Serial4/0/0]undo shutdown
<R4>display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 4
The number of interface that is UP in Protocol is 1
The number of interface that is DOWN in Protocol is 7
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 unassigned down down
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
NULL0 unassigned up up(s)
Serial3/0/0 14.1.1.2/24 up down
Serial3/0/1 24.1.1.2/24 up down
Serial4/0/0 34.1.1.2/24 up down
Serial4/0/1 unassigned down down
<R4>
[R4-LoopBack0]ip add 4.4.4.4 24
[R1]int g0/0/2
[R1-GigabitEthernet0/0/2]ip add 192.168.1.1 24
[R1-GigabitEthernet0/0/2]int s4/0/0
[R1-Serial4/0/0]ip add 14.1.1.1 24
[R1-Serial4/0/0]link-protocol hdlc
[R2-GigabitEthernet0/0/2]ip add 192.168.2.1 24
[R2-GigabitEthernet0/0/2]int s4/0/0
[R2-Serial4/0/0]ip add 24.1.1.1 24
[R2-Serial4/0/0]ping 24.1.1.2
PING 24.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
--- 24.1.1.2 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
[R2-Serial4/0/0]ppp pap local-user xixi password cipher 123456
[R2-Serial4/0/0]
[R2-Serial4/0/0]ping 24.1.1.2
PING 24.1.1.2: 56 data bytes, press CTRL_C to break
Reply from 24.1.1.2: bytes=56 Sequence=1 ttl=255 time=50 ms
Reply from 24.1.1.2: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 24.1.1.2: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 24.1.1.2: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 24.1.1.2: bytes=56 Sequence=5 ttl=255 time=10 ms
--- 24.1.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/28/50 ms
[R2-Serial4/0/0]
[R3]int g0/0/2
[R3-GigabitEthernet0/0/2]ip add 192.168.3.1 24
[R3-GigabitEthernet0/0/2]int s4/0/0
[R3-Serial4/0/0]ip add 34.1.1.1 24
[R3-Serial4/0/0]ppp chap user haha
[R3-Serial4/0/0]ppp chap password cipher 654321
缺省
[R1]ip route-static 0.0.0.0 0 14.1.1.2
[R2]ip route-static 0.0.0.0 0 24.1.1.2
[R3]ip route-static 0.0.0.0 0 34.1.1.2
测试
<R1>ping 24.1.1.1
PING 24.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 24.1.1.1: bytes=56 Sequence=1 ttl=254 time=40 ms
Reply from 24.1.1.1: bytes=56 Sequence=2 ttl=254 time=40 ms
Reply from 24.1.1.1: bytes=56 Sequence=3 ttl=254 time=40 ms
Reply from 24.1.1.1: bytes=56 Sequence=4 ttl=254 time=20 ms
Reply from 24.1.1.1: bytes=56 Sequence=5 ttl=254 time=20 ms
--- 24.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/32/40 ms
<R1>ping 34.1.1.1
PING 34.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 34.1.1.1: bytes=56 Sequence=1 ttl=254 time=40 ms
Reply from 34.1.1.1: bytes=56 Sequence=2 ttl=254 time=20 ms
Reply from 34.1.1.1: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 34.1.1.1: bytes=56 Sequence=4 ttl=254 time=30 ms
Reply from 34.1.1.1: bytes=56 Sequence=5 ttl=254 time=20 ms
--- 34.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/28/40 ms
<R1>
[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]ip add 10.1.1.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp
[R1-Tunnel0/0/0]source 14.1.1.1
[R1-Tunnel0/0/0]nhrp entry multicast dynamic
[R1-Tunnel0/0/0]nhrp network-id 100
[R2]int Tunnel 0/0/0
[R2-Tunnel0/0/0]ip add 10.1.1.2 24
[R2-Tunnel0/0/0]tunnel-protocol gre p2mp
[R2-Tunnel0/0/0]source s4/0/0
[R2-Tunnel0/0/0]nhrp entry 10.1.1.1 14.1.1.1 register
[R2-Tunnel0/0/0]nhrp network-id 100
RIP
[R1]rip 1
[R1-rip-1]version 2
[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]network 192.168.2.0
[R2-rip-1]network 10.0.0.0
[R3]rip 1
[R3-rip-1]version 2
[R3-rip-1]network 192.168.3.0
[R3-rip-1]network 10.0.0.0
关闭水平分割
[R1]int t0/0/0
[R1-Tunnel0/0/0]undo rip split-horizon
rip选路不佳,使用静态
[R3]ip route-static 192.168.2.0 24 10.1.1.2
[R3]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 18 Routes : 18
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 60 0 RD 34.1.1.2 Serial4/0/0
10.0.0.0/8 RIP 100 1 D 10.1.1.1 Tunnel0/0/0
10.1.1.0/24 Direct 0 0 D 10.1.1.3 Tunnel0/0/0
10.1.1.3/32 Direct 0 0 D 127.0.0.1 Tunnel0/0/0
10.1.1.255/32 Direct 0 0 D 127.0.0.1 Tunnel0/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 10.1.1.1 Tunnel0/0/0
192.168.2.0/24 Static 60 0 RD 10.1.1.2 Tunnel0/0/0
192.168.3.0/24 Direct 0 0 D 192.168.3.1 GigabitEthernet0/0/2
192.168.3.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/2
192.168.3.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/2
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R3]
[R2]ip route-static 192.168.3.0 24 10.1.1.3
nat
[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 out
[R1-Serial4/0/0]nat outbound 2000
[R2]acl 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 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