实验11:思科(Cisco)路由器点到点链路上的OSPF

Post by mrchen, 2010-6-26, Views:
原创文章如转载,请注明:转载自冠威博客 [ http://www.guanwei.org/ ]
本文链接地址:http://www.guanwei.org/post/Cisconetwork/06/Cisco-OSPF.html

 

拓扑图

实验步骤
(1)步骤 1:配置路由器 R1

R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 1.1.1.0 255.255.255.0 area 0
R1(config-router)#network 192.168.12.0 255.255.255.0 area 0

(2)步骤 2:配置路由器 R2

R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 192.168.12.0 255.255.255.0 area 0
R2(config-router)#network 192.168.23.0 255.255.255.0 area 0
R2(config-router)#network 2.2.2.0 255.255.255.0 area 0

(3)步骤 3:配置路由器 R3

R3(config)#router ospf 1
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 192.168.23.0 255.255.255.0 area 0
R3(config-router)#network 192.168.34.0 255.255.255.0 area 0
R3(config-router)#network 3.3.3.0 255.255.255.0 area 0

(4)步骤 4:配置路由器 R4

R4(config)#router ospf 1
R4(config-router)#router-id 4.4.4.4
R4(config-router)#network 4.4.4.0 0.0.0.255 area 0
R4(config-router)#network 192.168.34.0 0.0.0.255 area 0

 
【技术要点】
(1)OSPF 路由进程 ID 的范围必须在 1-65535 之间,而且只有本地含义,不同路由器的路由进程 ID 可以不同。如果要想启动 OSPF 路由进程,至少确保有一个接口是 up 的;
(2)区域 ID 是在0-4294967295 内的十进制数,也可以是 IP地址的格式 A.B.C.D。当网络区域 ID为 0 或0.0.0.0 时称为主干区域;
(3)在高版本的 IOS 中通告 OSPF 网络的时候,网络号的后面可以跟网络掩码,也可以跟反掩码,都是可以的;
(4)确定 Router ID 遵循如下顺序: 
① 最优先的是在 OSPF 进程中用命令“router-id”指定了路由器 ID;
② 如果没有在 OSPF 进程中指定路由器 ID,那么选择 IP 地址最大的环回接口的 IP 地址为Router ID;
③ 如果没有环回接口,就选择最大的活动的物理接口的 IP地址为 Router ID。

建议用命令“router-id”来指定路由器 ID,这样可控性比较好。
 
实验调试
(1)show ip route

R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is not set
 
C    192.168.12.0/24 is directly connected, Serial0/0/0
     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/782] via 192.168.12.1, 00:18:40, Serial0/0/0
     2.0.0.0/24 is subnetted, 1 subnets

C       2.2.2.0 is directly connected, Loopback0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/782] via 192.168.23.3, 00:18:40, Serial0/0/1
     4.0.0.0/32 is subnetted, 1 subnets

O       4.4.4.4 [110/1563] via 192.168.23.3, 00:18:40, Serial0/0/1
C    192.168.23.0/24 is directly connected, Serial0/0/1
O    192.168.34.0/24 [110/1562] via 192.168.23.3, 00:18:41, Serial0/0/1

 输出结果表明同一个区域内通过 OSPF 路由协议学习的路由条目用代码“O”表示。
 
【说明】
① 环回接口 OSPF 路由条目的掩码长度都是 32 位,这是环回接口的特性,尽管通告了24 位,解决的办法是在环回接口下修改网络类型为“Point-to-Point” ,操作如下:

R2(config)#interface loopback 0
R2(config-if)#ip ospf network point-to-point

这样收到的路由条目的掩码长度和通告的一致。
② 路由条目“4.4.4.4”的度量值为 1563,计算过程如下:
cost 的计算公式为 10^8/带宽(bps) ,然后取整,而且是所有链路入口的 cost 之和,环回接口的 cost 为 1,路由条目“4.4.4.4”到路由器 R2 经过的入接口包括路由器 R4 的loopback0,路由器 R3 的 s0/0/0,路由器 R2 的 s0/0/1,所以计算如下:
1+10^8/128000+10^8/128000=1563。也可以直接通过命令“ip ospf cost”设置接口的 cost值,并且它是优先计算的 cost 值的。

(2)show ip protocols

R2#show ip protocols 
Routing Protocol is "ospf 1"
//当前路由器运行的OSPF进程ID
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Router ID 2.2.2.2
//本路由器ID
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
//本路由器参与的区域数量和类型
  Maximum path: 4
//支持等价路径最大数目
  Routing for Networks:
    2.2.2.0 0.0.0.255 area 0
    192.168.12.0 0.0.0.255 area 0
    192.168.23.0 0.0.0.255 area 0
//以上四行表明OSPF通告的网络以及这些网络所在的区域
 Reference bandwidth unit is 100 mbps
//参考带宽为108
  Routing Information Sources:
    Gateway         Distance      Last Update
    4.4.4.4              110      00:08:36
    3.3.3.3              110      00:08:36
    1.1.1.1              110      00:08:36
//以上5行表明路由信息源
  Distance: (default is 110)
//OSPF路由协议默认的管理距离

(3)show ip ospf

该命令显示 OSPF 进程及区域的细节,如路由器运行 SPF 算法的次数等。

R2#show ip ospf 1  Routing Process "ospf 1" with ID 2.2.2.2
 Start time: 00:50:57.156, Time elapsed: 00:42:41.880
 Supports only single TOS(TOS0) routes
 Supports opaque LSA
 Supports Link-local Signaling (LLS)
 Supports area transit capability
 Router is not originating router-LSAs with maximum metric
 Initial SPF schedule delay 5000 msecs
 Minimum hold time between two consecutive SPFs 10000 msecs
 Maximum wait time between two consecutive SPFs 10000 msecs
 Incremental-SPF disabled
 Minimum LSA interval 5 secs
 Minimum LSA arrival 1000 msecs
 LSA group pacing timer 240 secs
 Interface flood pacing timer 33 msecs
 Retransmission pacing timer 66 msecs
 Number of external LSA 0. Checksum Sum 0x000000
 Number of opaque AS LSA 0. Checksum Sum 0x000000
 Number of DCbitless external and opaque AS LSA 0
 Number of DoNotAge external and opaque AS LSA 0
 Number of areas in this router is 1. 1 normal 0 stub 0 nssa
 Number of areas transit capable is 0
 External flood list length 0
 IETF NSF helper support enabled
 Cisco NSF helper support enabled
    Area BACKBONE(0)
        Number of interfaces in this area is 3
        Area has no authentication
        SPF algorithm last executed 00:15:07.580 ago
        SPF algorithm executed 9 times
        Area ranges are
        Number of LSA 4. Checksum Sum 0x02611A
        Number of opaque link LSA 0. Checksum Sum 0x000000
        Number of DCbitless LSA 0
        Number of indication LSA 0
        Number of DoNotAge LSA 0
        Flood list length 0

(4)show ip ospf interface 

R2#show ip ospf interface s0/0/0
Serial0/0/0 is up, line protocol is up 
  Internet Address 192.168.12.2/24, Area 0 
//该接口的地址和运行的OSPF区域
  Process ID 1, Router ID 2.2.2.2, Network Type POINT_TO_POINT, Cost: 781
//进程ID,路由器ID,网络类型,接口Cost值   Transmit Delay is 1 sec, State POINT_TO_POINT
//接口的延迟和状态
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 
oob-resync timeout 40
//显示几个计时器的值
    Hello due in 00:00:05
//距离下次发送Hello包的时间
  Supports Link-local Signaling (LLS)
//支持LLS
  Cisco NSF helper support enabled
  IETF NSF helper support enabled
//以上两行表示启用了IETF 和Cisco的NSF功能
  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 0 msec
  Neighbor Count is 1, Adjacent neighbor count is 1 
//邻居的个数以及已建立邻接关系的邻居的个数
    Adjacent with neighbor 1.1.1.1
//已经建立邻接关系的邻居路由器ID
  Suppress hello for 0 neighbor(s)
//没有进行Hello抑制

(5)show ip ospf neighbor

R2#show ip ospf neighbor 
Neighbor ID   Pri   State           Dead Time   Address         Interface
3.3.3.3       0     FULL/  -        00:00:35    192.168.23.3    Serial0/0/1
1.1.1.1       0     FULL/  -        00:00:38    192.168.12.1    Serial0/0/0

以上输出表明路由器 R2 有两个邻居,它们的路由器 ID 分别为 1.1.1.1 和 3.3.3.3,其它参数解释如下:
① Pri:邻居路由器接口的优先级;
② State:当前邻居路由器接口的状态;
③ Dead Time:清除邻居关系前等待的最长时间;
④ Address:邻居接口的地址;
⑤ Interface:自己和邻居路由器相连接口;
⑥ “-” : 表示点到点的链路上 OSPF 不进行DR选举。

 
【技术要点】
OSPF 邻居关系不能建立的常见原因:
① hello 间隔和 dead 间隔不同;
同一链路上的 hello 包间隔和 dead 间隔必须相同才能建立邻接关系。默认情况下,hello 包发送间隔如表1 所示。
 
表 1 OSPF hello 间隔和 dead 间隔
网络类型        Hello 间隔(秒)        Dead 间隔(秒)
广播多路访问        10        40
非广播多路访问        30        120
点到点        10        40
点到多点        30        120
 
默认时 Dead 间隔是 Hello 间隔的四倍。 可以在接口下通过 “ip ospf hello-interval”和“ip ospf dead-interval”命令调整。
② 区域号码不一致;
③ 特殊区域(如stub,nssa等)区域类型不匹配;
④ 认证类型或密码不一致;
⑤ 路由器 ID 相同;
⑥ Hello 包被 ACL deny;
⑦ 链路上的MTU 不匹配;
⑧ 接口下OSPF网络类型不匹配。

 
(6)show ip ospf database

R2#show ip ospf database 
 
            OSPF Router with ID (2.2.2.2) (Process ID 1)
 
                Router Link States (Area 0)
 
Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         240         0x80000005 0x00BA35 3
2.2.2.2         2.2.2.2         1308        0x80000008 0x00D7C0 5
3.3.3.3         3.3.3.3         1310        0x80000007 0x00282D 5
4.4.4.4         4.4.4.4         44          0x80000004 0x009AFE 3

以上输出是 R2 的区域0 的拓扑结构数据库的信息,标题行的解释如下:
① Link ID:是指 Link State ID,代表整个路由器,而不是某个链路;
② ADV Router:是指通告链路状态信息的路由器 ID;
③ Age:老化时间;
④ Seq#:序列号;
⑤ Checksum:校验和;
⑥ Link count:通告路由器在本区域内的链路数目。

 

Tags: OSPF  协议  思科  cisco  路由器 
本文未看懂?联系冠威客服,享受手把手服务,远程、现场任您选。优惠期间,免费服务!
有更好的解决方案?联系冠威客服,加入冠威,成为冠威客。发表文章,赚取佣金!
冠威客服:E-mail:Service@GuanWei.Org QQ:1026092 合作伙伴:淘男网
分类:Cisco笔记 | 评论:0 | 引用:0
分享到:

上一篇:COBIT4.1简体中文版(PDF)免费下载地址 by ISACA
下一篇:OSPF路由协议简介

或许你还对下面的文章感兴趣

Comments

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Hot Articles

New Articles

Last Comments

Guest