一、实验拓扑
二、实验要求
1、R4为ISP,其上只配置IP地址;R4与其他所直连设备间均使用公有IP;
2、R3-R5、R6、R7为MGRE环境,R3为中心站点;
3、整个OSPF环境IP基于172.16.0.0/16划分;除了R12有两个环回,其他路由器均有一个环回IP
4、所有设备均可访问R4的环回;
5、减少LSA的更新量,加快收敛,保障更新安全;
6、全网可达;
三、实验思路
1.按图划分IP地址172.16.0.0/16划分,
172.16.0.0/19---area0
172.16.0.0/24--p2p
172.16.1.0/24--MA
172.16.2.0/24--R4
172.16.3.0/24--R5
172.16.4.0/24--R6
172.16.5.0/24--R7
172.16.6.0/24--隧道
172.16.32.0/19---area1
172.16.32.0/24--p2p
172.16.33.0/24--MA
172.16.34.0/24--R1
172.16.35.0/24--R2
172.16.36.0/24--R3
172.16.64.0/19---area2
172.16.64.0/24--p2p
172.16.65.0/24--MA
172.16.65.0/30--R6-R11
172.16.65.4/30--R11-R12
172.16.66.0/24--R11
172.16.96.0/19---area3
172.16.96.0/24--p2p
172.16.97.0/24--MA
172.16.97.0/30--R7-R8
172.16.97.4/30--R8-R9
172.16.98.0/24--R8
172.16.128.0/19---area4
172.16.128.0/24--p2p
172.16.129.0/24
172.16.129.0/30--R9-R10
172.16.130.0/24--R9
172.16.131.0/24--R10
172.16.160.0/19--R12
172.16.160.0/24--l0
172.16.161.0/24--l1
2.用静态缺省配通公网
3.配ospf、rip,单向、双向路由引入实现内网通
4.配置MGRE,定主与分区
5.配置NAT,内可流到外
6.区域间路由聚合,用来防环,精简area0路由表
7.域外路由聚合,防环,精简area0路由表
8.特殊区域,精简除area0外的其他ospf区域的路由表
9.加快收敛,更改hello时间
10.给接口做区域认证
四、实验步骤
1.配IP
R1
R2
R3
R4
R5
R6
R7
R8
R9
R10
R11
R12
2.配通公网
[R3]ip route-static 0.0.0.0 0 s4/0/0
[R5]ip route-static 0.0.0.0 0 s4/0/1
[R6]ip route-static 0.0.0.0 0 s4/0/0
[R7]ip route-static 0.0.0.0 0 47.0.0.4
测试R3-R6
R3-R7
3.配ospf、rip,路由引入实现内网通
R3、R5、R6、R7、area0:
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]network 172.16.36.3 0.0.0.0
[R5]ospf r 4.4.4.4
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0] n 172.16.3.5 0.0.0.0
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]n 172.16.4.6 0.0.0.0
[R7]ospf r 7.7.7.7
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]n 172.16.5.7 0.0.0.0
R1 、R2、R3 :area1 进行精确宣告
R6、R11、R12:area2
R7、R8、R9:area3
R9、R10:area4
R9:两个ospf进程
[R9]ospf 2
[R9-ospf-2]a 4
[R9-ospf-2-area-0.0.0.4]network 172.16.130.9 0.0.0.0
[R9-ospf-2-area-0.0.0.4]network 172.16.129.1 0.0.0.0
[R9-ospf-2]import-route ospf 1
[R9-ospf-2]ospf 2
[R9-ospf-2]ospf 1
[R9-ospf-1]import-route ospf 2 双向路由引入
R7路由表
R10路由表
R12:
[R12]rip 1
[R12-rip-1]v 2
[R12-rip-1]net 172.16.0.0
[R12]ospf
[R12-ospf-1]im
[R12-ospf-1]import-route rip 1 单向引入即可
4.MGRE
中心站点:
[R3]int t0/0/0
[R3-Tunnel0/0/0]ip add 172.16.6.3 24
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source 14.0.0.3
Aug 1 2025 21:41:07-08:00 R3 %%01IFNET/4/LINK_STATE(l)[6]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R3-Tunnel0/0/0]nhrp network-id 100
[R3-Tunnel0/0/0]nhrp entry multicast dynamic 开启伪广播
[R3-Tunnel0/0/0]ospf network-type broadcast 修改接口类型为广播,可同时发送数据给多个设备
分站点:
[R5]in t0/0/0
[R5-Tunnel0/0/0]ip add 172.16.6.5 24
[R5-Tunnel0/0/0]tunnel-protocol g p2
[R5-Tunnel0/0/0]source s4/0/1
Aug 1 2025 21:44:40-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]
[R5-Tunnel0/0/0]nhrp net 100
[R5-Tunnel0/0/0]nhrp entry 172.16.6.3 14.0.0.3 register
[R5-Tunnel0/0/0]ospf network-type broadcast
[R6]int t0/0/0
[R6-Tunnel0/0/0]ip add 172.16.6.6 24
[R6-Tunnel0/0/0]tunne gr p2
[R6-Tunnel0/0/0]sou s 4/0/0
Aug 1 2025 21:46:59-08:00 R6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R6-Tunnel0/0/0]nhrp net 100
[R6-Tunnel0/0/0]nhrp entry 172.16.6.3 14.0.0.3 register
[R6-Tunnel0/0/0]ospf network-type broadcast
[R7]int t0/0/0
[R7-Tunnel0/0/0]ip add 172.16.6.7 24
[R7-Tunnel0/0/0]tunn gr p2
[R7-Tunnel0/0/0]sou g0/0/0
Aug 1 2025 21:48:33-08:00 R7 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R7-Tunnel0/0/0]nhrp net 100
[R7-Tunnel0/0/0]nhrp entry 172.16.6.3 14.0.0.3 register
[R7-Tunnel0/0/0]ospf network-type broadcast
5.配置NAT
[R3]acl 2000
[R3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R3]int s4/0/0
[R3-Serial4/0/0]nat outbound 2000
[R6]acl 2000
[R6-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R6-acl-basic-2000]q
[R6]int s4/0/0
[R6-Serial4/0/0]nat out 2000
[R7]acl 2000
[R7-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R7-acl-basic-2000]q
[R7]int g0/0/0
[R7-GigabitEthernet0/0/0]nat out 2000
6.区域间路由R3、R6、R7聚合,并防环---精简area0路由表
[R3]ospf
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.32.0 255.255.224.0
[R3]ip route-static 172.16.32.0 19 null 0
[R6]ospf
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0
[R6]ip route-static 172.16.64.0 19 null 0
[R7]ospf
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0
[R7]ip route-static 172.16.96.0 19 null 0
7.域外路由聚合,防环---精简area0路由表
[R3]ospf 1
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.32.0 255.255.224.0
[R3]ip route-static 172.16.32.0 19 null 0
[R6]ospf 1
[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0
[R6]ip route-static 172.16.64.0 19 null 0
[R7]ospf 1
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0
[R7]ip route-static 172.16.96.0 19 null 0
[R9]ospf 1
[R9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0
[R9]ip route-static 172.16.128.0 19 null 0
[R12]ospf 1
[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0
[R12]ip route-static 172.16.160.0 19 null 0
8.特殊区域,精简除area0外的其他ospf区域的路由表
area1---R123同
totally stub区域----完全末梢区域:拒绝学习域外和其他区域的路由信息
[R3]OSPF 1
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]stub no-summary
area2---R6、R11、R12同
area3---R7、R8、R9同
totally NSSA区域---完全非纯末梢区域
[R6]ospf
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]nssa no-summary
9.加快收敛,更改hello时间
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ospf timer hello 10
10.给接口做区域认证
[R3]ospf
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123456
其余路由器同。