学习掌握
ospf
单区域配置
实验拓扑:
R1
上的基本配置
R1(config)#int s2/1
R1(config-if)#ip ad 12.0.0.1 255.255.255.0
R1(config-if)#no sh
R1(config)#int lo 0
R1(config-if)#ip ad 1.1.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#router ospf 64
R1(config-router)#net 1.1.1.1 0.0.0.0 area 0
R1(config-router)#net 12.0.0.0 0.0.0.255 area 0
R1#sh ip route
查看路由信息
34.0.0.0/24 is subnetted, 1 subnets
O 34.0.0.0 [110/192] via 12.0.0.2, 00:00:24, Serial2/1
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
5.0.0.0/32 is subnetted, 1 subnets
O 5.5.5.5 [110/257] via 12.0.0.2, 00:00:24, Serial2/1
23.0.0.0/24 is subnetted, 1 subnets
O 23.0.0.0 [110/128] via 12.0.0.2, 00:00:24, Serial2/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.0.0.0 is directly connected, Serial2/1
45.0.0.0/24 is subnetted, 1 subnets
O 45.0.0.0 [110/256] via 12.0.0.2, 00:00:24, Serial2/1
R1#sh ip ospf int s2/1
查看接口下的信息
Serial2/1 is up, line protocol is up
Internet Address 12.0.0.1/24, Area 0
接口在
ospf
区域
0
下
Process ID 64, Router ID 12.0.0.1, Network Type POINT_TO_POINT, Cost: 64 ospf
在
S
接口上
Cost
值默认
64
,网络类型为点到点型。
Transmit Delay is 1 sec, State POINT_TO_POINT,
延迟是
1
秒,
LSA
老化时间速度
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 hello
包发送间隔
10
秒,死亡时间
40
秒等待时间
40
,重传
5
秒。
oob-resync timeout 40
Hello due in 00:00:09
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 12.0.0.2
Suppress hello for 0 neighbor(s)
R1#sh ip ospf neighbor
查看
ospf
的邻居
Neighbor ID Pri State Dead Time Address Interface
12.0.0.2 0 FULL/ - 00:00:35 12.0.0.2 Serial2/1
R1#sh ip ospf stat
查看
ospf
的状态
Area 0: SPF algorithm executed 10 times
在
area 0
中
spf
算法已经计算了
10
次
SPF calculation time
计算的具体过程
Delta T Intra D-Intra Summ D-Summ Ext D-Ext Total Reason
00:37:12 0 0 0 0 0 0 0 R,
00:36:31 0 0 0 0 0 0 0 R,
00:35:20 0 0 0 0 0 0 0 R,
00:33:30 0 0 0 0 4 0 4 R,
00:32:55 0 0 0 0 4 0 4 R,
00:31:59 4 0 0 0 0 0 4 R,
00:31:01 4 0 0 0 0 0 4 R,
00:28:36 4 0 0 0 0 0 4 R,
00:23:08 4 0 0 0 0 0 4 R,
00:22:58 8 0 0 0 0 0 8 R,
R1#sh ip protocols
查看协议运行情况
Routing Protocol is "ospf 64"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 12.0.0.1
路由
id
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
1.1.1.1 0.0.0.0 area 0
12.0.0.0 0.0.0.255 area 0
Routing Information Sources:
Gateway Distance Last Update
5.5.5.5 110 00:21:18
12.0.0.2 110 00:21:18
34.0.0.1 110 00:21:18
45.0.0.1 110 00:21:18
Distance: (default is 110)
R1#sh ip ospf database
查看
ospf
数据库
OSPF Router with ID (12.0.0.1) (Process ID 64)
路由
ID12.0.0.1
进程
ID64
Router Link States (Area 0)
查看
r1
的
ospf
数据库中
router link
类型
LSA
源地址
时间
序列号
校验
Link ID ADV Router Age Seq# Checksum Link count
5.5.5.5 5.5.5.5 1759 0x80000004 0x00C8FF 3
12.0.0.1 12.0.0.1 81 0x80000005 0x0090B9 3
12.0.0.2 12.0.0.2 507 0x80000004 0x0077F5 4
34.0.0.1 34.0.0.1 366 0x80000004 0x00B951 4
45.0.0.1 45.0.0.1 1759 0x80000002 0x00626D 4
R1#sh ip ospf database da
R1#sh ip ospf database database-summary
OSPF Router with ID (12.0.0.1) (Process ID 64)
Area 0 database summary area 0
的汇总,在此共有有
LSA
类型
5
类
LSA Type Count Delete Maxage
Router 5 0 0
Network 0 0 0
Summary Net 0 0 0
Summary ASBR 0 0 0
Type-7 Ext 0 0 0
Opaque Link 0 0 0
Opaque Area 0 0 0
Subtotal 5 0 0
Process 64 database summary
进程
64
的汇总,在此共有有
LSA
类型
5
类
LSA Type Count Delete Maxage
Router 5 0 0
Network 0 0 0
Summary Net 0 0 0
Summary ASBR 0 0 0
Type-7 Ext 0 0 0
Opaque Link 0 0 0
Opaque Area 0 0 0
Type-5 Ext 0 0 0
Opaque AS 0 0 0
Total 5 0 0
R1#sh ip ospf database router 12.0.0.1
查看路由器
ID
为
12.0.0.1
的路由数据库信息
OSPF Router with ID (12.0.0.1) (Process ID 64)
同上
Router Link States (Area 0)
LS age: 513
Options: (No TOS-capability, DC)
LS Type: Router Links LSA
Link State ID: 12.0.0.1
Advertising Router: 12.0.0.1
LS Seq Number: 80000005
Checksum: 0x90B9
Length: 60
Number of Links: 3 3
条链路
Link connected to: a Stub Network STUB
区域
(Link ID) Network/subnet number: 1.1.1.1
网络号
1.1.1.1
(Link Data) Network Mask: 255.255.255.255
掩码
255.255.255.255
Number of TOS metrics: 0
TOS 0 Metrics: 1
Link connected to: another Router (point-to-point)
连接网路类型点到点
(Link ID) Neighboring Router ID: 12.0.0.2
邻居路由
ID
(Link Data) Router Interface address: 12.0.0.1
Number of TOS metrics: 0
TOS 0 Metrics: 64
Link connected to: a Stub Network
(Link ID) Network/subnet number: 12.0.0.0
网络号
12.0.0.0
(Link Data) Network Mask: 255.255.255.0
掩码
255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 64
R2
基本配置
R2
路由器上的基本配置
R2(config)#int s2/1
R2(config-if)#ip ad 12.0.0.2 255.255.255.0
R2(config-if)#no sh
R2(config)#int s2/2
R2(config-if)#ip ad 23.0.0.1 255.255.255.0
R2(config-if)#no sh
R2(config)#router ospf 64
宣告
R2(config-router)#net 12.0.0.0 0.0.0.255 area 0
R2(config-router)#net 23.0.0.0 0.0.0.255 area 0
R3
的基本配置
R3(config)#int s2/1
R3(config-if)#ip ad 23.0.0.2 255.255.255.0
R3(config-if)#no sh
R3(config-if)#int s2/2
R3(config-if)#ip ad 34.0.0.1 255.255.255.0
R3(config-if)#no sh
R3(config-if)#router ospf 64
宣告
R3(config-router)#net 23.0.0.0 0.0.0.255 area 0
R3(config-router)#net 34.0.0.0 0.0.0.255 area 0
R4
基本配置
R4(config)#int s2/1
R4(config-if)#ip ad 34.0.0.2 255.255.255.0
R4(config-if)#no sh
R4(config-if)#int s2/2
R4(config-if)#ip ad 45.0.0.1 255.255.255.0
R4(config-if)#no sh
R4(config-if)#router ospf 64
宣告
R4(config-router)#net 34.0.0.0 0.0.0.255 area 0
R4(config-router)#net 45.0.0.0 0.0.0.255 area 0
R5
基本配置
R5(config-if)#int lo 0
R5(config-if)#ip ad 5.5.5.5 255.255.255.0
R5(config-if)#no sh
R5(config-router)#int s2/2
R5(config-if)#ip ad 45.0.0.3 255.255.255.0
R5(config-if)#no sh
R5(config)#router ospf 64
宣告
R5(config-router)#net 45.0.0.0 0.0.0.255 area 0
R5(config-router)#net 5.5.5.5 0.0.0.0 area 0
本文出自 “卖血上网的博客” 博客,谢绝转载!