Chinaunix首页 | 论坛 | 博客
  • 博客访问: 509111
  • 博文数量: 694
  • 博客积分: 40000
  • 博客等级: 大将
  • 技术积分: 4840
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-16 19:30
文章分类

全部博文(694)

文章存档

2011年(1)

2008年(693)

我的朋友

分类:

2008-10-16 19:32:47


  OSPF综述及其配置(5)
  
  Changing the Cost Metric
  默认情况下,根据100Mbps/bandwidth来计算metric,比如64Kbps链路的metric约为1562,T1的为64,100Mbps的链路为1.当链路速率大于100Mbps的时候,应该在OSPF进程下使用如下命令:
  RouterA(config-router)#auto-cost reference-bandwidth
  
  在接口自定义cost的命令如下:
  RouterA(config-if)#ip ospf cost [value]
  这条命令将使得超越默认的cost计算,具有更高的优先权.value范围为1到65535.值越低,就越优先采用该接口
  
  OSPF Route Summarization Concepts
  OSPF路由汇总可以减少路由表条目,减少类型3和类型5的LSA的洪泛,节约带宽资源和减轻路由器CPU负载,还能够对拓扑的变化本地化
  
  OSPF路由汇总的两种类型如下:
  1.inter-area(IA) route summarization:发生在ABR上
  2.external route summarization:发生在ASBR上
  
  Configuring Route Summarization
  因为OSPF是基于无类的路由,它不会进行自动汇总.手动在ABR上做IA route summarization的命令如下:
  Router(config-router)#area [area-id] range [address] [mask]
  在ASBR上做external route summarization的命令如下:
  Router(config-router)#summary-address [address] [mask] [not-advertise] [tag tag]
  
  如下图就是一个ASBR上的external route summarization的例子:
  
   
  R1(config-router)#network 172.16.64.1 0.0.0.0 area 1
  R1(config-router)#summary-address 172.16.32.0 255.255.224.0
  
  Default Routes in OSPF
  OSPF路由器默认不会产生默认路由到一般性的area里,但是可以通过相关命令启用默认路由.默认路由作为LSA类型5出现在LSDB中
  
  创建OSPF默认路由的命令如下:
  Router(config-router)#default-information originate [always] [metric value] [metric-type type-value] [route-map map-name]
  参数always是不管路由表里是否存在默认路由,都会宣告一条默认路由0.0.0.0
  metric value是指定默认路由的metric,默认为10
  type-value可以为1或者2.1为O E1,2为O E2,默认是2
  route-map map-name是如果满足route map的话就产生默认路由
  
  实例如下图:
  
   
  R1(config)#router ospf 100
  R1(config-router)#netw 10.1.1.1 0.0.0.0 area 0
  R1(config-router)#default-information originate metric 10
  R2(config)#router ospf 100
  R2(config-router)#netw 10.2.1.1 0.0.0.0 area 0
  R2(config-router)#default-information originate metric 100
  
  Types of OSPF Areas
  一些OSPF area的类型如下:
  1.standard area:接收链路更新,路由汇总和外部路由
  2.backbone area(transit area):标记为area 0,拥有standard area的一切属性
  3.stub area:不可以包含ASBR.不接收外部路由信息(LSA类型5),如果要到达外部AS的话就使用标记为0.0.0.0的默认路由.好处是可以减少路由表的条目.stub area没有虚链路(virtual link)穿越它们
  4.totally stubby area:私有,不接收外部路由信息和路由汇总信息(LSA类型3,4和5).不可以包含ASBR.如果要到达外部AS的话就使用标记为0.0.0.0的默认路由.好处是最小化路由表条目
  5.not-so-stubby area(NSSA):NSSA是OSPF RFC的补遗.定义了特殊的LSA类型7.提供类似stub area和totally stubby area的优点,可以包含的有ASBR
  
  Stub Area Configuration
  stub area的配置命令如下:
  RouterA(config-router)#area [area-id] stub
  所有在stub area里的路由器必须都使用stub命令,例子如下图:
   
  R3(config)#router ospf 100
  R3(config-router)#netw 192.168.14.0 0.0.0.255 area 0
  R3(config-router)#netw 192.168.15.0 0.0.0.255 area 2
  R3(config-router)#area 2 stub
  R4(config)#router ospf 10
  R4(config-router)#netw 192.168.15.0 0.0.0.255 area 2
  R4(config-router)#area 2 stub
  如上是把area 2配置为stub area,R3做为ABR自动向area 2(stub area)宣告一条metric为1的默认路由0.0.0.0
  
  Totally Stubby Area Configuration
  totally stubby area的配置命令如下:
  RouterA(config-router)#area [area-id] stub no-summary
  ABR默认宣告一条metric为1的默认路由到totally stubby area,修改这个metric的命令如下:
  RouterA(config-router)# area [area-id] default-cost [cost]
  
  配置实例如下图:
   
  R3(config)#router ospf 100
  R3(config-router)#netw 130.130.0.0 0.0.255.255 area 1
  R3(config-router)#area 1 stub
  R4(config)#router ospf 50
  R4(config-router)#netw 130.130.0.0 0.0.255.255 area 1
  R4(config-router)#netw 130.135.0.0 0.0.255.255 area 0
  R4(config-router)#area 1 stub no-summary
  R4(config-router)#area 1 default-cost 10
  R4(config)#router ospf 50
  R2(config-router)#netw 130.130.0.0 0.0.255.255 area 1
  R2(config-router)#netw 130.135.0.0 0.0.255.255 area 0
  R2(config-router)#area 1 stub no-summary
  R2(config-router)#area 1 default-cost 5
  如上,默认路由将选用R2上的,因为R2的metric更低
  
  Not-So-Stubby Areas
  之前说过stub area和totally stub area不可以包含的有ASBR,但是假如你想使用ASBR,又想使其具有stub area和totally stub area的优点(减少路由表条目)的话,就可以采用NSSA,如下图:
   
  RIP经过再发布(redistribution)到NSSA以后,NSSA的ASBR将产生只存在于NSSA中的LSA类型7,然后ABR将LSA类型7转换成LSA类型5
  
  NSSA的配置命令为在OSPF进程下使用area [area-id] nssa,所有位于NSSA里的路由器都要使用这条命令.如下图是配置实例:
   
  R2(config)#router ospf 100
  R2(config-router)#summary-address 150.150.0.0 255.255.0.0
  R2(config-router)#netw 130.130.20.0 0.0.0.255 area 1
  R2(config-router)#netw 130.130.0.0 0.0.255.255 area 0
  R2(config-router)#area 1 nssa default-information-originate
  使用default-information-originate参数创建一条area 0到NSSA的默认路由.并且类型5的LSA将不会进入NSSA(类似stub area)
  R1(config)#router ospf 100
  R1(config-router)#redistribute rip subnets
  R1(config-router)#default metric 150
  R1(config-router)#netw 130.130.0.0 0.0.255.255 area 1
  R1(config-router)#area 1 nssa
  
  还可以将NSSA配置成具有totally-stub的特性,如下:
  R1(config)#router ospf 100
  R1(config-router)#redistribute rip subnets
  R1(config-router)#default metric 150
  R1(config-router)#netw 130.130.0.0 0.0.255.255 area 1
  R1(config-router)#area 1 nssa
  R2(config)#router ospf 100
  R2(config-router)#summary-address 150.150.0.0 255.255.0.0
  R2(config-router)#netw 130.130.20.0 0.0.0.255 area 1
  R2(config-router)#netw 130.130.0.0 0.0.255.255 area 0
  R2(config-router)#area 1 nssa no-summary
  这样类型3,4和5的LSA将不会进入NSSA,no-summary参数只应用在ABR上就可以了,NSSA里的其他路由器只需使用area 1 nssa
  
  The show Commands for Stub and NSSA
  
  一些验证性命令如下:
  show ip ospf:显示area类型
  show ip ospf database:显示LSA类型7
  show ip ospf database nssa-external:显示LSDB中每条类型7的LSA的信息
  show ip route:显示标记为O N1/N2的NSSA路由条目(默认为O N2)
  
  Defining an OSPF Virtual Link
  
  在OSPF里所有的area都要和area 0相连,但是假如某个区域没有和area 0相连的话,就可以采用虚链路来连接它们,如下图:
   
  虚链路一般是做为备份连接或者是临时连接
  
  虚链路的配置命令如下:
  Router(config-router)#area [area-id] virtual-link [RID]
  一些其他可选参数如下:
  authentication [message-digest|null]:指定验证方式为MD5加密还是明文口令
  hello-intervals [second]:定义hello包发送时间间隔,默认为10秒
  配置实例如下图:
  
  R2(config)#router ospf 100
  R2(config-router)#netw 10.3.0.0 0.0.0.255 area 1
  R2(config-router)#netw 10.7.0.0 0.0.0.255 area 3
【责编:admin】

--------------------next---------------------

阅读(210) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~