登录站点

用户名

密码

OSPF动态路由协议基础配置

5已有 2057 次阅读  2012-05-22 08:51   标签基础  路由  blank  Gateway  target 

OSPF动态路由协议基础配置

OSPF协议简介:OSPF(Open Shortest Path First开放式最短路径优先)[1]是一个内部网关协议(Interior Gateway Protocol,简称IGP),用于在单一自治系统(autonomous system,AS)内决策路由。与RIP相比,OSPF是链路状态路由协议,而RIP是距离矢量路由协议。OSPF的协议管理距离(AD)是110。更多请参考百度百科OSPF»

  • 步骤一:配置各路由器的IP地址,并使用ping命令确认直连接口相互可以ping通。

R3(config)#interface lo 0
R3(config-if)#ip ospf network point-to-point

  • 步骤二:配置各路由器的OSPF协议。

R1(config)#router ospf 1
R1(config-router)#network 10.1.1.0 0.0.0.255 area 0
R1(config-router)#network 10.2.2.0 0.0.0.31 area 0
R1(config-router)#network 10.3.3.0 0.0.0.255 area 0
R1(config-router)#exit
R2(config)#router ospf 2
R2(config-router)#network 10.3.3.0 0.0.0.255 area 0
R2(config-router)#network 172.16.3.0 0.0.0.255 area 0
R2(config-router)#exit
R3(config)#router ospf 1
R3(config-router)#network 172.16.1.0 0.0.0.255 area 0
R3(config-router)#network 172.16.2.0 0.0.0.31 area 0
R3(config-router)#network 172.16.3.0 0.0.0.255 area 0
R3(config-router)#exit

  • 步骤三:在R1与R2上查看邻居表

R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
172.16.3.2 1 FULL/ – 00:00:33 10.3.3.2 Serial1/1
R1#
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
172.16.2.1 1 FULL/ – 00:00:39 172.16.3.1 Serial1/1
10.2.2.1 1 FULL/ – 00:00:30 10.3.3.1 Serial1/0
R2#

  • 步骤四:在R1上使用show ip ospf interface s1/1(或都其它接口)

R1#show ip ospf interface serial 1/1
Serial1/1 is up, line protocol is up
 Internet Address 10.3.3.1/24, Area 0
 Process ID 1, Router ID 10.2.2.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
  Hello due in 00:00:08
 Index 3/3, flood queue length 0
 Next 0×0(0)/0×0(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 172.16.3.2
 Suppress hello for 0 neighbor(s)
R1#

  • 步骤五:在R1上查看OSPF的属性

R1#show ip protocols
 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 10.2.2.1
 Number of areas in this router is 1. 1 normal 0 stub 0 nssa
 Maximum path: 4
 Routing for Networks:
  10.1.1.0 0.0.0.255 area 0
  10.2.2.0 0.0.0.31 area 0
  10.3.3.0 0.0.0.255 area 0
Routing Information Sources:
  Gateway Distance Last Update
  10.2.2.1 110 00:00:51
  172.16.3.2 110 00:00:51
  172.16.2.1 110 00:00:51
Distance: (default is 110)
R1#

  • 步骤六:在R1上查看路由表

R1#show ip route
Codes: C – connected, S – static, I – IGRP, 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, E – EGP
       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
       172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
     O 172.16.1.0 [110/129] via 10.3.3.2, 00:00:00, Serial1/1
     O 172.16.2.0 [110/129] via 10.3.3.2, 00:00:00, Serial1/1
     O 172.16.3.0 [110/128] via 10.3.3.2, 00:00:00, Serial1/1
      10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
     C 10.3.3.0/24 is directly connected, Serial1/1
     C 10.2.2.0/27 is directly connected, Loopback1
     C 10.1.1.0/24 is directly connected, Loopback0
R1#

分享 举报

发表评论 评论 (2 个评论)

涂鸦板