学习掌握ospf单区域配置
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
实验拓扑:
<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />
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
转载于:https://blog.51cto.com/maixueshangwang/198860