实验拓扑:
实验需求:
1,R5为ISP,只能进行IP地址配置,其所有地址均配为共有IP地址;
2,R1和R5间使用PPP的PAP的PAP认证,R5为主认证方;
R2和R5之间使用PPP的CHAP认证,R5为主认证方;
R3和R5之间使用HDLC封装;
3,R1,R2,R3构建一个MGRE环境,R1为中心站点,R1,R4间为点到点的GRE;
4,整个私有网络基于RIP全网可达;
5,所有PC设置私有IP为源IP,可以访问R5环回,达到全网通;
实验步骤:
配置IP:
PC1:
PC2:
PC3:
PC4:
R1:
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.254 24
Mar 29 2024 18:20:33-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R1-GigabitEthernet0/0/0]q
[R1]int Serial 4/0/0
[R1-Serial4/0/0]ip add 15.1.1.1 24
[R1-Serial4/0/0]q
[R1]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 5
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 5
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.254/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
NULL0 unassigned up up(s)
Serial3/0/0 unassigned down down
Serial3/0/1 unassigned down down
Serial4/0/0 15.1.1.1/24 up up
Serial4/0/1 unassigned down down
[R1]
R2:
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.2.254 24
Mar 29 2024 18:25:51-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R2-GigabitEthernet0/0/0]q
[R2]int Serial 4/0/0
[R2-Serial4/0/0]ip add 25.1.1.2 24
[R2-Serial4/0/0]q
[R2]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 5
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 5
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.2.254/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
NULL0 unassigned up up(s)
Serial3/0/0 unassigned down down
Serial3/0/1 unassigned down down
Serial4/0/0 25.1.1.2/24 up up
Serial4/0/1 unassigned down down
[R2]
R3:
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.3.254 24
Mar 29 2024 18:27:47-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R3-GigabitEthernet0/0/0]q
[R3]int Serial 4/0/0
[R3-Serial4/0/0]ip add 35.1.1.3 24
[R3-Serial4/0/0]q
[R3]dis ip int b
[R3]dis ip int brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 5
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 5
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.3.254/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
NULL0 unassigned up up(s)
Serial3/0/0 unassigned down down
Serial3/0/1 unassigned down down
Serial4/0/0 35.1.1.3/24 up up
Serial4/0/1 unassigned down down
[R3]
R4:
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 45.1.1.4 24
Mar 29 2024 18:29:55-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R4-GigabitEthernet0/0/0]q
[R4]int g0/0/1
[R4-GigabitEthernet0/0/1]ip add 192.168.4.254 24
Mar 29 2024 18:30:51-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]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 45.1.1.4/24 up up
GigabitEthernet0/0/1 192.168.4.254/24 up up
GigabitEthernet0/0/2 unassigned down down
NULL0 unassigned up up(s)
[R4]
R5:
[R5]int Serial 4/0/1
[R5-Serial4/0/1]ip add 15.1.1.5 24
[R5-Serial4/0/1]
Mar 29 2024 18:32:10-08:00 R5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol PPP
IPCP on the interface Serial4/0/1 has entered the UP state.
[R5-Serial4/0/1]q
[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]ip add 45.1.1.5 24
Mar 29 2024 18:33:00-08:00 R5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R5-GigabitEthernet0/0/0]int s 3/0/1
[R5-Serial3/0/1]ip add 25.1.1.5 24
[R5-Serial3/0/1]
Mar 29 2024 18:33:40-08:00 R5 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol PPP
IPCP on the interface Serial3/0/1 has entered the UP state.
[R5-Serial3/0/1]int s 4/0/0
[R5-Serial4/0/0]ip add 35.1.1.5 25
[R5-Serial4/0/0]
Mar 29 2024 18:34:03-08:00 R5 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol PPP
IPCP on the interface Serial4/0/0 has entered the UP state.
[R5-Serial4/0/0]q
[R5]int l0
[R5-LoopBack0]ip add 5.5.5.5 24
[R5-LoopBack0]q
[R5]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 6
The number of interface that is DOWN in Physical is 3
The number of interface that is UP in Protocol is 6
The number of interface that is DOWN in Protocol is 3
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 45.1.1.5/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 5.5.5.5/24 up up(s)
NULL0 unassigned up up(s)
Serial3/0/0 unassigned down down
Serial3/0/1 25.1.1.5/24 up up
Serial4/0/0 35.1.1.5/25 up up
Serial4/0/1 15.1.1.5/24 up up
[R5]
配置静态缺省,使之实现公网通:
R1–R4:
[R1]ip route-static 0.0.0.0 0 15.1.1.5
[R2]ip route-static 0.0.0.0 0 25.1.1.5
[R3]ip route-static 0.0.0.0 0 35.1.1.5
[R4]ip route-static 0.0.0.0 0 45.1.1.5
测试:
ppp的认证:
R1和R5间使用PPP的PAP的PAP认证,R5为主认证方;
R5:
[R5]aaa
[R5-aaa]local-user zhangyipei password cipher zhang123
Info: Add a new user.
[R5-aaa]local-user zhangyipei service-type ppp
[R5-aaa]q
[R5]
[R5]int Serial 4/0/1
[R5-Serial4/0/1]ppp authentication-mode pap
[R5-Serial4/0/1]q
[R5]
R1:
[R1]int Serial 4/0/0
[R1-Serial4/0/0]ppp pap local-user zhangyipei password cipher zhang123
[R1-Serial4/0/0]q
R2和R5之间使用PPP的CHAP认证,R5为主认证方;
R5:
[R5]aaa
[R5-aaa]local-user zhangerpei password cipher zhang456
Info: Add a new user.
[R5-aaa]local-user zhangerpei service-type ppp
[R5-aaa]q
[R5]int se
[R5]int Serial 3/0/1
[R5-Serial3/0/1]ppp authentication-mode chap
[R5-Serial3/0/1]q
[R5]
R2:
[R2]int Serial 4/0/0
[R2-Serial4/0/0]ppp chap user zhangerpei
[R2-Serial4/0/0]ppp chap password cipher zhang456
[R2-Serial4/0/0]q
[R2]
R3和R5之间使用HDLC封装;
R5:
[R5]int se
[R5]int Serial 4/0/0
[R5-Serial4/0/0]li
[R5-Serial4/0/0]link-protocol h
[R5-Serial4/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]
:y
Mar 31 2024 21:58:14-08:00 R5 %%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.
[R5-Serial4/0/0]
[R5-Serial4/0/0]
Mar 31 2024 21:58:14-08:00 R5 %%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.
[R5-Serial4/0/0]
Mar 31 2024 21:58:14-08:00 R5 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol PPP
on the interface Serial4/0/0 has entered the DOWN state.
[R5-Serial4/0/0]
Mar 31 2024 21:58:14-08:00 R5 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol PPP
IPCP on the interface Serial4/0/0 has entered the DOWN state.
[R5-Serial4/0/0]
Mar 31 2024 21:58:14-08:00 R5 %%01IFPDT/4/IF_STATE(l)[4]:Interface Serial4/0/0 h
as turned into DOWN state.
[R5-Serial4/0/0]
Mar 31 2024 21:58:14-08:00 R5 %%01IFPDT/4/IF_STATE(l)[5]:Interface Serial4/0/0 h
as turned into UP state.
[R5-Serial4/0/0]
Mar 31 2024 21:58:14-08:00 R5 %%01IFNET/4/LINK_STATE(l)[6]:The line protocol IP
on the interface Serial4/0/0 has entered the UP state.
[R5-Serial4/0/0]
R3:
[R3]int se
[R3]int Serial 4/0/0
[R3-Serial4/0/0]lin
[R3-Serial4/0/0]link-protocol h
[R3-Serial4/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]
:y
Mar 31 2024 22:00:23-08:00 R3 %%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.
[R3-Serial4/0/0]
Mar 31 2024 22:00:23-08:00 R3 %%01IFPDT/4/IF_STATE(l)[1]:Interface Serial4/0/0 h
as turned into DOWN state.
[R3-Serial4/0/0]
Mar 31 2024 22:00:24-08:00 R3 %%01IFPDT/4/IF_STATE(l)[2]:Interface Serial4/0/0 h
as turned into UP state.
[R3-Serial4/0/0]
Mar 31 2024 22:00:24-08:00 R3 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface Serial4/0/0 has entered the UP state.
[R3-Serial4/0/0]
构建MGRE环境;
R1:
[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]ip add 10.1.2.1 24
[R1-Tunnel0/0/0]
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp
[R1-Tunnel0/0/0]source 15.1.1.1
Mar 31 2024 22:05:24-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 network-id 100
[R1-Tunnel0/0/0]
R2:
[R2]int Tunnel 0/0/0
[R2-Tunnel0/0/0]ip add 10.1.2.2 24
[R2-Tunnel0/0/0]
[R2-Tunnel0/0/0]tunnel-protocol gre p2mp
[R2-Tunnel0/0/0]source Serial 4/0/0
Mar 31 2024 22:08: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]
[R2-Tunnel0/0/0]nhrp network-id 100
[R2-Tunnel0/0/0]nhrp entry 10.1.2.1 15.1.1.1 register
[R2-Tunnel0/0/0]
R3:
[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ip add 10.1.2.3 24
[R3-Tunnel0/0/0]
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source Serial 4/0/0
Mar 31 2024 22:10:44-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 network-id 100
[R3-Tunnel0/0/0]nhrp entry 10.1.2.1 15.1.1.1 register
[R3-Tunnel0/0/0]
构建GRE隧道;
R1:
[R1]int Tunnel 0/0/1
[R1-Tunnel0/0/1]ip add 10.1.1.1 24
[R1-Tunnel0/0/1]tunnel-protocol gre
[R1-Tunnel0/0/1]source 15.1.1.1
[R1-Tunnel0/0/1]destination 45.1.1.4
Mar 31 2024 22:17:21-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-Tunnel0/0/1]
[R1-Tunnel0/0/1]
R4:
[R4]int Tunnel 0/0/1
[R4-Tunnel0/0/1]ip add 10.1.1.4 24
[R4-Tunnel0/0/1]tunnel-protocol gre
[R4-Tunnel0/0/1]source 45.1.1.4
[R4-Tunnel0/0/1]destination 15.1.1.1
Mar 31 2024 22:19:48-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/1 has entered the UP state.
[R4-Tunnel0/0/1]
[R4-Tunnel0/0/1]
整个私有网络基于RIP全网可达;
R1:
[R1]rip 1
[R1-rip-1]v 2
[R1-rip-1]undo summary
[R1-rip-1]network 192.168.1.0
[R1-rip-1]network 10.0.0.0
[R1-rip-1]q
[R1]
R2:
[R2]rip 1
[R2-rip-1]v 2
[R2-rip-1]un
[R2-rip-1]undo su
[R2-rip-1]undo summary
[R2-rip-1]ne
[R2-rip-1]network 192.168.2.0
[R2-rip-1]ne
[R2-rip-1]network 10.0.0.0
[R2-rip-1]q
[R2]
R3:
[R3]rip 1
[R3-rip-1]v 2
[R3-rip-1]un
[R3-rip-1]undo summary
[R3-rip-1]ne
[R3-rip-1]network 192.168.3.0
[R3-rip-1]ne
[R3-rip-1]network 10.0.0.0
[R3-rip-1]q
[R3]
R4:
[R4]rip
[R4-rip-1]v 2
[R4-rip-1]undo summary
[R4-rip-1]network 192.168.4.0
[R4-rip-1]network 10.0.0.0
[R4-rip-1]q
[R4]
开启nhrp的伪广播功能,关闭rip的水平分割;
R1:
[R1-Tunnel0/0/0]nhrp entry multicast dynamic
[R1-Tunnel0/0/0]undo rip split-horizon
[R1-Tunnel0/0/0]
R2:
[R2-Tunnel0/0/0]undo rip split-horizon
[R2-Tunnel0/0/0]
R3:
[R3-Tunnel0/0/0]undo rip split-horizon
[R3-Tunnel0/0/0]
测试:
5,所有PC设置私有IP为源IP,可以访问R5环回,达到全网通;
R1:
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R1-acl-basic-2000]q
[R1]int Serial 4/0/0
[R1-Serial4/0/0]nat outbound 2000
[R1-Serial4/0/0]q
[R1]
R2:
[R2]acl 2000
[R2-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[R2-acl-basic-2000]q
[R2]int Serial 4/0/0
[R2-Serial4/0/0]nat outbound 2000
[R2-Serial4/0/0]q
[R2]
R3:
[R3]acl 2000
[R3-acl-basic-2000]rule permit source 192.168.3.0 0.0.0.255
[R3-acl-basic-2000]q
[R3]int Serial 4/0/0
[R3-Serial4/0/0]nat outbound 2000
[R3-Serial4/0/0]q
[R3]
[R3]
R4:
[R4]acl 2000
[R4-acl-basic-2000]rule permit source 192.168.4.0 0.0.0.255
[R4-acl-basic-2000]q
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]nat outbound 2000
[R4-GigabitEthernet0/0/0]q
[R4]
测试:
完成!