学习报告之OSPF详解(一)03-09

OSPF详解(一)

一、OSPF的五种包

Hellow:发现邻居建立邻接关系
DBD:检查路由器的数据库之间是否同步
LSR:向另外一台设备请求特定的链路状态
LSU:发送链路状态信息
LSACK:确认多段的发送信息

二、OSPF的三张表

  1. 邻居列表:列出每台路由器全部已经建立邻接关系的邻居路由器
  2. 链路状态数据库:列出网络中其他路由器的信息,由此显示了全网的网络拓扑
  3. 路由表:列出通过SPF算法计算出到达每个相连网络的最佳路径

三、OSPF的特点

  1. 区域概念,有效减少路由条目对CPU和内存占用,将拓扑变动局限在本区域内,详细的LSA泛洪控制
  2. 邻接关系。OSPF协议定义了一些路由器类型和网络类型,邻接关系的建立是有交换Hellow信息的路由器类型和交换Hellow信息的网络类型决定的
  3. 每台收到从邻居路由器发出的LSA的路由器都会把这些LSA记录在它的LSDB中,并且发送一份LSA拷贝给这台路由器其他所有邻居。
  4. 当这些路由器LSDB完全相同时,就以自身为根,使用SPF算法计算一条无环的最短路径拓扑图。从而构建自己的路由表。

四、OSPF的hello协议

  1. Hellow的作用,发现邻居,keepalive, 协商参数,确保2WAY,选举DR。
  2. 如果在4倍的hello interval中没有收到邻居的hello包,这个邻居就会被宣告无效,这个时间是dead-interval.
  3. Hello包所包含的信息如下:红色不匹配可能无法建立邻接关系(很重要)
    1) 源路由器的RID
    2) 源路由器的area-ID
    3) 源路由器接口地址和掩码
    4) 源路由器接口的认证类型和相关信息●源路由器接口的hello, dead等时间间隔●路由器的优先级●DR&BDR
    5) 五个标记位(可选)
    6) 源路由器所有有效邻居的RID
  4. 如果源路由器的RID在接受该hello数据包的接口邻居表中列出,那么dead-interval就会被重置,如果始发路由器的RID没有在列表中,那么就把这个RID加入到它的邻居表中
  5. 路由器发送一个hello数据包时,就会在这个数据包中列出在传送该数据包的链路上所有的邻居路由器的RID。
  6. 邻接关系的建立依赖邻居路由器之间所连接的网络类型,网络类型影响OSPF数据包的传送方式。

五、OSPF的网络类型

  1. 点到点: DA 224. 0. 0. 5(即使设置nei ghbor也组播更新),一对路由器形成邻接关系。无DR,每个子接口属于不同IP子网。
  2. 点到多点: DA: 224. 0.0. 5 (即使设置neighbor也组播更新),无DR,同一个IP子网。Ptp和ptmp无法形成邻居(在PTMP中hello-interval 30 dead -interval 120)
  3. 点到多点非广播: DA: 单播,无DR, 同一IP子网。
  4. NBMA: DA:单播,选DR (DR和BDR必须与其他所有路由器直接相连),同- -IP子网。全互联或部分互联。
  5. 广播:选举DR,所有路由器发信息到224.0.0.6 (DR监听这地址),然后DR发送信息到224.0.0.5,DR与所有路由器建立邻接关系,所有路由器之间到2way状态(即使设置neighbor也组播更新)。
  6. 同一IP子网,全互联或部分互联。
  7. 特点总结:
    1)点家族都不用选举DR和BDR
    2)多路访问都需要选举DR和BDR
    3)非广播都要手动指定邻居,非广播都是单播更新
    4)neighbor命令后指定的cost只有在非广播下才有效
    5)0SPF只用接口的第一IP地址建立邻居和形成邻接

六、DR/BDR的选举规则

  1. 每个多路访问接口都有一个优先级(0-255) ,优先级为0的路由器不具有选举权利,这个优先级默认为1,优先级越大越优先。通过命令ip ospf priority来修改。
  2. hello包里包含优先级字段,还包含了可能成为DR/BDR相关接口的IP地址。
  3. 当接口在多路访问网络上初次启动时候,它吧DR/BDR设置为0.0.0.0,同时设置等待计时器(wait timer) ,等待计时器等于dead- interval (更改he 10间隔死亡和等待计时器都会相应改变,更改死亡间隔等待计时器改变,但hel lo间隔不变)
  4. DR和BDR的选举:
    1)邻居表中的邻居2way以后,检查邻居hello中的priority, DR/BDR字段,列出所有可以参加DR/BDR选举的邻居,所有的邻居都宣称自己是DR/BDR (DR/BDR都是自已接口地址)
    2)在这个列表中创建一个 没有宣称自己是DR的子集,因为宣称为DR的不能被选举为BDR。
    3)在这子集中,先比优先级然后比RID,高的成为BDR。
    4)在所有宜称自己的为DR的hello中选举DR,先比优先级再比RID,高的为DR。
    5)如果没有人宣称自己为DR那么在步骤3中选举的BDR成为DR。 (稳定后DR/BDR不能抢占)
  5. DR和BDR选举需注意的事项:
    1)多路访问网络中每个路由器都会与DR和BDR同时形成邻接关系,其他路由器之间只是2WAY关系。DR和BDR之间也形成邻接关系。
    2)DR和BDR是路由器接口的特性,并不是整个路由器的特性。
    3)DR和BDR信息被存放在接口数据结构表中。
    4)DR/BDR不能抢占,也就是在一个多路访问网络中先初始化启动的路由器可能成为DR/BDR
    5)邻居表2way后,并不是马上选举DR/BDR而是等待一个定时器(wait time) ,超时后才进行选举。在wait时间内等待其他邻居给我通告DR/BDR信息。Wait时间内就收发he1lo。

七、OSPF的度量值

  1. (参考带宽要在所有0SPF路由器修改。否则带宽计算不一致)
  2. COST(1-65535) :从发送端到目的地出方向的代价之和。Ip ospf cost
  3. 思科计算度量方法为: 108/BW (不能为小于1的数,小于都为1)例如: 108/1544Kbit=64修改参考带宽:如果接口带宽大于10的8次方,那么都为1。
  4. 为了避免这种情况。Auto-cost reference-bandwidth ( 1-4296967) 默认为100(也就是10的8次方)

八、OSPF的接口

  1. 链路状态协议的基本要点是它涉及到了路由器之间的链路状态和那些链路的状态,路由器是通过接口信息来了解链路信息,在同一个区域内OSPF所实现的完整的SPF计算,区域间进行是是部分SPF计算,因为ABR通告的345类LSA并没有链路状态信息。路由器并无法计算完整的链路状态信息,所以OSPF区域内为链路状态特性,区域间有距离矢量特性。

九、OSPF的接口数据结构

  1. processID:cisco私有特性, 可以在同一个路由器开启多个路由器进程(最大30个进程),路由进程本地有效。如果一个接口在多个进程中宣告,随机一个进程与邻居建立关系。Router-ID:因为0SPF要对其他0SPF路由器跟踪,所以每个0SPF路由器需要一“个RID, RID在同一个区域内唯一的标志一台路由器。
    1)可以使用router-id来指定这个参数。
    2)如果没有指定就选择环回口最大的一个
    3)如果没有配置环回口IP就在物理接口中选-一个IP地址最大的。
    4)如果路由器的物理接口DOWN或删除也继续使用这个地址用作RID。除非重启路由进程。
  2. InfTransDelay:LSA从路由器的接口发送后经历的时间,缺省1S。Ip ospf transmi t-delayLSA传播每经过-一个接口就加1S传播延迟,LSA的存活时间就减1S。计算LSA存活时间用。
  3. RxmtInterval:在没有收到确认情况下,路由器重传0SPF数据包将要等待的时间长度。默认为5S,可以更改ip ospf retransmit- interval
  4. Hello-timer:此值有hello- interval指定,比如为10,那么这个计时器从10递减,为0时候就发出一个hello包给邻居。:
  5. Nei ghboring routers: 和这个接口相连的有效邻居(在dead间隔内可以收到hello)的列表。 Neighbor count数为2way的邻居数,adjacent nei ghbor为full邻接关系的数量。

十、OSPF的邻居

  1. 邻接关系的建立都是靠hello来完成的,hello包是每经过一个hello-interval发送一 次,但是在NBMA网络中,路由器每经过pollinterval发送-次给down的邻居(在非广播的网络中是不会给DOWN的邻居发送hello的)。cisco路 由器上pollinterval默认为60S。0SPF的邻居数据结构

十一、OSPF的邻居数据结构

  1. Pollinterval:只用于NBMA网络上的邻居路由器。因为在NBMA网络中无法自动发现邻居,如果邻居是DOWN的,路由器将每经过Pollinterval的时间就发送一个Hel 1o给DOWN的邻居。
  2. Master/Slave:在ExStart状态下,邻居会协商主从来同步LSDB。
  3. DD sequence number: 正在向邻居发送的数据库描述序列号。
  4. Last received database descript ion packet:这个数据包记录了initialize位、 more位、master/slave位和可选项,以及最后收到的数据库描述数据包的序列号,这可以确定下一个数据库描述数据包是否重复。
  5. Link state retransmission list:没有得到确认的LSA列表。
  6. Databasesummarylist:数据库同步期间,数据库描述数据包中向邻居路由器发送的LSA列表,当进入到exchange状态时,这些LSA会构成LSDB。
  7. Link state request list :记录了来自邻居的LSA,这些LSA要比本地LSDB中的新,LSR发送给邻居这些LSA的拷贝,当回收到最新的LSA后这个列表就会减小直至为空。

十二、OSPF邻居的有限状态机

  1. down:初始状态,没有收到来自邻居的hello包,在NBMA网络中pollinterval时间发送一次he1lo给邻居。
  2. attempt:只用于NBMA网络,邻居有效(收到邻居的hello)后,hellointerval取代pollinterval来发送hello包。
  3. init: (收到了来自邻居的he1lo)标识着自身邻居表创立完成。
  4. 2way: (在邻居的hello包中看见了自己的RID)多路访问网络选取DR/BDR才能往下进行,其他网络无条件往下继续。标识着邻居的邻居表建立完成。
  5. exstart: (协商主从后才能往下进行) RID大的为master,确定DBD的序列号。主先发DBD,从后发DBD。
  6. exchange:交换DBD,也向邻居发送LSR来请求新的LSA。 DBD交换完。
  7. loading:发送LSR请求最新LSA,收到新的LSA,对比LSA的序列号(如果LSDB相同往下)
  8. full:完全邻接。同步完成计算最短路径,加载入路由表。

十三、导致邻接关系建立不起来的可能原因

  1. 卡在EDOWN,网络类型与二层网络类型条件不匹配、有ACL阻挡、he1lo和dead时间不-一致、区域ID不-致、认证错误、特殊区域类型不一-致、RID相同。
  2. 卡在2way,多路访问网络不能选举DR/ BDR,就是priority 都为0。
  3. 卡在exstart,链路两端MTU设置不同,二层MTU,三层MTU。 可以ip ospf mtu-i gnore忽略. 卡在exchange, 11. 0和12.3IOS的LSA格式不兼容。
  4. 建立一一个邻接关系
    1)在邻接关系建立过程中0SPF需要使用3种类型的数据包LSR/LSU/DBD。
    2)DBD数据包非常重要,它携带了源路由器LSDB中的所有LSA的描述信息(头部)。这些信息可以让路由器判定LSDB中LSA是否最新,是否完整。
    3)DBD数据包中有3个重要位I (initial)位M(more)位MS (master/slave)位
    a) I位:置1说明发送的是第一个DBD包。
    b) M位:置1说明发送的不是最后一个DBD包。
    c) M/S位:置1说明源路由器为主,0为从。
    4)更新数据包传送的所有LSA必须单独进行确认,确认后从链路状态重传列表删除它们。
    a) 显式确认:回送发送-一个LSAck来确认收到那个LSA包。
    b) 急式确认:回送包含那个LSA拷贝信息的更新数据包。
    5)主路由器控制着数据库的同步过程。
    6)由于从路由器必须确认每个收到的DBD数据包,因此从路由器总是最先得知同步完成。

十四、OSPF-LSA泛洪

  1. 每个LSU和LSAck都可以包含多个LSA, LSA的发送是可靠的,所以必须对每个LSA进行确认,显式确认和隐式确认。
  2. router发送一- 个LSA时,会把这个LSA拷贝放进链路状态重传列表。每隔rxmt interval时间重传一次,直到收到ACK
  3. 延时确认,多个LSA通告可以用一一个LSAck确认。广播链路上来自多个Router的LSA可以通过一. 个组播LSAck确认。
  4. 直接确认,立即发送并且单播确认。两种情况产生: 1收到重复的LSA, 2LSA老化时间达到最大生存时间。
  5. 序列号,当maxsequencenumber时候, 源路由器扩散这个提前老化LSA, 重新在泛洪一一个initial sequencenumber包
  6. 校验和,校验除Age字段的整个包。LSDB中 的LSA每5分钟校验一-次。
  7. 老化时间(0-3600S) 当-台路由器想把LSA删除,就会设置LSA最大生存时间。只有源路由器才能将LSA老化。
  8. 收到相同的LSA如何判断哪个是最新的?1先比序列号,序列号大的为新。
    1)先比序列号,序列号大的为新。
    2)序列号相同,比校验和,有最大的无符号校验和的为新
    3)校验和相同,比老化时间,LSA有最大生存时间的老化时间它就是最新的LSA
    4)如果LSA老化时间的差别多于15m (MaxAgeDiff),那拥有较小老化时间的LSA是最新。
    5)如果还无法区分,那么LSA就是相同的。

十五、LSDB链路状态数据库

现实LSDB中基于区域和LSA分类的LSA统计信息
1、 LSA在LSDB中的老化时间是增大的,如果到1小时,就会从LSDB中清除,每30min- 次的LSRefreshT ime链路状态重刷新可解决。源路由器扩散一个此LSA的新拷贝(序列号加1),来重刷新。
2、 Router LSA(1类)show ip ospf database router
每台路由器都会产生,列出了路由器所有链路和接口,并指明了状态和出站代价。以及该链路上所有已知邻居,泛洪范围始发它们的area内部。LinkStateID来源 于RID.
3、 Network LSA (2类)show ip ospf database network
多路访问网络上DR产生,描绘多路访问网络和此网络上所有路由器,在始发area内泛洪。没有度量值字段(不同与上),因为LSA中表示伪节点到任何相连的路由器代价为0。LinkStateID来源于DR接口的Ipaddress。
4、 Summary LSA (3类)show ip ospf database summary
ABR始发,ABR发送一个3类到另-一个区域,这些LSA就是ABR告诉在与之相连的区域内的IR它所能到达其他area目的地的一种方法。它描述了域间通信的目的地址。ABR发3类时,将包括它本身到正在通告的这条LSA的目的地所耗费的代价,ABR有多条路由到达目的地是选代价最低的。当一台router收到3类,并不运行SPF算法,只是简单加上从它到ABR的路由代价(部分SPF计算)由于此LSA没有详细的链路状态信息,所以区域间是距离矢量特性。LinkStateID为目的网络号。
5、 ASBRsummaryLSA(4类)show ip ospf database asbr- summaryABR始发,通告的目的地址是一台ASBRrouter,目的地为主机地址,掩码为0,它是一条到达一台router的路由。有ASBR时才有。LinkStateID为ASBR的RID。
6、 AS external LSA(5类) show ip ospf database external
始发于ASBR,通告到达0SPF自主系统外部目的地。不具体与区域相关联的LSA,在整个0SPF中扩散。LinkStateID为外 部网络号。
7、 NSSAexternalLSA(7类) show ip ospf database nssa-external
始发与NSSA中的ASBR,几乎和5类相同,职业始发这个LSA的NSSA区域内泛洪,这些外部前缀发往其他区域ABR会将此7类转为5类,LinkStateID为外部网络号
1类、2类只在始发它们本区域泛洪,3类、4类、5类全OSPF选择域中泛洪,7类只在始发他的NSSA区域内泛洪。
8、 E-bit:始发路由器为ASBR时置1
9、 B-bit:始发路由器为ABR时置1

点赞
  1. Google Chrome Windows 10

    Thanks for the tips on credit repair on all of this blog. What I would advice people is to give up the mentality that they can buy now and pay later. As a society we tend to do this for many things. This includes vacations, furniture, and items we want. However, you need to separate your wants from all the needs. While you are working to improve your credit score you have to make some sacrifices. For example you can shop online to save money or you can go to second hand stores instead of expensive department stores for clothing.

  2. Google Chrome Windows 10

    Thanks for your whole work on this website. My niece takes pleasure in working on research and it is simple to grasp why. We all notice all relating to the powerful ways you render vital tricks via your website and therefore welcome response from website visitors on this topic while our own simple princess is without question understanding so much. Take pleasure in the rest of the year. Your performing a wonderful job.

  3. Google Chrome Windows 10

    Thanks for your own work on this website. My mother take interest in participating in research and it is simple to grasp why. My spouse and i notice all relating to the powerful way you provide valuable tips via your website and in addition recommend response from visitors on this subject matter while our own simple princess is undoubtedly studying so much. Take pleasure in the rest of the year. You have been performing a terrific job.

  4. Google Chrome Windows 10

    I precisely had to appreciate you all over again. I am not sure the things that I might have gone through in the absence of the entire opinions documented by you directly on such industry. It had become a real fearsome difficulty in my circumstances, however , finding out the skilled manner you managed that made me to jump over fulfillment. I am happier for this help and even hope you find out what a great job you are doing instructing other individuals through the use of your site. I know that you have never encountered all of us.

  5. order tofranil说道:
    Google Chrome Windows 10

    My spouse and i felt now fortunate that Ervin could conclude his investigation out of the ideas he got out of the web page. It's not at all simplistic to just choose to be giving freely information and facts that many other folks have been selling. And we all figure out we have the website owner to be grateful to for that. The entire explanations you have made, the simple site menu, the friendships you can give support to engender - it's got everything fabulous, and it's really facilitating our son and the family feel that the issue is enjoyable, and that is incredibly important. Thank you for all the pieces!

  6. Google Chrome Windows 10

    I am commenting to let you know of the fine encounter my cousin's daughter experienced checking your blog. She discovered a wide variety of details, most notably how it is like to have a marvelous coaching heart to get many more effortlessly fully understand certain complicated matters. You actually did more than my desires. I appreciate you for displaying such great, healthy, educational and also cool guidance on that topic to Evelyn.

  7. buy sinequan说道:
    Google Chrome Windows 10

    I precisely had to say thanks all over again. I'm not certain the things I could possibly have created in the absence of the actual hints discussed by you concerning such concern. It actually was a real difficult condition for me personally, but discovering a new professional fashion you handled it forced me to cry for delight. I'm grateful for the assistance and as well , have high hopes you comprehend what a powerful job you're carrying out educating men and women by way of your blog. I am certain you've never come across all of us.

  8. imipramine no rx说道:
    Google Chrome Windows 10

    My husband and i ended up being comfortable Albert could carry out his basic research by way of the ideas he acquired from your blog. It's not at all simplistic just to always be freely giving guidance many others could have been making money from. And now we already know we've got the blog owner to appreciate because of that. All of the explanations you've made, the easy blog menu, the friendships you aid to create - it's all astonishing, and it's aiding our son and our family believe that that article is awesome, and that's exceedingly essential. Many thanks for all!

  9. Google Chrome Windows 10

    I am only writing to make you understand what a terrific experience our princess undergone viewing yuor web blog. She picked up such a lot of things, with the inclusion of what it is like to possess an ideal teaching style to make the others without hassle thoroughly grasp specified tricky topics. You undoubtedly surpassed visitors' expected results. Thanks for showing those valuable, trustworthy, revealing not to mention unique tips on your topic to Sandra.

  10. order luvox说道:
    Google Chrome Windows 10

    I am commenting to let you know of the fantastic encounter my cousin's daughter experienced reading your site. She even learned many issues, not to mention what it's like to have a wonderful giving mindset to have many people just grasp chosen grueling subject areas. You really exceeded our expectations. Many thanks for distributing the informative, healthy, educational and as well as easy thoughts on the topic to Jane.

  11. aripiprazole buy说道:
    Google Chrome Windows 10

    I simply wanted to thank you so much once more. I do not know what I would've taken care of without these suggestions shared by you regarding that subject. It was actually an absolute intimidating problem in my position, nevertheless taking a look at this specialized tactic you solved the issue took me to leap with happiness. I will be happy for your service and thus sincerely hope you really know what an amazing job you have been putting in teaching some other people using your webblog. Most likely you haven't got to know any of us.

  12. Google Chrome Windows 10

    I am only writing to make you understand what a remarkable experience our princess undergone viewing your webblog. She picked up some things, which included what it is like to possess an ideal teaching spirit to make the mediocre ones without difficulty master specified tortuous things. You undoubtedly surpassed readers' expected results. Thanks for rendering those useful, trustworthy, revealing as well as unique tips on your topic to Mary.

  13. viagra tablets说道:
    Google Chrome Windows 10

    I wanted to post you that tiny remark to say thanks a lot over again just for the nice secrets you have featured in this case. It was really seriously open-handed with you to grant publicly just what many individuals might have offered for an ebook to generate some dough for themselves, mostly now that you might have tried it in case you desired. Those things likewise worked to become a great way to recognize that someone else have the same passion the same as my very own to see very much more with regard to this problem. I know there are some more pleasurable situations up front for those who start reading your website.

  14. viagra generic说道:
    Google Chrome Windows 10

    I enjoy you because of all of your effort on this blog. Debby enjoys conducting internet research and it's easy to see why. A number of us hear all about the compelling manner you create efficient ideas by means of the blog and boost contribution from other ones about this article and my child is being taught a great deal. Enjoy the remaining portion of the new year. You're carrying out a fantastic job.

  15. Google Chrome Windows 10

    I enjoy you because of all of the effort on this blog. Betty delights in carrying out internet research and it's easy to see why. A lot of people hear all about the compelling form you convey advantageous guidance by means of the blog and attract contribution from other individuals about this area and my child has always been becoming educated a great deal. Enjoy the remaining portion of the new year. You're carrying out a brilliant job.

  16. Google Chrome Windows 10

    ¿Necesita un préstamo rápido por Internet o un préstamo por Internet? Consulta nuestra oferta.

  17. Google Chrome Windows 10

    Najlepsze środki na impotencję. Chcesz powiększyć penisa to sprawdź ranking najlepszych suplementów i środków!

  18. Google Chrome Windows 10

    Bardzo lubię patrzeć i uważam, że ta strona zawiera naprawdę przydatne rzeczy!

  19. erotik说道:
    Google Chrome Windows 10

    A big thank you for your blog article. Much thanks again. Cool. Hayley Shelden Byram

发表评论

电子邮件地址不会被公开。必填项已用 * 标注