OSPF综合应用

实验1

实验图

alt OSPF综合应用

命令

命令 备注
stub 配置区域为Stub
区域内所有路由器都需要配置
stub no-summary 配置区域为Totally Stub
只用于Stub区域内的ABR
nssa 配置区域为NSSA
区域内所有路由器都需要配置
nssa(default-route-advertise) 只用于NSSA区域内的ABR或ASBR
在ABR上无论路由表中是否存在缺省路由,都会产生Type7 LSA缺省路由
在ASBR上只有当路由表中存在缺省路由,才会产生Type 7 LSA缺省路由
nssa no-summary 屏蔽区域间路由
产生一条Type 3 LSA 向该区域发布缺省路由(类似于Totally Stub)

配置

R1配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
sys
sys R1
int g0/0/0
ip add 12.0.0.1 24
int g0/0/1
ip add 13.0.0.1 24
int g0/0/2
ip add 14.0.0.1 24

ospf 1 router-id 1.1.1.1
area 0
net 12.0.0.1 0.0.0.0
net 13.0.0.1 0.0.0.0
net 14.0.0.1 0.0.0.0

R2配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
sys
sys R2
int g0/0/0
ip add 12.0.0.2 24
int g0/0/1
ip add 25.0.0.1 24

ospf 1 router-id 2.2.2.2
area 0
net 12.0.0.2 0.0.0.0
area 1
net 25.0.0.1 0.0.0.0
#设置成Stub区域
stub no-summary

R3配置

1
2
3
4
5
6
7
8
9
10
11
12
sys
sys R3
int g0/0/0
ip add 13.0.0.2 24
int g0/0/1
ip add 38.0.0.1 24

ospf 1 router-id 3.3.3.3
area 0
net 13.0.0.2 0.0.0.0
area 3
net 38.0.0.1 0.0.0.0

R4配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
sys
sys R4
int g0/0/0
ip add 14.0.0.2 24
int g0/0/1
ip add 46.0.0.1 24

ospf 1 router-id 4.4.4.4
area 0
net 14.0.0.2 0.0.0.0
area 2
net 46.0.0.1 0.0.0.0
# 设置NSSA区域
nssa no-summary

R5配置

1
2
3
4
5
6
7
8
9
sys
sys R5
int g0/0/0
ip add 25.0.0.2 24

ospf 1 router-id 5.5.5.5
area 1
net 25.0.0.2 0.0.0.0
stub no-summary

R6配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
sys
sys R6
int g0/0/0
ip add 46.0.0.2 24
int g0/0/1
ip add 67.0.0.1 24

# 设置策略
acl 2000
rule 1 permit source 67.0.0.0 0.0.0.255
route-policy wuchao permit node 10
if-match acl 2000
ospf 1 router-id 6.6.6.6
import-route direct route-policy wuchao
area 2
net 46.0.0.2 0.0.0.0
# 设置NSSA区域
nssa no-summary

R7配置

1
2
3
4
5
sys
sys R7
int g0/0/0
ip add 67.0.0.2 24
ip route-static 0.0.0.0 0.0.0.0 67.0.0.1

R8配置

1
2
3
4
5
6
7
8
sys
sys R8
int g0/0/0
ip add 38.0.0.2 24

ospf router-id 8.8.8.8
area 3
net 38.0.0.2 0.0.0.0

验证

未设置特殊区域前的LSDB

  1. area 0中LSDB

    alt area 0中LSDB

  2. area 1区域ABR路由器的LSDB

    alt area 1区域ABR路由器的LSDB

  3. area 2区域ABR路由器的LSDB

    alt area 1区域ABR路由器的LSDB

  4. area 3区域ABR路由器的LSDB

    alt area 1区域ABR路由器的LSDB

将area1设置成Stub区域

  1. 设置之前

    alt area1设置成Stub区域之前

  2. 设置之后

    alt area1设置成Stub区域

将area2设置成NSSA区域

alt 将area2设置成NSSA区域

总结

  1. 配置Totally NSSA的时候,需要ABR与末节路由器走配置NSSA no-summary

实验2

实验要求

alt 实验要求

拓扑

alt 实验2拓扑

配置

RTA配置

1
2
3
4
5
6
7
8
9
10
11
sys
sys RTA
int g0/0/0
ip add 10.1.123.1 30
int g0/0/1
ip add 10.1.123.5 30
ospf 1 router-id 1.1.1.1
# 引入外部路由的时候使用类型1,计算AS内部的Cost
import-route direct type 1
area 0
net 10.1.123.0 0.0.0.7

RTB配置

1
2
3
4
5
6
7
8
9
10
11
12
13
sys
sys RTB
int g0/0/0
ip add 10.1.123.2 30
int g0/0/1
ip add 10.1.24.1 24
ospf 1 router-id 2.2.2.2
area 0
net 10.1.123.0 0.0.0.3
area 1
net 10.1.24.0 0.0.0.255
# 设置NSSA区域 节省设备资源
nass no-summary

RTC配置

1
2
3
4
5
6
7
8
9
10
11
12
13
sys
sys RTC
int g0/0/0
ip add 10.1.123.6 30
int g0/0/1
ip add 10.1.35.1 24
ospf 1 router-id 3.3.3.3
area 0
net 10.1.123.4 0.0.0.3
area 2
net 10.1.35.0 0.0.0.255
# 配置虚链路实现与办事处的通信
vlink-peer 5.5.5.5

RTD配置

1
2
3
4
5
6
7
8
9
sys
sys RTD
int g0/0/0
ip add 10.1.24.2 24
ospf 1 router-id 4.4.4.4
area 1
net 10.1.24.0 0.0.0.255
# 设置NSSA区域节省设备资源
nass no-summary

RTE配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
sys
sys RTE
int g0/0/0
ip add 10.1.35.2 24
int g0/0/1
ip add 10.1.56.1 24
ospf 1 router-id 5.5.5.5
area 2
net 10.1.35.0 0.0.0.255
vlink-peer 3.3.3.3
area 3
net 10.1.56.0 0.0.0.255
# 设置认证模式 保证通信安全
authentication-mode md5 1 plain wu110119

RTF配置

1
2
3
4
5
6
7
8
9
sys
sys RTF
int g0/0/0
ip add 10.1.56.2 24
ospf 1 router-id 6.6.6.6
area 3
net 10.1.56.0 0.0.0.255
# 设置认证模式 保证通信安全
authentication-mode md5 1 plain wu110119

验证

实现与办事处C通信(area 2建立虚连接)

alt 实现与办事处C通信(area 2建立虚连接)

节省分公司A的设备资源(设置NSSA区域)

alt 节省分公司A的设备资源

保证办事处C的路由交互安全(设置认证模式)

alt 保证办事处C的路由交互安全

RTA引入外部路由考虑OSPF域内开销(设置引入类型为1)

alt RTA引入外部路由考虑OSPF域内开销

总结

吴超 wechat
subscribe to my blog by scanning my public wechat account