拓扑:
R1,R2,R3,R4连到交换机上,RID分别是:1.1.1.1 ,2.2.2.2, 3.3.3.3 ,4.4.4.4
R1:10.11.11.11/8 R2:10.2.2.2/8 R3:10.3.3.3/8 R4:10.4.4.4/8
起用顺序,先启动R2,R3,过程如下,R2.R3之间选举了DR/BDR,并交换LSA形成FULL关系:
r2#debug ip ospf adj
OSPF adjacency events debugging is on
r2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
r2(config)#router ospf 1
r2(config-router)#net 10.0.0.0 0.255.255.255 a 0
r2(config-router)#
00:06:11: OSPF: Interface Ethernet0/1 going Up
00:06:11: OSPF: Build router LSA for area 0, router ID 2.2.2.2, seq 0x80000001
00:06:17: OSPF: 2 Way Communication to 3.3.3.3 on Ethernet0/1, state 2WAY
建立2way
00:06:17: OSPF: Backup seen Event before WAIT timer on Ethernet0/1
00:06:17: OSPF: DR/BDR election on Ethernet0/1
00:06:17: OSPF: Elect BDR 2.2.2.2
00:06:17: OSPF: Elect DR 3.3.3.3
00:06:17: OSPF: Elect BDR 2.2.2.2
00:06:17: OSPF: Elect DR 3.3.3.3
00:06:17: DR: 3.3.3.3 (Id) BDR: 2.2.2.2 (Id)
DR/BDR选举
00:06:17: OSPF: Send DBD to 3.3.3.3 on Ethernet0/1 seq 0xF17 opt 0x42 flag 0x7 len 32
发送一个序号为f17,初始位=1,More位=0,MS主从位=1,认为自己是主
00:06:21: OSPF: Rcv DBD from 3.3.3.3 on Ethernet0/1 seq 0x8EF opt 0x42 flag 0x7 len 32 mtu 1500 state EXSTART
00:06:21: OSPF: NBR Negotiation Done. We are the SLAVE
对方返回一个DBD,序号8ef,初始位=1,M=1,MS=1,对方认为自己是主.这个路由器同意了,认为自己是从.预启动状态.
00:06:21: OSPF: Send DBD to 3.3.3.3 on Ethernet0/1 seq 0x8EF opt 0x42 flag 0x2 len 52
接着这个从路由器发送第一个携带正式DBD的报文,注重序号是用的和预启动中同一个序号.
00:06:21: OSPF: Rcv DBD from 3.3.3.3 on Ethernet0/1 seq 0x8F0 opt 0x42 flag 0x3 len 52 mtu 1500 state EXCHANGE
接收到主陆游器上发来的DBD报文,这个序号是上一个序号+1.此时是交换状态
00:06:21: OSPF: Send DBD to 3.3.3.3 on Ethernet0/1 seq 0x8F0 opt 0x42 flag 0x0 len 32
从陆游器发回一个确认,注重序号是和接到的DBD序号相同
00:06:21: OSPF: Database request to 3.3.3.3
00:06:21: OSPF: sent LS REQ packet to 10.3.3.3, length 12
00:06:21: OSPF: Rcv DBD from 3.3.3.3 on Ethernet0/1 seq 0x8F1 opt 0x42 flag 0x1 len 32 mtu 1500 state EXCHANGE
00:06:21: OSPF: Exchange Done with 3.3.3.3 on Ethernet0/1
00:06:21: OSPF: Send DBD to 3.3.3.3 on Ethernet0/1 seq 0x8F1 opt 0x42 flag 0x0 len 32
这是一个loading与exchange的混合过程,主路由器发送一个DBD,从路由器用一个相同序号进行确认.同时进行DBDrequest和update.
过程结束的标志是,主陆游器发送More=0的DBD,然后从陆游器确认这个M=0的DBD后,认为exchange完成.假如此时的连路状态请求列表中还有条目,则开始进入loading状态开始请求这些LSA,直到请求列表变空.
00:06:21: OSPF: Synchronized with 3.3.3.3 on Ethernet0/1, state FULL
00:06:21: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on Ethernet0/1 from LOADING to FULL, Loading Done
00:06:21: OSPF: Build router LSA for area 0, router ID 2.2.2.2, seq 0x80000002
00:06:27: OSPF: Neighbor change Event on interface Ethernet0/1
00:06:27: OSPF: DR/BDR election on Ethernet0/1
00:06:27: OSPF: Elect BDR 2.2.2.2
00:06:27: OSPF: Elect DR 3.3.3.3
00:06:27: DR: 3.3.3.3 (Id) BDR: 2.2.2.2 (Id)
接着,起用R1,此时R1应该分别与R2.R3交换LSA,并构成FULL:
R2:
r2#
00:29:31: OSPF: Rcv DBD from 1.1.1.1 on Ethernet0/1 seq 0x1DFD opt 0x42 flag 0x7 len 32 mtu 1500 state INIT
00:29:31: OSPF: 2 Way Communication to 1.1.1.1 on Ethernet0/1, state 2WAY
00:29:31: OSPF: Neighbor change Event on interface Ethernet0/1
00:29:31: OSPF: DR/BDR election on Ethernet0/1
00:29:31: OSPF: Elect BDR 2.2.2.2
00:29:31: OSPF: Elect DR 3.3.3.3
00:29:31: DR: 3.3.3.3 (Id) BDR: 2.2.2.2 (Id)
00:29:31: OSPF: Send DBD to 1.1.1.1 on Ethernet0/1 seq 0x1B60 opt 0x42 flag 0x7 len 32
00:29:31: OSPF: First DBD and we are not SLAVE
00:29:31: OSPF: Rcv DBD from 1.1.1.1 on Ethernet0/1 seq 0x1B60 opt 0x42 flag 0x2 len 52 mtu 1500 state EXSTART
00:29:31: OSPF: NBR Negotiation Done. We are the MASTER
00:29:31: OSPF: Send DBD to 1.1.1.1 on Ethernet0/1 seq 0x1B61 opt 0x42 flag 0x3 len 92
00:29:31: OSPF: Database request to 1.1.1.1
00:29:31: OSPF: sent LS REQ packet to 10.11.11.11, length 12
00:29:31: OSPF: Rcv DBD from 1.1.1.1 on Ethernet0/1 seq 0x1B61 opt 0x42 flag 0x0 len 32 mtu 1500 state EXCHANGE
00:29:31: OSPF: Send DBD to 1.1.1.1 on Ethernet0/1 seq 0x1B62 opt 0x42 flag 0x1 len 32
00:29:31: OSPF: Rcv DBD from 1.1.1.1 on Ethernet0/1 seq 0x1B62 opt 0x42 flag 0x0 len 32 mtu 1500 state EXCHANGE
00:29:31: OSPF: Exchange Done with 1.1.1.1 on Ethernet0/1
00:29:31: OSPF: Synchronized with 1.1.1.1 on Ethernet0/1, state FULL
00:29:31: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on Ethernet0/1 from LOADING to FULL, Loading Done
00:29:39: OSPF: Neighbor change Event on interface Ethernet0/1
00:29:39: OSPF: DR/BDR election on Ethernet0/1
00:29:39: OSPF: Elect BDR 2.2.2.2
00:29:39: OSPF: Elect DR 3.3.3.3
00:29:39: DR: 3.3.3.3 (Id) BDR: 2.2.2.2 (Id)
R3:
r3#debug ip ospf adj
OSPF adjacency events debugging is on
r3#
00:29:35: OSPF: Rcv DBD from 1.1.1.1 on Ethernet0/1 seq 0x2098 opt 0x42 flag 0x7 len 32 mtu 1500 state INIT
00:29:35: OSPF: 2 Way Communication to 1.1.1.1 on Ethernet0/1, state 2WAY
00:29:35: OSPF: Neighbor change Event on interface Ethernet0/1
00:29:35: OSPF: DR/BDR election on Ethernet0/1
00:29:35: OSPF: Elect BDR 2.2.2.2
00:29:35: OSPF: Elect DR 3.3.3.3
00:29:35: DR: 3.3.3.3 (Id) BDR: 2.2.2.2 (Id)
00:29:35: OSPF: Send DBD to 1.1.1.1 on Ethernet0/1 seq 0x198D opt 0x42 flag 0x7 len 32
00:29:35: OSPF: First DBD and we are not SLAVE
00:29:35: OSPF: Rcv DBD from 1.1.1.1 on Ethernet0/1 seq 0x198D opt 0x42 flag 0x2 len 112 mtu 1500 state EXSTART
00:29:35: OSPF: NBR Negotiation Done. We are the MASTER
00:29:35: OSPF: Send DBD to 1.1.1.1 on Ethernet0/1 seq 0x198E opt 0x42 flag 0x3 len 92
00:29:35: OSPF: Database request to 1.1.1.1
00:29:35: OSPF: sent LS REQ packet to 10.11.11.11, length 12
00:29:35: OSPF: Rcv DBD from 1.1.1.1 on Ethernet0/1 seq 0x198E opt 0x42 flag 0x0 len 32 mtu 1500 state EXCHANGE
00:29:35: OSPF: Send DBD to 1.1.1.1 on Ethernet0/1 seq 0x198F opt 0x42 flag 0x1 len 32
00:29:35: OSPF: Rcv DBD from 1.1.1.1 on Ethernet0/1 seq 0x198F opt 0x42 flag 0x0 len 32 mtu 1500 state EXCHANGE
00:29:35: OSPF: Exchange Done with 1.1.1.1 on Ethernet0/1
00:29:35: OSPF: Synchronized with 1.1.1.1 on Ethernet0/1, state FULL
00:29:35: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on Ethernet0/1 from LOADING to FULL, Loading Done
00:29:35: OSPF: Build network LSA for Ethernet0/1, router ID 3.3.3.3
00:29:36: OSPF: Neighbor change Event on interface Ethernet0/1
00:29:36: OSPF: DR/BDR election on Ethernet0/1
00:29:36: OSPF: Elect BDR 2.2.2.2
00:29:36: OSPF: Elect DR 3.3.3.3
00:29:36: DR: 3.3.3.3 (Id) BDR: 2.2.2.2 (Id)
最后启动R4,此时R4应该只与R2 R3交换LSA构成FULL ,与R1建立普通2WAY
r2#
00:35:03: OSPF: 2 Way Communication to 4.4.4.4 on Ethernet0/1, state 2WAY
00:35:03: OSPF: Neighbor change Event on interface Ethernet0/1
00:35:03: OSPF: DR/BDR election on Ethernet0/1
00:35:03: OSPF: Elect BDR 2.2.2.2
00:35:03: OSPF: Elect DR 3.3.3.3
00:35:03: DR: 3.3.3.3 (Id) BDR: 2.2.2.2 (Id)
00:35:03: OSPF: Send DBD to 4.4.4.4 on Ethernet0/1 seq 0x2178 opt 0x42 flag 0x7 len 32
00:35:06: OSPF: Rcv DBD from 4.4.4.4 on Ethernet0/1 seq 0x1852 opt 0x42 flag 0x7 len 32 mtu 1500 state EXSTART
00:35:06: OSPF: NBR Negotiation Done. We are the SLAVE
00:35:06: OSPF: Send DBD to 4.4.4.4 on Ethernet0/1 seq 0x1852 opt 0x42 flag 0x2 len 112
00:35:06: OSPF: Rcv DBD from 4.4.4.4 on Ethernet0/1 seq 0x1853 opt 0x42 flag 0x3 len 52 mtu 1500 state EXCHANGE
00:35:06: OSPF: Send DBD to 4.4.4.4 on Ethernet0/1 seq 0x1853 opt 0x42 flag 0x0 len 32
00:35:06: OSPF: Database request to 4.4.4.4
00:35:06: OSPF: sent LS REQ packet to 10.4.4.4, length 12
00:35:06: OSPF: Rcv DBD from 4.4.4.4 on Ethernet0/1 seq 0x1854 opt 0x42 flag 0x1 len 32 mtu 1500 state EXCHANGE
00:35:06: OSPF: Exchange Done with 4.4.4.4 on Ethernet0/1
00:35:06: OSPF: Send DBD to 4.4.4.4 on Ethernet0/1 seq 0x1854 opt 0x42 flag 0x0 len 32
00:35:06: OSPF: Synchronized with 4.4.4.4 on Ethernet0/1, state FULL
00:35:06: %OSPF-5-ADJCHG: Process 1, Nbr 4.4.4.4 on Ethernet0/1 from LOADING to FULL, Loading Done
00:39:53: OSPF: Build router LSA for area 0, router ID 2.2.2.2, seq 0x80000003
R3:
r3#
00:35:00: OSPF: 2 Way Communication to 4.4.4.4 on Ethernet0/1, state 2WAY
00:35:00: OSPF: Neighbor change Event on interface Ethernet0/1
00:35:00: OSPF: DR/BDR election on Ethernet0/1
00:35:00: OSPF: Elect BDR 2.2.2.2
00:35:00: OSPF: Elect DR 3.3.3.3
00:35:00: DR: 3.3.3.3 (Id) BDR: 2.2.2.2 (Id)
00:35:00: OSPF: Send DBD to 4.4.4.4 on Ethernet0/1 seq 0x14D7 opt 0x42 flag 0x7 len 32
00:35:04: OSPF: Rcv DBD from 4.4.4.4 on Ethernet0/1 seq 0x195F opt 0x42 flag 0x7 len 32 mtu 1500 state EXSTART
00:35:04: OSPF: NBR Negotiation Done. We are the SLAVE
00:35:04: OSPF: Send DBD to 4.4.4.4 on Ethernet0/1 seq 0x195F opt 0x42 flag 0x2 len 112
00:35:04: OSPF: Rcv DBD from 4.4.4.4 on Ethernet0/1 seq 0x1960 opt 0x42 flag 0x3 len 52 mtu 1500 state EXCHANGE
00:35:04: OSPF: Send DBD to 4.4.4.4 on Ethernet0/1 seq 0x1960 opt 0x42 flag 0x0 len 32
00:35:04: OSPF: Database request to 4.4.4.4
00:35:04: OSPF: sent LS REQ packet to 10.4.4.4, length 12
00:35:04: OSPF: Rcv DBD from 4.4.4.4 on Ethernet0/1 seq 0x1961 opt 0x42 flag 0x1 len 32 mtu 1500 state EXCHANGE
00:35:04: OSPF: Exchange Done with 4.4.4.4 on Ethernet0/1
00:35:04: OSPF: Send DBD to 4.4.4.4 on Ethernet0/1 seq 0x1961 opt 0x42 flag 0x0 len 32
00:35:04: OSPF: Synchronized with 4.4.4.4 on Ethernet0/1, state FULL
00:35:04: %OSPF-5-ADJCHG: Process 1, Nbr 4.4.4.4 on Ethernet0/1 from LOADING to FULL, Loading Done
00:35:04: OSPF: Build network LSA for Ethernet0/1, router ID 3.3.3.3
00:38:50: OSPF: Build router LSA for area 0, router ID 3.3.3.3, seq 0x80000003
R1:
r1#
00:34:25: OSPF: 2 Way Communication to 4.4.4.4 on Ethernet0/1, state 2WAY
00:34:25: OSPF: Neighbor change Event on interface Ethernet0/1
00:34:25: OSPF: DR/BDR election on Ethernet0/1
00:34:25: OSPF: Elect BDR 2.2.2.2
00:34:25: OSPF: Elect DR 3.3.3.3
00:34:25: DR: 3.3.3.3 (Id) BDR: 2.2.2.2 (Id)
此时R4上的邻居表:
r4#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/BDR 00:00:37 10.2.2.2 Ethernet0/1
1.1.1.1 1 2WAY/DROTHER 00:00:35 10.11.11.11 Ethernet0/1
3.3.3.3 1 FULL/DR 00:00:33 10.3.3.3 Ethernet0/1
r1#sh ip ospf neighbor detail
Neighbor 4.4.4.4, interface address 10.4.4.4
In the area 0 via interface Ethernet0/1
Neighbor priority is 1, State is 2WAY, 2 state changes
DR is 10.3.3.3 BDR is 10.2.2.2
Options is 0x2
Dead timer due in 00:00:39
Neighbor is up for 00:17:00
Index 0/0, retransmission queue length 0, number of retransmission 0
First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
Last retransmission scan length is 0, maximum is 0
Last retransmission scan time is 0 msec, maximum is 0 msec
Neighbor 3.3.3.3, interface address 10.3.3.3
In the area 0 via interface Ethernet0/1
Neighbor priority is 1, State is FULL, 6 state changes
DR is 10.3.3.3 BDR is 10.2.2.2
Options is 0x42
Dead timer due in 00:00:33
Neighbor is up for 00:22:26
Index 2/2, retransmission queue length 0, number of retransmission 0
First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
Last retransmission scan length is 0, maximum is 0
Last retransmission scan time is 0 msec, maximum is 0 msec
Neighbor 2.2.2.2, interface address 10.2.2.2
In the area 0 via interface Ethernet0/1
Neighbor priority is 1, State is FULL, 6 state changes
DR is 10.3.3.3 BDR is 10.2.2.2
Options is 0x42
Dead timer due in 00:00:32
Neighbor is up for 00:22:37
Index 1/1, retransmission queue length 0, number of retransmission 1
First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
Last retransmission scan length is 1, maximum is 1
Last retransmission scan time is 0 msec, maximum is 0 msec