一、sub Area特点
1.过滤4类和5类路由,但如果这样外部路由就会不可达(R4流量到不了R5),这时的解决方法是,配置了sub的区域,ABR(R2)会自动生成默认路由并下发
注意:Hello包必须匹配才能建立邻接:hello间隔周期、区域号、认证、stub号
2.stub区域内的所有路由器都要配置stub
3.stub区域内不能出现ASBR
4.area 0不能配置为sub区域
5.配置为stub的区域不能再外挂区域(此区域未与area 0区域直接相连)
二、Totally stub area
通过R4上可以看出,配置为stub区域后,ABR自动生成一条默认路由下发给了R4,如果有了这条默认路由,上面4条O IA路由(通过3类LSA传过来)就没用了,这时就用到了totally stub area
配置:只需在sutb区域基础上,在ABR上添加一条命令:R2(config-router)#area 1 stub no-summary
totally stub area作用:
1.过滤3、4、5类LSA
R4#sh ip route ospf
O*IA 0.0.0.0/0 [110/65] via 24.1.1.2, 00:00:15, Serial2/0
现在R4上只有这条默认路由了
三、Not-So-Stubby Areas(NSSA)
1.NSSA作用:过滤4类和5类
2.Stub区域中不能存在ASBR,但NSSA区域中可以存在ASBR
3.NSSA中存在7类LSA
a.如果在area 2中做了NSSA,rip重分布进来是通过5类LSA,而NSSA区域是过滤4类和5类的,这样R4、R2就收不到rip路由信息,这样才产生了7类LSA,让重发布进来的外部路由能进来,NSSA更多应用场景是类似上面拓扑,俩边都有外部路由重发布进来
b.7类LSA其实相当于5类LSA,从R3进来形成7类LSA,到R1再由7类LSA转变为5类LSA
4.配置完NSSA区域后不会像stub区域一样会自动形成一条默认路由,需要手动去配置
R1(config-router)#area 2 nssa default-information-originate
此时R3路由表如下:
R3#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 13.1.1.1 to network 0.0.0.0
1.0.0.0/32 is subnetted, 1 subnets
O IA 1.1.1.1 [110/65] via 13.1.1.1, 00:03:27, Serial2/1
35.0.0.0/24 is subnetted, 1 subnets
C 35.1.1.0 is directly connected, Serial2/0
2.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/129] via 13.1.1.1, 00:03:27, Serial2/1
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
4.0.0.0/32 is subnetted, 1 subnets
O IA 4.4.4.4 [110/193] via 13.1.1.1, 00:03:27, Serial2/1
5.0.0.0/24 is subnetted, 1 subnets
R 5.5.5.0 [120/1] via 35.1.1.5, 00:00:06, Serial2/0
24.0.0.0/24 is subnetted, 1 subnets
O IA 24.1.1.0 [110/192] via 13.1.1.1, 00:03:29, Serial2/1
12.0.0.0/24 is subnetted, 1 subnets
O IA 12.1.1.0 [110/128] via 13.1.1.1, 00:03:29, Serial2/1
13.0.0.0/24 is subnetted, 1 subnets
C 13.1.1.0 is directly connected, Serial2/1
O*N2 0.0.0.0/0 [110/1] via 13.1.1.1, 00:00:22, Serial2/1
5.总结
需要注意的是,只用NSSA的时候不会自动产生默认路由,如果使用Totally NSSA后,会自动产生默认路由
6.如果从R1再重分布进来RIP,网段为100.1.1.1/24,此时,R4收到的为5类路由,R3收到的为7类路由,但R3已经收到了R1给他的一条默认路由,7类是无用的,这时就需要将7类过滤掉
R1(config-router)# area 2 nssa no-redistribution no-summary
7.no-redistribution 用来过滤5、7类LSA,no-summary用来过滤3类LSA
四、不规则区域及解决方案
1.远离area 0的区域
2.分隔的区域
解决方案:
1.多进程双向重分布
在R3上将两个接口分别宣告进不同OSPF进程,然后将不同进行宣告进对方进程即可
2.Tunnel
此方法的思想是打通一个隧道将area 3与area 0 逻辑上直连,在R1和R3分别配置
配置R1:
interface Tunnel1
ip address 172.16.1.1 255.255.255.0
tunnel source 13.1.1.1
tunnel destination 13.1.1.3
router ospf 110
router-id 1.1.1.1
log-adjacency-changes
network 1.1.1.0 0.0.0.255 area 0
network 12.1.1.0 0.0.0.255 area 0
network 13.1.1.0 0.0.0.255 area 2
network 172.16.1.0 0.0.0.255 area 0
配置R3:
interface Tunnel3
ip address 172.16.1.3 255.255.255.0
tunnel source 13.1.1.3
tunnel destination 13.1.1.1
router ospf 110
router-id 3.3.3.3
log-adjacency-changes
network 3.3.3.0 0.0.0.255 area 2
network 13.1.1.0 0.0.0.255 area 2
network 35.1.1.0 0.0.0.255 area 3
network 172.16.1.0 0.0.0.255 area 0
3.虚链路
穿越area 2做一条虚链路
配置如下:
R1
router ospf 110
router-id 1.1.1.1
log-adjacency-changes
area 2 virtual-link 3.3.3.3
network 1.1.1.0 0.0.0.255 area 0
network 12.1.1.0 0.0.0.255 area 0
network 13.1.1.0 0.0.0.255 area 2
network 172.16.1.0 0.0.0.255 area 0
R2:
router ospf 110
router-id 3.3.3.3
log-adjacency-changes
area 2 virtual-link 1.1.1.1
network 3.3.3.0 0.0.0.255 area 2
network 13.1.1.0 0.0.0.255 area 2
network 35.1.1.0 0.0.0.255 area 3
network 172.16.1.0 0.0.0.255 area 0
五、OSPF认证
1.认证分类:
链路认证、区域认证、虚链路认证
2.链路认证:
明文秘钥认证命令:
R1(config-if)#ip ospf authentication-key swc
R1(config-if)#ip ospf authentication
密文秘钥命令:
R1(config-if)#ip ospf message-digest-key 1 md5 swc
R1(config-if)#ip ospf authentication message-digest
3.区域认证:
明文认证命令:
R1(config-if)#ip ospf authentication-key swc
R1(config)#router ospf 110
R1(config-router)#area 1 authentication
密文认证命令:
R1(config-if)#ip ospf message-digest-key 1 md5 swc
R1(config)#router ospf 110
R1(config-router)#area 1 authentication message-digest
4.虚链路认证:
明文认证命令:
R3(config-router)#area 2 virtual-link 1.1.1.1 authentication-key swc
R3(config-router)#area 2 virtual-link 1.1.1.1 authentication
密文认证命令:
R3(config-router)#area 2 virtual-link 1.1.1.1 message-digest-key 1 md5 swc
R3(config-router)#area 2 virtual-link 1.1.1.1 authentication message-digest
总结:
六、OSPF被动接口
例如环回口不需要他更新hello流量
R3(config-router)#passive-interface loopback 0