免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1113 | 回复: 0
打印 上一主题 下一主题

关于OSPF的network配置 [复制链接]

论坛徽章:
2
丑牛
日期:2013-09-29 09:47:222015七夕节徽章
日期:2015-08-21 11:06:17
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-05-21 16:39 |只看该作者 |倒序浏览

OSPF是link state protocol,主要是interface状态(如ip address,mask,Hello time....)这些信息在
  
  Routers间建立adjency的过程中会通过LSAs被互换,直到同Area收敛,所有Routers有同样的link state database,然后以自己为根(root)建立SPF tree,最后在根据SPF计算出route table.Are
a内任何一个interface的变化都会被Update.
  
  我们再看看OSPF执行时的过程:(简单举例)
  
  int s1
  ip add 10.1.1.1 255.255.255.0 (10.1.1.1/24)
  
  int s2
  ip add 172.2.0.1 255.255.255.0 (172.2.0.1/24)
  
  int s3
  ip add 172.3.0.1 255.255.0.0 (172.3.0.1/16)
  
  int s4
  ip add 172.4.0.1 255.255.0.0 (172.4.0.1/16)
  
  route ospf 10
  network 10.1.1.1 0.0.0.0 area 0
  network 172.2.0.0 0.0.255.255 area 0
  
  当进入OSPF 10,OSPF首先执行network 10.1.1.1 0.0.0.0,查找interface address,有匹配s0,分配至Area 0,然后再执行network 172.2.0.0.0.0.255.255 aera 0,匹配s2->Area 0,最后我们在其它Routers上看到的信息是:
  
  172.16.0.0/24 is subnetted, 1 subnets
  O 172.16.0.0 [110/128] via 192.168.0.1, 00:00:00, Serialx
  10.0.0.0/24 is subnetted, 1 subnets
  O 10.1.1.0 [110/74] via 192.168.0.1, 00:00:05, Serialx
  
  在着里可以看到submask是24,忽略了在network中配制的inverse mask,为什么?
  
  我们再看当添加新的network后有什么结果?
  route ospf 10
  network 10.1.1.1 0.0.0.0 area 0
  network 172.2.0.0 0.0.255.255 area 0
  network 172.0.0.0 0.255.255.255 area 1
  network 0.0.0.0 0.0.0.0 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 172.3.0.0/16 [110/933] via 192.168.0.1, 00:00:05, Serialx
  O IA 172.4.0.0/16 [110/933] via 192.168.0.1, 00:00:02, Serialx
  172.16.0.0/24 is subnetted, 1 subnets
  O 172.16.0.0 [110/128] via 192.168.0.1, 00:00:10, Serialx
  10.0.0.0/24 is subnetted, 1 subnets
  O 10.1.1.0 [110/74] via 192.168.0.1, 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 172.0.0.0 0.255.255.255指定范围从172.0.0.0 ~ 172.255.255.255,在次范围中的所有interface分配至Area 1,最后其他所有的地址被分配到Area 2。
  
  如果在Stub Area 中,没有Loopback interface的情况下,甚至可以简单配制为
  
  router ospf 20
  network 0.0.0.0 255.255.255.255 area x
  
  这样就不用单独指定网络范围了。
  
  在其它类型中,推荐配置使用interface ip address,0.0.0.0即精确匹配,以防止错误发生。如:
  
  network 10.1.1.1 0.0.0.0 area 0


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/4206/showart_697536.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP