SPF是,主要是interface状态:ip address,mask,Hello这些信息在Routers间建立adjency的过程中会通过LSAs被互换,下面是YJBYS小编整理的OSPF的network设置相关知识,欢迎阅读参考!
我们再看看OSPF执行时的过程:(简单举例)
int s1
ip add ()
int s2
ip add ()
int s3
ip add ()
int s4
ip add ()
route ospf 10
network area 0
network area 0
当进入OSPF 10,OSPF首先执行network ,查找interface address,有匹配s0,分配至Area 0,然后再执行network aera 0,匹配s2->Area 0,最后我们在其它Routers上看到的信息是:
is subnetted, 1 subnets
O [110/128] via , 00:00:00, Serialx
is subnetted, 1 subnets
O [110/74] via , 00:00:05, Serialx
在着里可以看到submask是24,忽略了在network中配制的inverse mask,为什么?
我们再看当添加新的network后有什么结果?
route ospf 10
network area 0
network area 0
network area 1
network area 2
show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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 not set
O IA [110/933] via , 00:00:05, Serialx
O IA [110/933] via , 00:00:02, Serialx
is subnetted, 1 subnets
O [110/128] via , 00:00:10, Serialx
is subnetted, 1 subnets
O [110/74] via , 00:00:05, Serialx
这里s3,s4都在Area 1(被标记为IA掩码16)。
总结:实际的网络范围在interface mask中已经说明了,这在所有的Routers的'Link state database 被清楚标记,不会因OSPF的network配置而发生改变。而在OSPF的network配置中,inverse mask只是起到指明在本Router的OSPF process 中的网络范围的作用,如network 指定范围从 ~ ,在次范围中的所有interface分配至Area 1,最后其他所有的地址被分配到Area 2.
如果在Stub Area 中,没有Loopback interface的情况下,甚至可以简单配制为
router ospf 20
network area x
这样就不用单独指定网络范围了。
在其它类型中,推荐配置使用interface ip address,即精确匹配,以防止错误发生。如:
network area 0