NA-NP-IE系列实验23: 点到点链路上的OSPF

简介:
实验23:点到点链路上的OSPF
1. 实验目的
通过本实验可以掌握:
1)在路由器上启动OSPF 路由进程
2)启用参与路由协议的接口,并且通告网络及所在的区域
3)度量值cost 的计算
4hello 相关参数的配置
5)点到点链路上的OSPF 的特征
6)查看和调试OSPF 路由协议相关信息
注:
OSPF 邻居关系不能建立的常见原因:
 hello 间隔和dead 间隔不同;
同一链路上的hello 包间隔和dead 间隔必须相同才能建立邻接关系。默认情况下,
hello 包发送间隔。
OSPF hello 间隔和dead 间隔
网络类型    Hello 间隔(秒) Dead 间隔(秒)
广播多路访问   10            40
非广播多路访问 30              120
点到点         10               40
点到多点         30            120
默认时Dead 间隔是Hello 间隔的四倍。可以在接口下通过“ip ospf hello-interval
和“ip ospf dead-interval”命令调整。
② 区域号码不一致;
③ 特殊区域(如stubnssa等)区域类型不匹配;
④ 认证类型或密码不一致;
⑤ 路由器ID 相同;
 Hello 包被ACL deny
⑦ 链路上的MTU 不匹配;
⑧ 接口下OSPF网络类型不匹配。
 
2. 实验拓扑
本实验的拓扑结构如图 所示。
3. 实验步骤
 
注:
1OSPF 路由进程ID 的范围必须在1-65535 之间,而且只有本地含义,不同路由器
的路由进程ID 可以不同。如果要想启动OSPF 路由进程,至少确保有一个接口是up 的;
2)区域ID 是在0-4294967295 内的十进制数,也可以是IP 地址的格式A.B.C.D。当
网络区域ID 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,这样可控性比较好。
配置如下:
r0(config)#int loo 1
r0(config-if)#ip add 1.1.
*Mar  1 00:00:48.091: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
r0(config-if)#ip add 1.1.1.1 255.255.255.0
r0(config-if)#int s0/0
r0(config-if)#ip add 172.16.1.1 255.255.255.0
r0(config-if)#no sh
r0(config-if)#
*Mar  1 00:01:11.147: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
r0(config-if)#
*Mar  1 00:01:12.151: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
r0(config-if)#
*Mar  1 00:01:32.715: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to down
r0(config-if)#
*Mar  1 00:02:22.711: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
r0(config-if)#exit
r0(config)#router ospf 1
r0(config-router)#net 1.1.1.0 0.0.0.255 area 0
r0(config-router)#net 172.16.1.0 0.0.0.255 area 0
r0(config-router)#        
*Mar  1 00:04:52.923: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on Serial0/0 from LOADING to FULL, Loading Done
r0(config-router)#do sh 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
 
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback1
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/65] via 172.16.1.2, 00:00:08, Serial0/0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/129] via 172.16.1.2, 00:00:08, Serial0/0
环回接口OSPF 路由条目的掩码长度都是32 位,这是环回接口的特性,尽管通告了
24 位,解决的办法是在环回接口下修改网络类型为“Point-to-Point”,
     172.16.0.0/24 is subnetted, 2 subnets
C       172.16.1.0 is directly connected, Serial0/0
O       172.16.2.0 [110/128] via 172.16.1.2, 00:00:08, Serial0/0
r0(config-router)#exit   
r0(config)#int loo 1
r0(config-if)#ip ospf net point-to-point
环回接口下修改网络类型为“Point-to-Point”,
r0(config-if)#do sh 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
 
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback1
     2.0.0.0/24 is subnetted, 1 subnets
O       2.2.2.0 [110/65] via 172.16.1.2, 00:00:01, Serial0/0
     3.0.0.0/24 is subnetted, 1 subnets
O       3.3.3.0 [110/129] via 172.16.1.2, 00:00:01, Serial0/0
     172.16.0.0/24 is subnetted, 2 subnets
C       172.16.1.0 is directly connected, Serial0/0
O       172.16.2.0 [110/128] via 172.16.1.2, 00:00:01, Serial0/0
r0(config-if)#do sh ip ospf nei
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           0   FULL/  -        00:00:37    172.16.1.2      Serial0/0
 
以上输出表明路由器R0 1个邻居,它们的路由器ID 分别为2.2.2.2,
它参数解释如下:
 Pri:邻居路由器接口的优先级;
 State:当前邻居路由器接口的状态;
 Dead Time:清除邻居关系前等待的最长时间;
 Address:邻居接口的地址;
 Interface:自己和邻居路由器相连接口;
⑥ “-”: 表示点到点的链路上OSPF 不进行DR 选举。
r0(config-if)#do sh ip pro
Routing Protocol is "ospf 1"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Router ID 1.1.1.1
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    1.1.1.0 0.0.0.255 area 0
    172.16.1.0 0.0.0.255 area 0
 Reference bandwidth unit is 100 mbps
  Routing Information Sources:
    Gateway         Distance      Last Update
    2.2.2.2              110      00:00:42
    3.3.3.3              110      00:00:42
  Distance: (default is 110)
 
r0(config-if)#do sh ip ospf int
Loopback1 is up, line protocol is up
  Internet Address 1.1.1.1/24, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type POINT_TO_POINT, Cost: 1
  Transmit Delay is 1 sec, State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
  Supports Link-local Signaling (LLS)
  Index 1/1, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 0, maximum is 0
  Last flood scan time is 0 msec, maximum is 0 msec
  Neighbor Count is 0, Adjacent neighbor count is 0
  Suppress hello for 0 neighbor(s)
Serial0/0 is up, line protocol is up
  Internet Address 172.16.1.1/24, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type POINT_TO_POINT, Cost: 64
  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:08
  Supports Link-local Signaling (LLS)
  Index 2/2, 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 2.2.2.2
  Suppress hello for 0 neighbor(s)
 
r0(config-if)#do sh ip ospf database
 
            OSPF Router with ID (1.1.1.1) (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         183         0x80000004 0x008878         3
2.2.2.2         2.2.2.2         160         0x80000004 0x0001CE         5
3.3.3.3         3.3.3.3         140         0x80000004 0x007473         3
 
以上输出是R0 的区域的拓扑结构数据库的信息,标题行的解释如下:
 Link ID:是指Link State ID,代表整个路由器,而不是某个链路;
 ADV Router:是指通告链路状态信息的路由器ID
 Age:老化时间;
 Seq#:序列号;
 Checksum:校验和;
 Link count:通告路由器在本区域内的链路数目。
 
r0(config-if)#do debug ip ospf packet
OSPF packet debugging is on
r0(config-if)#
*Mar  1 00:13:32.807: OSPF: rcv. v:2 t:1 l:48 rid:2.2.2.2
      aid:0.0.0.0 chk:E694 aut:0 auk: from Serial0/0
r0(config-if)#
*Mar  1 00:13:42.795: OSPF: rcv. v:2 t:1 l:48 rid:2.2.2.2
      aid:0.0.0.0 chk:E694 aut:0 auk: from Serial0/0
r0(config-if)#
*Mar  1 00:13:52.807: OSPF: rcv. v:2 t:1 l:48 rid:2.2.2.2
      aid:0.0.0.0 chk:E694 aut:0 auk: from Serial0/0
r0(config-if)#
*Mar  1 00:14:02.791: OSPF: rcv. v:2 t:1 l:48 rid:2.2.2.2
      aid:0.0.0.0 chk:E694 aut:0 auk: from Serial0/0
r0(config-if)#
*Mar  1 00:14:12.811: OSPF: rcv. v:2 t:1 l:48 rid:2.2.2.2
      aid:0.0.0.0 chk:E694 aut:0 auk: from Serial0/0
r0(config-if)#
*Mar  1 00:14:22.791: OSPF: rcv. v:2 t:1 l:48 rid:2.2.2.2
      aid:0.0.0.0 chk:E694 aut:0 auk: from Serial0/0
r0(config-if)#
*Mar  1 00:14:32.791: OSPF: rcv. v:2 t:1 l:48 rid:2.2.2.2
      aid:0.0.0.0 chk:E694 aut:0 auk: from Serial0/0
r0(config-if)#do un all
All possible debugging has been turned off
r0(config-if)#
 
 
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           0   FULL/  -        00:00:31    172.16.2.2      Serial0/1
1.1.1.1           0   FULL/  -        00:00:32    172.16.1.1      Serial0/0
 
 
r1(config)#int loo 1
r1(config-if)#ip add 2.2.2
*Mar  1 00:01:40.879: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
r1(config-if)#ip add 2.2.2.2 255.255.255.0
r1(config-if)#exit
r1(config)#int s0/0
r1(config-if)#ip add 172.16.1.2 255.255.255.0
r1(config-if)#no sh
r1(config-if)#exit
r1(config)#int s
*Mar  1 00:02:04.291: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
r1(config)#int s0/1
*Mar  1 00:02:05.295: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
r1(config)#int s0/1
r1(config-if)#ip add 172.16.2.1 255.255.255.0
r1(config-if)#no sh
r1(config-if)#
*Mar  1 00:02:18.995: %LINK-3-UPDOWN: Interface Serial0/1, changed state to up
r1(config-if)#
*Mar  1 00:02:19.999: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to up
r1(config-if)#
*Mar  1 00:02:42.911: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to down
r1(config-if)#
*Mar  1 00:03:42.907: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to up
r1(config-if)#exit
r1(config)#router ospf 1
r1(config-router)#net 172.16.1.0 0.0.0.255 area 0
r1(config-router)#net
*Mar  1 00:04:52.507: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on Serial0/0 from LOADING to FULL, Loading Done
r1(config-router)#net 172.16.2.0 0.0.0.255 area 0
r1(config-router)#net 2.
*Mar  1 00:05:01.055: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on Serial0/1 from LOADING to FULL, Loading Done
r1(config-router)#net 2.2.2.0 0.0.0.255 area 0
r1(config-router)#exit
r1(config)#int loo 1
r1(config-if)#ip ospf net point-to-p   
r1(config-if)#do sh ip ospf nei
 
r2(config)#int loo 1
r2(config-if)#ip add 3.3.3.3 255.255.255.0
r2(config-if)#int s0/0
r2(config-if)#ip add 172.16.2.2 255.255.255.0
r2(config-if)#no sh
r2(config-if)#exit
r2(config)#
*Mar  1 00:03:25.211: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
*Mar  1 00:03:26.211: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
r2(config)#router ospf 1
r2(config-router)#net 172.16.2.0 0.0.0.255 area 0
r2(config-router)#net 3.3.3.0 0.0.0.255 area 0
r2(config-router)#
*Mar  1 00:05:00.763: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on Serial0/0 from LOADING to FULL, Loading Done
r2(config-router)#exit
r2(config)#int loo 1
r2(config-if)#ip ospf net point-to-p
r2(config-if)#do sh ip ospf nei
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           0   FULL/  -        00:00:36    172.16.2.1      Serial0/0
r2(config-if)#
 
 
本文转自gauyanm 51CTO博客,原文链接:http://blog.51cto.com/gauyanm/237721,如需转载请自行联系原作者
相关文章
|
6月前
|
Web App开发 前端开发 JavaScript
|
1月前
|
存储 机器人
在阿里云RPA中,你可以通过以下步骤来更改默认唤醒IE浏览器的地址
【2月更文挑战第28天】在阿里云RPA中,你可以通过以下步骤来更改默认唤醒IE浏览器的地址
19 1
|
7月前
|
Web App开发 XML 编解码
IE浏览器下载文件中文文件名乱码问题解决
IE浏览器下载文件中文文件名乱码问题解决
84 0
|
4月前
|
Web App开发 JavaScript 前端开发
JavaScript在IE和标准浏览器下的兼容性处理
JavaScript在IE和标准浏览器下的兼容性处理
41 0
|
5月前
|
前端开发
border-radius 兼容 IE8浏览器
border-radius 兼容 IE8浏览器
40 1
|
5月前
|
Web App开发 移动开发 安全
IE浏览器,和Edge浏览器
IE浏览器,和Edge浏览器
|
5月前
|
JavaScript
兼容IE浏览器
兼容IE浏览器
31 0