ospf邻接关系的建立
原创
©著作权归作者所有:来自51CTO博客作者cc111的原创作品,如需转载,请与作者联系,否则将追究法律责任
实验拓扑图:
路由器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
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
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
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时间间隔不一致,或是没有相同的末节区域标记,相同的认证密钥(如果有认证的话)都不能建立正常的邻接关系。
上一篇:EIGRP
下一篇:EIGRP通告默认路由
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
OSPF的邻居关系和邻接关系
ospf邻居与邻接
OSPF 多址 邻接关系 -
ospf 入门
hhh
OSPF 数据库 IP -
OSPF单区域实验
华为HCIP-Datacom实验系列-OSPF单区域
OSPF Ethernet IP