实验要求:
1.R4为ISP,其上只能配置ip地址;R4与其他所有直连的设备间使用公有IP;
2.R3---R5/6/7为MGRE环境,R3为中心站点
3.整个OSPF环境ip地址为172.16.0.0/16
4.所有设备均可访问R4的环回
5.减少LSA 的更新量
6.全网可达
实验拓扑图 (以及IP地址的子网划分)
实验过程
1.公网的配置
R4:
[ISP]int g0/0/0
[ISP-GigabitEthernet0/0/0]ip add 43.1.1.2 24
Aug 6 2023 17:43:30-08:00 ISP %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[ISP-GigabitEthernet0/0/0]int g0/0/1
[ISP-GigabitEthernet0/0/1]ip add 45.1.1.2 24
Aug 6 2023 17:43:46-08:00 ISP %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[ISP-GigabitEthernet0/0/1]int g0/0/2
[ISP-GigabitEthernet0/0/2]ip add 46.1.1.2 24
[ISP-GigabitEthernet0/0/2]
Aug 6 2023 17:43:59-08:00 ISP %%01IFNET/4/LINK_STATE(l)[5]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[ISP-GigabitEthernet0/0/2]int g4/0/0
[ISP-GigabitEthernet4/0/0]ip add 47.1.1.2 24
[ISP]int l0
[ISP-LoopBack0]ip add 4.4.4.4 24
[ISP-LoopBack0]q
R3:
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 43.1.1.1 24
Aug 6 2023 17:46:15-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]q
[R3]ip rou
[R3]ip route
[R3]ip route-static 0.0.0.0 0 43.1.1.2
R5:
[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]ip add 45.1.1.1 24
Aug 6 2023 17:47:20-08:00 R5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R5-GigabitEthernet0/0/0]q
[R5]ip rou
[R5]ip route
[R5]ip route-static 0.0.0.0 0 45.1.1.2
R6:
[R6]int g0/0/0
[R6-GigabitEthernet0/0/0]ip add 46.1.1.1 24
Aug 6 2023 17:48:15-08:00 R6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R6-GigabitEthernet0/0/0]q
[R6]ip rou
[R6]ip route
[R6]ip route-static 0.0.0.0 0 46.1.1.2
R7:
[R7]int g0/0/0
[R7-GigabitEthernet0/0/0]ip add 47.1.1.1 24
Aug 6 2023 17:49:53-08:00 R7 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R7-GigabitEthernet0/0/0]q
[R7]ip rou
[R7]ip route
[R7]ip route-static 0.0.0.0 0 47.1.1.2
2.私网配置
R1:
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 172.16.1.0 21
Aug 6 2023 17:51: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 l0
[R1-LoopBack0]ip add 172.16.9.0 21
[R1-LoopBack0]q
[R1]ospf 1 rou
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]net
[R1-ospf-1-area-0.0.0.1]network 172.16.1.0 0.0.0.0
[R1-ospf-1-area-0.0.0.1]network 172.16.9.0 0.0.0.0
[R1-ospf-1-area-0.0.0.1]q
[R1-ospf-1]q
R2:
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 172.16.2.0 21
Aug 6 2023 17:54:06-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]int l0
[R2-LoopBack0]ip add 172.16.17.0 21
[R2-LoopBack0]q
[R2]ospf 1 rou
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]network 172.16.2.0 0.0.0.0
[R2-ospf-1-area-0.0.0.1]network 172.16.17.0 0.0.0.0
R3:
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 172.16.3.0 21
Aug 6 2023 17:57:03-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 l0
[R3-LoopBack0]ip add 172.16.25.0 21
[R3-LoopBack0]int t0/0/0
[R3-Tunnel0/0/0]ip add 172.16.33.0 21
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source 43.1.1.1
[R3-Tunnel0/0/0]nhrp entry multicast dynamic
[R3-Tunnel0/0/0]nhrp network-id 100
[R3-Tunnel0/0/0]ospf network-type broadcast
[R3-Tunnel0/0/0]q
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]network 172.16.3.0 0.0.0.0
[R3-ospf-1-area-0.0.0.1]network 172.16.25.0 0.0.0.0
[R3-ospf-1-area-0.0.0.1]q
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]net
[R3-ospf-1-area-0.0.0.0]network 172.16.33.0 0.0.0.0
R5:
[R5]int l0
[R5-LoopBack0]ip add 172.16.41.0 21
[R5-LoopBack0]q
[R5]int t0/0/0
[R5-Tunnel0/0/0]ip add 172.16.34.0 21
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp
[R5-Tunnel0/0/0]source 45.1.1.1
Aug 6 2023 18:03:25-08:00 R5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R5-Tunnel0/0/0]nhrp network-id 100
[R5-Tunnel0/0/0]nhrp entry 172.16.3.0 43.1.1.1 re
[R5-Tunnel0/0/0]nhrp entry 172.16.33.0 43.1.1.1 register
[R5-Tunnel0/0/0]ospf network-type broadcast
[R5-Tunnel0/0/0]ospf dr-priority 0
[R5-Tunnel0/0/0]q
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 172.16.34.0 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 172.16.41.0 0.0.0.0
R6:
[R6]int l0
[R6-LoopBack0]ip add 172.16.49.0 21
[R6-LoopBack0]q
[R6]int t0/0/0
[R6-Tunnel0/0/0]ip add 172.16.35.0 21
[R6-Tunnel0/0/0]int g0/0/1
[R6-GigabitEthernet0/0/1]ip add 172.16.65.0 21
[R6]int t0/0/0
[R6-Tunnel0/0/0]tunnel-protocol gre p2mp
[R6-Tunnel0/0/0]source 46.1.1.1
[R6-Tunnel0/0/0]nhrp network-id 100
[R6-Tunnel0/0/0]nhrp entry 172.16.33.0 43.1.1.1 register
[R6-Tunnel0/0/0]ospf network-type broadcast
[R6-Tunnel0/0/0]ospf dr-priority 0
[R6-Tunnel0/0/0]q
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]network 172.16.35.0 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 172.16.49.0 0.0.0.0
[R6-ospf-1-area-0.0.0.0]q
[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]network 172.16.65.0 0.0.0.0
R7:
[R7]int l0
[R7-LoopBack0]ip add 172.16.57.0 21
[R7-LoopBack0]int g0/0/1
[R7-GigabitEthernet0/0/1]ip add 172.16.97.0 21
[R7-GigabitEthernet0/0/1]
[R7-GigabitEthernet0/0/1]int t0/0/0
[R7-Tunnel0/0/0]ip add 172.16.36.0 21
[R7-Tunnel0/0/0]tunnel-protocol gre p2mp
[R7-Tunnel0/0/0]source 47.1.1.1
[R7-Tunnel0/0/0]nhrp network-id 100
[R7-Tunnel0/0/0]nhrp entry 172.16.33.0 43.1.1.1 register
[R7-Tunnel0/0/0]ospf network-type broadcast
[R7-Tunnel0/0/0]ospf dr-priority 0
[R7-Tunnel0/0/0]q
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]area 0
[R7-ospf-1-area-0.0.0.0]network 172.16.36.0 0.0.0.0
[R7-ospf-1-area-0.0.0.0]network 172.16.57.0 0.0.0.0
[R7-ospf-1-area-0.0.0.0]q
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]network 172.16.97.0 0.0.0.0
R8:
[R8]int g0/0/0
[R8-GigabitEthernet0/0/0]ip add 172.16.98.0 21
Aug 6 2023 18:16:22-08:00 R8 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R8-GigabitEthernet0/0/0]int g0/0/1
[R8-GigabitEthernet0/0/1]ip add 172.16.113.0 21
Aug 6 2023 18:16:56-08:00 R8 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R8-GigabitEthernet0/0/1]int l0
[R8-LoopBack0]ip add 172.16.105.0 21
[R8-LoopBack0]q
[R8]ospf 1 rou
[R8]ospf 1 router-id 8.8.8.8
[R8-ospf-1]area 3
[R8-ospf-1-area-0.0.0.3]net
[R8-ospf-1-area-0.0.0.3]network 172.16.98.0 0.0.0.0
[R8-ospf-1-area-0.0.0.3]network 172.16.105.0 0.0.0.0
[R8-ospf-1-area-0.0.0.3]network 172.16.113.0 0.0.0.0
R9:
[R9]int g0/0/0
[R9-GigabitEthernet0/0/0]ip add 172.16.114.0 21
[R9-GigabitEthernet0/0/0]int g0/0/1
[R9-GigabitEthernet0/0/1]ip add 172.16.129.0 21
[R9-LoopBack0]ip add 172.16.137.0 21
[R9-LoopBack0]q
[R9]ospf 1 rou
[R9]ospf 1 router-id 9.9.9.9
[R9-ospf-1]area 4
[R9-ospf-1-area-0.0.0.4]q
[R9-ospf-1]area 3
[R9-ospf-1-area-0.0.0.3]network 172.16.114.0 0.0.0.0
[R9-ospf-1-area-0.0.0.3]q
[R9-ospf-1]q
[R9]ospf 2
[R9-ospf-2]area 4
[R9-ospf-2-area-0.0.0.4]network 172.16.129.0 0.0.0.0
[R9-ospf-2-area-0.0.0.4]network 172.16.137.0 0.0.0.0
[R9-ospf-2-area-0.0.0.4]q
[R9-ospf-2]q
[R9]ospf 1
[R9-ospf-1]import-route ospf 2
R10:
[R10]int g0/0/0
[R10-GigabitEthernet0/0/0]ip add 172.16.130.0 21
[R10-GigabitEthernet0/0/0]int l0
[R10-LoopBack0]ip add 172.16.145.0 21
[R10-LoopBack0]q
[R10]ospf 1 rou
[R10]ospf 1 router-id 10.10.10.10
[R10-ospf-1]area 4
[R10-ospf-1-area-0.0.0.4]net
[R10-ospf-1-area-0.0.0.4]network 172.16.130.0 0.0.0.0
[R10-ospf-1-area-0.0.0.4]network 172.16.145.0 0.0.0.0
[R10-ospf-1-area-0.0.0.4]q
[R10-ospf-1]q
[R10]ip route-static 0.0.0.0 0 172.16.129.0
R11:
[R11]int g0/0/0
[R11-GigabitEthernet0/0/0]ip add 172.16.66.0 21
[R11-GigabitEthernet0/0/0]int g0/0/1
[R11-GigabitEthernet0/0/1]ip add 172.16.81.0 21
[R11-GigabitEthernet0/0/1]int l0
[R11-LoopBack0]ip add 172.16.73.0 21
[R11-LoopBack0]q
[R11]ospf 1 rou
[R11]ospf 1 router-id 11.11.11.11
[R11-ospf-1]area 2
[R11-ospf-1-area-0.0.0.2]net
[R11-ospf-1-area-0.0.0.2]network 172.16.66.0 0.0.0.0
[R11-ospf-1-area-0.0.0.2]network 172.16.73.0 0.0.0.0
[R11-ospf-1-area-0.0.0.2]network 172.16.81.0 0.0.0.0
R12:
[R12]int g0/0/0
[R12-GigabitEthernet0/0/0]ip add 172.16.82.0 21
Aug 6 2023 18:28:59-08:00 R12 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R12-GigabitEthernet0/0/0]int l0
[R12-LoopBack0]ip add 172.16.177.0 21
[R12-LoopBack0]int l1
[R12-LoopBack1]ip add 172.16.161.0 21
[R12-LoopBack1]q
[R12]ospf 1 rou
[R12]ospf 1 router-id 12.12.12.12
[R12-ospf-1]area 2
[R12-ospf-1-area-0.0.0.2]net
[R12-ospf-1-area-0.0.0.2]network 172.16.82.0 0.0.0.0
[R12-ospf-1-area-0.0.0.2]q
[R12-ospf-1]q
[R12-ospf-1]rip 1
[R12-rip-1]v 2
[R12-rip-1]net
[R12-rip-1]network 172.16.0.0
[R12-rip-1]im
[R12-ospf-1]import-route rip
3.优化策略
R1:调整特殊区域为完全末梢区域
[R1-ospf-1-area-0.0.0.1]stub
R2:与R1操作相同:
R3:
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]abr-
[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.0.0 255.255.224.0
区域汇总
[R3-ospf-1-area-0.0.0.1]stub no
[R3-ospf-1-area-0.0.0.1]stub no-summary
调整特殊区域为完全末梢区域
R6:
[R6]ospf 1
[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]abr-
[R6-ospf-1-area-0.0.0.2]abr-summary 172.16.96.0 255.255.224.0
[R6-ospf-1-area-0.0.0.2]nssa no-summary
R7:
[R7]ospf
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]abr-
[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0
[R7-ospf-1-area-0.0.0.3]nssa no-summary
R8:
[R8]OSPF
[R8-ospf-1]area 3
[R8-ospf-1-area-0.0.0.3]nssa
R9:
[R9]ospf 2
[R9-ospf-2]asbr-summary 172.16.128.0 255.255.224.0
[R9]ospf 1
[R9-ospf-1]area 3
[R9-ospf-1-area-0.0.0.3]nssa
R11:
[R11]ospf 1
[R11-ospf-1]area 2
[R11-ospf-1-area-0.0.0.2]nssa
R12:
[R12]ospf
[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0
[R12-ospf-1]area 2
[R12-ospf-1-area-0.0.0.2]nssa
4.NAT配置
R3: R6/7与其配置相同
[R3]ACL 2000
[R3-acl-basic-2000]rule p
[R3-acl-basic-2000]rule permit s
[R3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R3-acl-basic-2000]q
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]nat ou
[R3-GigabitEthernet0/0/1]nat outbound 2000
5.空接口防环
R3:R6/7/9/12与其配置相同
[R3]ip router-static 0.0.0.0 0 NULL 0
6.测试: