ROS软路由论坛 ROSABC.com 网络方案网络工程交流

 找回密码
 会员注册

QQ登录

只需一步,快速开始

查看: 3529|回复: 3

配置单区域的OSPF协议

[复制链接]
发表于 2014-8-8 16:56:13 | 显示全部楼层 |阅读模式

马上注册成为ROSABC会员,随时发帖回复。

您需要 登录 才可以下载或查看,没有账号?会员注册

x




1.设置路由选择协议

sibo1(config)#router ospf 1   

sibo1(config-router)#network 192.168.12.0 0.0.0.255 area 0   

sibo1(config-router)#network 1.1.1.1 0.0.0.0 area 0



注:利用反掩码技术来匹配某一接口,如果匹配到了,那么就把这个接口的网段参与到OSPF的进程中



sibo2(config)#router ospf 1     

sibo2(config-router)#network 192.168.0.0 0.0.255.255 area 0         



注:虽然只写入了一个条目,但是它匹配到了192.168.12.2和192.168.23.2这两个接口,所

以他们都会参与到OSPF进程中

sibo3(config)#router ospf 1

sibo3(config-router)#network 3.3.3.0 0.0.0.255 area 0

sibo3(config-router)#network 192.168.23.0 0.0.0.255 area 0                                 



39  

2.查看路由表

sibo1#show ip route

     1.0.0.0/24 is subnetted, 1 subnets

C       1.1.1.0 is directly connected, Loopback0

     3.0.0.0/32 is subnetted, 1 subnets

O       3.3.3.3 [110/75] via 192.168.12.2, 00:00:59, Ethernet0

C    192.168.12.0/24 is directly connected, Ethernet0

O    192.168.23.0/24 [110/74] via 192.168.12.2, 00:00:59, Ethernet0 注:OSPF

的代号为O。管理距离值为110。度量值的计算方法是cost=10的8次方除以带宽。



3.观察OSPF邻居关系的建立情况

sibo1#debug ip ospf adj

sibo1(config)#int e0

sibo1(config-if)#shutdown

sibo1(config-if)#



注:开启OSPF建立邻居关系的debug信息。关闭端口!以验证邻居建立情况



02:00:59: %LINK-5-CHANGED: Interface Ethernet0, changed state to administratively

down----等待接口被管理员性关闭后,再用no shutdown打开

02:01:00: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0, changed state

to down



sibo1(config-if)#no shutdown----打开端口

sibo1(config-if)#

02:01:05: OSPF: Interface Ethernet0 going Up

02:01:05: OSPF: Build router LSA for area 0, router ID 1.1.1.1, seq 0x80000005

02:01:07: %LINK-3-UPDOWN: Interface Ethernet0, changed state to up

02:01:08: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0, changed state

to up

02:01:12: OSPF: 2 Way Communication to 192.168.23.2 on Ethernet0, state 2WAY

02:01:12: OSPF: Backup seen Event before WAIT timer on Ethernet0

02:01:12: OSPF: DR/BDR election on Ethernet0  

02:01:12: OSPF: Elect BDR 1.1.1.1

02:01:12: OSPF: Elect DR 192.168.23.2

02:01:12: OSPF: Elect BDR 1.1.1.1

02:01:12: OSPF: Elect DR 192.168.23.2

02:01:12:        DR: 192.168.23.2 (Id)   BDR: 1.1.1.1 (Id)

02:01:12: OSPF: Send DBD to 192.168.23.2 on Ethernet0 seq 0x1513 opt 0x42 flag 0x7 len

32

02:01:15: OSPF: Rcv DBD from 192.168.23.2 on Ethernet0 seq 0x169C opt 0x42 flag 0x7                                 



40 len 32  mtu 1500 state

EXSTART

02:01:15: OSPF: NBR Negotiation Done. We are the SLAVE

02:01:15: OSPF: Send DBD to 192.168.23.2 on Ethernet0 seq 0x169C opt 0x42 flag 0x2 len

112

02:01:15: OSPF: Rcv DBD from 192.168.23.2 on Ethernet0 seq 0x169D opt 0x42 flag 0x3

len 92  mtu 1500 state EXCHANGE

02:01:15: OSPF: Send DBD to 192.168.23.2 on Ethernet0 seq 0x169D opt 0x42 flag 0x0 len

32

02:01:15: OSPF: Database request to 192.168.23.2  

02:01:15: OSPF: sent LS REQ packet to 192.168.12.2, length 12

02:01:15: OSPF: Rcv DBD from 192.168.23.2 on Ethernet0 seq 0x169E opt 0x42 flag 0x1

len 32  mtu 1500 state EXCHANGE

02:01:15: OSPF: Exchange Done with 192.168.23.2 on Ethernet0

02:01:15: OSPF: Send DBD to 192.168.23.2 on Ethernet0 seq 0x169E opt 0x42 flag 0x0 len

32

02:01:15: OSPF: Synchronized with 192.168.23.2 on Ethernet0, state FULL

02:01:15: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.23.2 on Ethernet0 from LOADING

to FULL, Loading Done

02:01:15: OSPF: Build router LSA for area 0, router ID 1.1.1.1, seq 0x80000006

sibo1(config-if)#end

sibo1#u all



问题分析:OSPF的整个邻居关系应该经历以下完整的过程

DOWN---INIT---2 WAY---EXSTART---EXCHANGE---LOADING---FULL



你能回答出每个过程的具体细节和交换的报文吗?



3.查看ospf邻居表

sibo1#show ip ospf neighbor  

Neighbor ID     Pri   State  Dead Time   Address    Interface

192.168.23.2    1   FULL/DR  00:00:39 192.168.12.2   Ethernet0



注:OSPF的HELLO 时间为10秒,HOLD时间为40秒。可以显示对端邻居的接口IP地址,

可以查看OSPF的邻居状态,稳定时为FULL。



sibo2#show ip ospf neighbor  

Neighbor ID     Pri   State   Dead Time   Address      Interface

1.1.1.1         1   FULL/BDR  00:00:31  192.168.12.1  Ethernet0

3.3.3.3         1   FULL/  -  00:00:38  192.168.23.3    Serial1



注:-代表了sibo2和sibo3上却没有DR和BDR的选举

问题分析:为什么在sibo1和sibo2上有DR和BDR的选举过程,而sibo2和sibo3上却

没有?我们要了解,对于DR和BDR的选举,是有条件的,那就是必须是要在多路访问的链                                



41 路上进行,

sibo1和sibo2是用以太网线链接,以太网的链路是星型结构,属于多路访问类型,

可以参与DR和BDR的选举,但是sibo2和sibo3上使用的是serial线缆,它是属于点到点的

专线结构,所以是没有必要参与DR和BDR的选举的。

4.查看参与OSPF进程的以太网口状态

sibo1#show ip ospf interface ethernet 0

Ethernet0 is up, line protocol is up  

  Internet Address 192.168.12.1/24, Area 0  

  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10--------------------

以太网类型为多路访问(brocast)

  Transmit Delay is 1 sec, State DROTHER, Priority 0  

  Designated Router (ID) 192.168.23.2, Interface address 192.168.12.2

  No backup designated router on this network

  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

    Hello due in 00:00:07

  Index 1/1, flood queue length 0

  Next 0x0(0)/0x0(0)

  Last flood scan length is 1, maximum is 1

  Last flood scan time is 0 msec, maximum is 8 msec

  Neighbor Count is 1, Adjacent neighbor count is 1  

    Adjacent with neighbor 192.168.23.2  (Designated Router)

  Suppress hello for 0 neighbor(s)



sibo2#show ip ospf interface serial 1

Serial1 is up, line protocol is up  

  Internet Address 192.168.23.2/24, Area 0  

  Process ID 1, Router ID 192.168.23.2, Network Type POINT_TO_POINT, Cost:

64--------------------Serial

线缆为点到点类型的

  Transmit Delay is 1 sec, State POINT_TO_POINT,

  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

    Hello due in 00:00:00

  Index 2/2, flood queue length 0

  Next 0x0(0)/0x0(0)

  Last flood scan length is 1, maximum is 2

  Last flood scan time is 0 msec, maximum is 0 msec

  Neighbor Count is 1, Adjacent neighbor count is 1  

    Adjacent with neighbor 3.3.3.3

  Suppress hello for 0 neighbor(s)




评分

参与人数 1 +3 收起 理由
爱普信 + 3 赞一个!

查看全部评分

您需要登录后才可以回帖 登录 | 会员注册

本版积分规则

不良信息举报Q:2000617

软路由

不良信息举报Q:2000617|Archiver|ROS软路由论坛 ROSABC.com 网络方案网络工程交流

GMT+8, 2024-3-29 20:58 , Processed in 0.073903 second(s), 20 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表