OSPF Neighbor States

OSPF Neighbor States

Document ID: 13685


Author: Syed Faraz Shamim

Contents

Introduction
Prerequisites
      Requirements
     
Components Used
     
Conventions
Down
Attempt
Init
2-Way
Exstart
Exchange
Loading
Full
NetPro Discussion Forums - Featured Conversations
Related Information

Introduction

When OSPF adjacency is formed, a router goes through several state changes before it becomes fully adjacent with its neighbor. Those states are defined in the OSPF RFC 2328 leavingcisco.com, section 10.1. The states are Down, Attempt, Init, 2-Way, Exstart, Exchange, Loading, and Full. This document describes each state in detail.
13a.gif

Prerequisites

Requirements

There are no specific requirements for this document.

Components Used

This document is not restricted to specific software and hardware versions.

Conventions

For more information on document conventions, refer to Cisco Technical Tips Conventions.

Down

This is the first OSPF neighbor state. It means that no information (hellos) has been received from this neighbor, but hello packets can still be sent to the neighbor in this state.
During the fully adjacent neighbor state, if a router doesn't receive hello packet from a neighbor within the RouterDeadInterval time (RouterDeadInterval = 4*HelloInterval by default) or if the manually configured neighbor is being removed from the configuration, then the neighbor state changes from Full to Down.

Attempt

This state is only valid for manually configured neighbors in an NBMA environment. In Attempt state, the router sends unicast hello packets every poll interval to the neighbor, from which hellos have not been received within the dead interval.

Init

This state specifies that the router has received a hello packet from its neighbor, but the receiving router's ID was not included in the hello packet. When a router receives a hello packet from a neighbor, it should list the sender's router ID in its hello packet as an acknowledgment that it received a valid hello packet.

2-Way

This state designates that bi-directional communication has been established between two routers. Bi-directional means that each router has seen the other's hello packet. This state is attained when the router receiving the hello packet sees its own Router ID within the received hello packet's neighbor field. At this state, a router decides whether to become adjacent with this neighbor. On broadcast media and non-broadcast multiaccess networks, a router becomes full only with the designated router (DR) and the backup designated router (BDR); it stays in the 2-way state with all other neighbors. On Point-to-point and Point-to-multipoint networks, a router becomes full with all connected routers.
At the end of this stage, the DR and BDR for broadcast and non-broadcast multiacess networks are elected. For more information on the DR election process, refer to DR Election.
Note: Receiving a Database Descriptor (DBD) packet from a neighbor in the init state will also a cause a transition to 2-way state.

Exstart

Once the DR and BDR are elected, the actual process of exchanging link state information can start between the routers and their DR and BDR.
In this state, the routers and their DR and BDR establish a master-slave relationship and choose the initial sequence number for adjacency formation. The router with the higher router ID becomes the master and starts the exchange, and as such, is the only router that can increment the sequence number. Note that one would logically conclude that the DR/BDR with the highest router ID will become the master during this process of master-slave relation. Remember that the DR/BDR election might be purely by virtue of a higher priority configured on the router instead of highest router ID. Thus, it is possible that a DR plays the role of slave. And also note that master/slave election is on a per-neighbor basis.

Exchange

In the exchange state, OSPF routers exchange database descriptor (DBD) packets. Database descriptors contain link-state advertisement (LSA) headers only and describe the contents of the entire link-state database. Each DBD packet has a sequence number which can be incremented only by master which is explicitly acknowledged by slave. Routers also send link-state request packets and link-state update packets (which contain the entire LSA) in this state. The contents of the DBD received are compared to the information contained in the routers link-state database to check if new or more current link-state information is available with the neighbor.

Loading

In this state, the actual exchange of link state information occurs. Based on the information provided by the DBDs, routers send link-state request packets. The neighbor then provides the requested link-state information in link-state update packets. During the adjacency, if a router receives an outdated or missing LSA, it requests that LSA by sending a link-state request packet. All link-state update packets are acknowledged.

Full

In this state, routers are fully adjacent with each other. All the router and network LSAs are exchanged and the routers' databases are fully synchronized.
Full is the normal state for an OSPF router. If a router is stuck in another state, it's an indication that there are problems in forming adjacencies. The only exception to this is the 2-way state, which is normal in a broadcast network. Routers achieve the full state with their DR and BDR only. Neighbors always see each other as 2-way.
上面簡單把你的問題解答一下.不是很詳細,具體內容可以去我的BLOG看看吧.我把OSPF的鄰居關係的建立總結了一下貼在那裏.地址:
[url=http://thinkpad.blog.ccidnet.com/blog/ccid/do_showone/tid_122413.html]http://thinkpad.blog.ccidnet.com ... one/tid_122413.html[/url]
下面是一些簡要內容:
對於廣播多路訪問網絡,路由器在啓動OSPF進程,到整個OSPF域形成相同的拓撲數據庫,這中間一般來說,每臺路由器會經歷八個狀態:

1、失效狀態(down):新路由器處於失效狀態。路由器嘗試發送Hello分組,向網段中的其他路由器介紹自己,並試圖發現其他的OSPF路由器。該Hello分組使用多播地址224.0.0.5(所有SPF路由器),其DR,BDR字段都設置爲0。0。0。0

2、初始化狀態(init):新路由器發送出hello分組等待應答狀態。通常等待時間爲hello時間的4倍。在這段時間內,新路由器從其他路由器那裏收到Hello分組,並獲悉誰是DR,BDR。如果收到的hello分組沒有指出誰是DR,BDR,則開始選舉。

3、雙向狀態(two--way):在其他路由器A收到來自路由器B的hello分組後,將hello分組中的路由器ID加入到拓撲數據庫中,並用多播地址224.0.0.5發送一個HELLO分組,其中包含自己的ID和一個由所有鄰居組成的列表。當B收到該HELLO分組後,如果發現自己的ID在這個來自A的HELLO分組裏的鄰居列表中,那麼B將認爲和A已經形成了雙向的通信狀態。

4、預啓動狀態(exstart):互爲鄰居的兩臺路由器A,B。它們根據直連的接口IP選出較大IP那臺路由器做爲主(master)路由器,這就是預啓動狀態。兩個鄰居是根據接口的IP大小來確定主/從關係:誰主誰次並不重要,它們主要是決定由誰來發起通信。

5、交換狀態(exchange):兩臺路由器都發送數據庫描述分組(DDP),並切換到交換狀態。路由器從鄰居路由器那裏收到DDP後,將其同自己的拓撲表進行比較。DDP裏面只包含拓撲數據庫的摘要信息。

6、加載狀態(loading):當一臺路由器收到了來自鄰居的DDP分組,經過比較後發現自己的拓撲數據庫信息和DDP中包含的摘要信息存在差異,,這時該接收路由器需要更詳細的信息,它將使用LSR分組請求有關特定鏈路的詳細信息。

7、完全鄰接(full):當A路由器收到來自B的LSR時,它將返回一種LSU分組(就是指收到LSR分組後發送的一種LSA分組)。然後B收到該LSU後,將返回一種LSACK(鏈路狀態確認)分組。同時B和A的拓撲數據庫達到了同步,此時,鄰居關係就變成了鄰接狀態。(loading to full)

(Attempt 只有在NBMA網絡裏纔有,手工進行Neighbor的指定。)

這中間主要出現了四種分組:

1、HELLO分組:用於發現鄰居和選舉DR,BDR。路由器不斷的發送HELLO分組,以確保它始終出現在收到了這些分組的路由器的拓撲數據庫中。

2、數據庫描述分組(DD):用於向鄰居發送摘要信息以同步拓撲數據庫。

3、LSR:用於請求更詳細的信息,路由器收到包含新信息的數據庫描述分組後發送的一種分組

4、鏈路狀態確認(LSACK):確認已經收到了LSU



A——————————hello——————————>B

A<——————————hello——————————B

A——————————DDP——————————>B

A<——————————DDP——————————B

A——————————LSR——————————>B

A<——————————LSU——————————B

A——————————LSACK——————————>B
剛想了想,覺得有個更簡單的例子來說明問題:
比如說借書問題.
A有一本教科書,B需要借來參閱其中的部分章節,但是書A現在急用,不能借給B.而且A和B現在不在同一個地方,那麼A和B需要用某種方式來聯繫上才能開始下一步借書的動作.
假如他們用QQ及傳真兩種方式來聯繫和傳送文件.(找尋對方,利用某種動作,類似於HELLO)

雙方都聯繫到後(two-way),(exstart,這裏既然是B向A借東西,那麼當然以A爲主了,master)A就想知道B需要哪些章節的內容,於是,A把這本書的目錄複印了一份發給B(傳送DBD報文,描述整個鏈路狀態數據庫信息)

B收到目錄後,發現目錄中有自己需要的內容,那麼就把想看的目錄打上標記回傳給A(LSR,鏈路狀態請求)
A收到B需要的章節目錄後,就把目錄對應的章節複印一份交給B(LSU,鏈路狀態更新信息).(公家的東東唄.不怕浪費)

B收到需要的章節後,當然要向A表示感謝,順便告知"我收到了!謝謝!"(LSACK)
如果A發到B後,B一直沒收到,那麼B就會催一下A"漏漏,你發了沒有啊?我沒收到啊!"
那麼A就會"重傳"
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章