OSPF Packet Details
OSPF 的五种包类型:
Type
Description
Functionality
1
Hello
To discover neighbors and form DR/BDR relationship and exchange neighbor capabilities.
 
2
Database description
To elect master/slave for the database exchange process and to exchange the LSA headers and select the first sequence number for database exchange.
3
Link-state request
To request a specific LSA that is seen during the DBD exchange process.
4
Link-state update
To send the entire LSA to the neighbor who requested the particular LSA through the link request packet. This packet is also used in flooding.
5
Link-state acknowledge
To acknowledge the receipt of the link-state update packet.
 
 
Router ID— This field contains the 4-byte IP address. The router ID is used to uni-quely identifythe router throughout the autonomous system. For a Cisco box, this field contains the highest IP address on the box. If loopbacks are configured, the highest loopback becomes the router ID.
    After the router ID is chosen, it will not change unless the router is restarted, the inter-face that          is selected as a router ID is shut down, or the IP address has been removed or replaced on that    interface.
在这一项中包含了四个字节的ip 地址。路由ID在一自治系统中作为路由器的唯一标识
对于思科来说,这一项是它的最高ip地址。如果环回口被配置了,那么将使用最高环回口的ip地址作为路由ID。
在路由ID形成后,它将不改变除非一下情况:路由器被重启,被选作为路由ID的端口down掉了,或者是它的ip地址改变了!
AuType— This field contains the type code for the authentication:
     - 0 means that there is a null authentication.
     - 1 means that the authentication type is plain text.
     - 2 means that the authentication type is MD5.
认证类型——这一项包含认证类型代码:
-0 代表不是用认证
-1 代表使用简单文本认证
-2 代表使用MD5认证
Hello Packets
Hello packets are the first type of packets in OSPF.  Figure 8-2  illustrates the Hello packet format. Hello packets are used to form a neighbor relationship between two routers. In environments that include broadcast/nonbroadcast media, Hello packets are used to elect the designated (DR) and backup designated (BDR) routers. On broadcast media, the destination address of the Hello packets is 224.0.0.5. On nonbroadcast media, the destination address is unicast.
 
 
Hello包是ospf的第一类型的包。Hello包被用来在两个路由器间形成邻居关系。在广播和非广播媒介环境中,hello包被用来选举DR和BDR。在广播媒介中,hello包使用目标地址224.0..0.5。在非广播媒介中,使用单播地址。
Hello Interval— Represents the number of seconds between two Hello packets. This interval must be the same for the two routers that are trying to form an adjacency. The Hello interval is 10 seconds on broadcast and point-to-point media, and 30 seconds on all other media.
Hello 间隔——代表了两个hello包之间的时间间隔。这个间隔在两天准备建立邻接关系的路由器上必须相同。在点到点媒介中hello间隔为10秒,在其它媒介中hello间隔为30秒。
Rtr Pri— Used for a router's priority. By default, this value is set to 1. This field plays an important role in electing the DR and the BDR. A higher priority increases the chances that  the router will become the DR. A priority of 0 means that this router will not take part in DR election.
路由器优先级——作为路由器的优先级,默认情况下,设置为1。这一项在在选举DR和BDR是扮演了重要的角色。高优先级提高了路由器作为DR的可能性。优先级为0意味这此路由器不参加DR的选举。
Router Dead Interval— Represents the number, in seconds, before a neighbor is declared dead. By default, the dead interval is four times the Hello interval.
路由器死亡间隔——代表了宣告邻居路由器被宣告死亡前等待的时间。默认情况下,死亡间隔是hello间隔的四倍。
Designated Router— Lists the IP address of the designated router. If there is no DR, this field has a value of 0.0.0.0. The DR is elected through the Hello protocol. The router with the highest priority becomes the DR. If the priorities are equal, the router with the highest router ID becomes the DR. The purpose of the DR is to reduce the amount of flooding on multiaccess media. The DR uses multicasting to reduce the amount of flooding. All routers flood their link-state database to the DR, and the DR then floods that information back to other routers on that segment.  No DRs/BDRs exist on point-to-point or point-to-multipoint segments.
指定路由器——登记了指定路由器的ip地址。如果没有DR,则这一项的值为0.0.0.0.DR的选举通过hello协议完成。优先级高的成为DR。如果优先级相等,则有更高路器ID的成为DR。DR用来减少多访问媒介的流量。DR使用多播来减少流量。所有的路由器发送他们的链路状态数据库给DR,让后DR再将信息发送给其它的路由器。没有 DRs/BDRs 存在点到点和点到多点中。
Backup Designated Router— Identifies the BDR and lists the interface IP address of the BDR. If no BDR exists, this field has a value of 0.0.0.0. The BDR is also elected through the Hello protocol. The purpose of the BDR is to serve as the backup of the DR, for a smoother transition in case the DR dies. BDR remains passive during flooding.
备用指定路由——识别BDR和登记BDR的ip地址。如果美誉BDR存在,则这项填0.0.0.0。BDR也是通过hello协议选举出来。BDR是用来作为DR的备用的,当DR死亡是作一个平稳的过度。正常时候BDR保持消极状态。
Database Description Packets
The second type of OSPF packet, the database description (DBD) packet, is used mostly during the database exchange. The first DBD packet is used to elect the master and slave relationship and to set the initial sequence number elected by the master. The router with the highest router ID becomes the master and initiates the database synchronization. The master sends the sequence number, and the slave acknowledges it. After the master and the slave are elected, the database synchronization starts; in this process, the headers of all the LSAs are exchanged with neighbors.  Figure 8-3  illustrates the DBD packet format.
 
OSPF包的第二个类型,DBD包,在数据库改变是被使用。第一个DBD包被用来选择主从关系且有主来设这只初始序列号。高路由器ID的路由器成为主且着手数据库同步。著录有发送序列号,从确认它。在主从被选取之后,数据库同步开始;在这个过程中,所有的LSA头都被交换在邻居间。
DBD Sequence Number— This field contains a unique value set by the master. This sequence number is used during database exchange. Only a master can increment the sequence number.
DBD序列号——在这一项中包含主设置的独一无二的值。序列号在数据库交换时使用。只有主能够增加序列号。
Link-State Request Packets
The Type 3 OSPF packet, a link-state request packet, is sent if part of the database is missing or out-of-date. The link-state request packet is used to retrieve that precise piece of database information that is missing.  Link-state packets are also used after the DBD exchange is finished to request the LSAs that have been seen during the DBD exchange.   Figure 8-4  illustrates the link-state request packet format.
 
 
OSPF第三个类型的包,链路状态请求包,如果数据库的一部分丢失或者超期则将被发送。链路请求包被用来检索丢失的数据库精确的信息
Link-State Update Packets
OSPF packet Type 4, the link-state update packet, implements flooding. Several LSAs are included in a single packet. Link-state update packets are also sent in response to link-state  request packets. Flooded LSAs are acknowledged in the LSA acknowledgment packet. If an LSA is not acknowledged, it is retransmitted every retransmit interval (5 seconds, by default).  Figure 8-5  illustrates the link-state update packet format.
 
 
OSPF第四种类型的包,链路状态更新包,实现泛洪。许多的LSA被包含在一个链路状态更新包中回应链路状态请求包。发出的LSA要受到确认包。如果LSA没有被确认,它将在每个传输间隔后重传(默认5秒)。
Link-State Acknowledgment Packet
The last type of OSPF packet, the link-state acknowledgment packet, is used to  acknow-ledge each LSA. This packet is sent in response to link-state update packets. Multiple LSAs can be acknowledged in a single link-state acknowledgment packet. This packet is respon-sible for the reliable delivery of link-state update packets.  Figure 8-6  illustrates the link-state acknowledgment packet format
.
OSPF的最后一个包,链路状态确认包,被用来确认LSA。这个包被发送用来回应链路状态更新包。多个LSA能够用一个链路状态确认包确认。这个包被用来可靠的传输链路状态更新包。