ospf邻接关系的建立

实验拓扑图:
路由器 R1 f0/0 连接路由器 R2 f0/0 接口。
具体的配置:
R1:
interface loopback 0
ip add 1.1.1 .1 255.0.0.0
interface f0/0
ip add 10.0.0 .1 255.0.0.0
no sh
router ospf 1
net 0.0.0 .0 0.0.0.0 a 0
R2:
interface loopback 0
ip add 2.2.2 .2 255.0.0.0
interface f0/0
ip add 10.0.0 .2 255.0.0.0
no sh
router ospf 1
net 0.0.0 .0 0.0.0.0 a 0
最基本的配置就完成了,为了观察 OSPF 邻接状态建立的过程,在路由器 R2 上执行
debug ip ospf adj
回显如下:
*Jul 31 13:59:17.919: OSPF: Cannot see ourself in hello from 1.1.1 .1 on FastEthernet0/0, state INIT
*Jul 31 13:59:17.923: OSPF: Neighbor change Event on interface FastEthernet0/0
*Jul 31 13:59:17.923: OSPF: DR/BDR election on FastEthernet0/0
*Jul 31 13:59:17.927: OSPF: Elect BDR 0.0.0 .0
*Jul 31 13:59:17.927: OSPF: Elect DR 2.2.2 .2
*Jul 31 13:59:17.927:        DR: 2.2.2 .2 (Id)   BDR: none
*Jul 31 13:59:18.423: OSPF: Build router LSA for area 0, router ID 2.2.2 .2, seq 0x8000000B
*Jul 31 13:59:18.423: OSPF: No full nbrs to build Net Lsa for interface FastEthernet0/0
*Jul 31 13:59:18.427: OSPF: Build network LSA for FastEthernet0/0, router ID 2.2.2 .2
*Jul 31 13:59:18.427: OSPF: Build network LSA for FastEthernet0/0, router ID 2.2.2 .2
*Jul 31 13:59:20.307: OSPF: Rcv DBD from 1.1.1 .1 on FastEthernet0/0 seq 0x1D2F opt 0x52 flag 0x7 len 32  mtu 1500 state INIT
*Jul 31 13:59:20.311: OSPF: 2 Way Communication to 1.1.1 .1 on FastEthernet0/0, state 2WAY
*Jul 31 13:59:20.311: OSPF: Neighbor change Event on interface FastEthernet0/0
*Jul 31 13:59:20.315: OSPF: DR/BDR election on FastEthernet0/0
*Jul 31 13:59:20.315: OSPF: Elect BDR 1.1.1 .1
*Jul 31 13:59:20.315: OSPF: Elect DR 2.2.2 .2
*Jul 31 13:59:20.319:        DR: 2.2.2 .2 (Id)   BDR: 1.1.1.1 (Id)
*Jul 31 13:59:20.319: OSPF: Send DBD to 1.1.1 .1 on FastEthernet0/0 seq 0xCEF opt 0x52 flag 0x7 len 32
*Jul 31 13:59:20.323: OSPF: First DBD and we are not SLAVE
*Jul 31 13:59:20.375: OSPF: Rcv DBD from 1.1.1 .1 on FastEthernet0/0 seq 0xCEF opt 0x52 flag 0x2 len 52  mtu 1500 state EXSTART
*Jul 31 13:59:20.379: OSPF: NBR Negotiation Done. We are the MASTER
*Jul 31 13:59:20.379: OSPF: Send DBD to 1.1.1 .1 on FastEthernet0/0 seq 0xCF0 opt 0x52 flag 0x3 len 52
*Jul 31 13:59:20.423: OSPF: Rcv DBD from 1.1.1 .1 on FastEthernet0/0 seq 0xCF0 opt 0x52 flag 0x0 len 32  mtu 1500 state EXCHANGE
*Jul 31 13:59:20.427: OSPF: Send DBD to 1.1.1 .1 on FastEthernet0/0 seq 0xCF1 opt 0x52 flag 0x1 len 32
*Jul 31 13:59:20.463: OSPF: Rcv DBD from 1.1.1 .1 on FastEthernet0/0 seq 0xCF1 opt 0x52 flag 0x0 len 32  mtu 1500 state EXCHANGE
*Jul 31 13:59:20.467: OSPF: Exchange Done with 1.1.1 .1 on FastEthernet0/0
*Jul 31 13:59:20.467: OSPF: Synchronized with 1.1.1 .1 on FastEthernet0/0, state FULL
*Jul 31 13:59:20.471: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1 .1 on FastEthernet0/0 from LOADING to FULL, Loading Done
 
OSPF 建立邻接关系需要经过 DOWN INIT TWO-WAY EXSTART EXCHANGE FULL LOAD DONE 这几个过程。如果一切正常是这样的。
如果把 R1 f0/0 接口的 MTU 改为 1000 ,默认为 1500 ,邻接关系在卡在 EXSTART 状态。
OSPF 邻居在建立邻接关系的过程中,在 EXSTART 这个阶段发送 DBD 包,对 MTU 的大小有一定的限制,可以在接口模式下配置: ip ospf mtu-ignore, 忽略 MTU 对发送 DBD 包的影响。
R1 show ip ospf nei
Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2 .2           1   EXSTART/DR      00:00:38    10.0.0 .2        FastEthernet0/0
 
debug ip ospf adj
*Jul 31 14:16:10.343: OSPF: Send DBD to 2.2.2 .2 on FastEthernet0/0 seq 0x2648 opt 0x52 flag 0x7 len 32
*Jul 31 14:16:10.343: OSPF: Retransmitting DBD to 2.2.2 .2 on FastEthernet0/0 [8]
*Jul 31 14:16:10.395: OSPF: Rcv DBD from 2.2.2 .2 on FastEthernet0/0 seq 0x25C3 opt 0x52 flag 0x7 len 32  mtu 1500 state EXSTART
*Jul 31 14:16:10.395: OSPF: Nbr 2.2.2 .2 has larger interface MTU
R2:show ip ospf neigh
Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1 .1           1   EXSTART/BDR     00:00:37    10.0.0 .1        FastEthernet0/0
  debug ip ospf adj
 Jul 31 14:19:50.351: OSPF: Send DBD to 1.1.1 .1 on FastEthernet0/0 seq 0x23A4 opt 0x52 flag 0x7 len 32
*Jul 31 14:19:50.355: OSPF: Retransmitting DBD to 1.1.1 .1 on FastEthernet0/0 [12]
*Jul 31 14:19:55.323: OSPF: Rcv DBD from 1.1.1 .1 on FastEthernet0/0 seq 0xCF opt 0x52 flag 0x7 len 32  mtu 1000 state EXSTART
*Jul 31 14:19:55.327: OSPF: First DBD and we are not SLAVE
 
如果把 R1 R2 的优先级都改为 0 ip ospf priority 0 )的话,邻接状态就停在了 TWO-WAY 状态了。
R1:
   interface f0/0
   ip ospf priority 0
R2:
   interface f0/0
   ip ospf priority 0
R1:  show ip ospf neigh
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2 .2           0   2WAY/DROTHER    00:00:36    10.0.0 .2        FastEthernet0/
 
debug ip ospf adj
*Jul 31 14:25:30.319: OSPF: 2 Way Communication to 2.2.2 .2 on FastEthernet0/0, state 2WAY
*Jul 31 14:25:30.323: OSPF: Neighbor change Event on interface FastEthernet0/0
*Jul 31 14:25:30.323: OSPF: DR/BDR election on FastEthernet0/0
*Jul 31 14:25:30.327: OSPF: Elect BDR 0.0.0 .0
*Jul 31 14:25:30.327: OSPF: Elect DR 0.0.0 .0
*Jul 31 14:25:30.327:        DR: none    BDR: none
因为选举 DR BDR 在广播网络中是必须的,且在 TWO-WAY 状态时就必须选举 DR ,没有确定的 DR 就不能进行 DBD 的发送,进而交换 LSA 更是不可能的。
同时如果两个路由器的接口不在同一区域,或是 HELLO DEAD 时间间隔不一致,或是没有相同的末节区域标记,相同的认证密钥(如果有认证的话)都不能建立正常的邻接关系。
 
 

本文出自 “虎虎生威” 博客,转载请与作者联系!

你可能感兴趣的:(职场,休闲,ospf,ccnp,cisco路由)