循序渐进 OSPF的详细剖析(三)
试验所用拓扑如下:
拓扑介绍:
分为Area 0 Area 1 和Area 2三个区域。R1的全部和R2的S0/0属于Area 1;r2的S0/1和R3的S0/0属于Area 0;R3的S0/1和R4的全部属于Area 2.每个路由器都设置有一个loop端口。
好了,让我们从OSPF的网络类型开始:
OSPF的网络类型
在上一篇文章中我们提到过:根据路由器所连接的物理网络不同,OSPF将网络划分为四种类型:
点到点型(Point-to-Point)、点到多点型(Point-to-MultiPoint)、广播多路访问型(Broadcast multiAccess)、非广播多路访问型(None Broadcast MultiAccess,NBMA)
多区域的OSPF其实很简单,只要注意正确分配网络到特定区域就OK了!
配置步骤如下:(路由器的基本配置省略)
R1
r1(config)#router ospf 100
r1(config-router)#network 192.168.1.0 0.0.0.255 area 1 分配网络到特定区域
r1(config-router)#network 172.16.1.0 0.0.0.255 area 1
r1(config-router)#network 10.1.1.0 0.0.0.255 area 1
r2(config)#router ospf 100
r2(config-router)#network 192.168.1.0 0.0.0.255 area 1 分配网络到特定区域
r2(config-router)#network 192.168.2.0 0.0.0.255 area 0
r2(config-router)#network 20.1.1.0 0.0.0.255 area1
R3
r3(config)#router ospf 100
r3(config-router)#network 192.168.2.0 0.0.0.255 area 0 分配网络到特定区域
r3(config-router)#network 192.168.3.0 0.0.0.255 area 2
r3(config-router)#network 30.1.1.0 0.0.0.255 area 0
r4(config)#router ospf 100
r4(config-router)#network 192.168.3.0 0.0.0.255 area 2 分配网络到特定区域
r4(config-router)#network 172.16.100.0 0.0.0.255 area 2
r4(config-router)#network 40.1.1.0 0.0.0.255 area 2
验证点到点OSPF的配置,PC1 和PC2之间能相互通讯。配置成功!
VPCS 1 >ping 172.16.100.2
172.16.100.2 icmp_seq=1 time=69.000 ms
172.16.100.2 icmp_seq=2 time=38.000 ms
172.16.100.2 icmp_seq=3 time=54.000 ms
172.16.100.2 icmp_seq=4 time=121.000 ms
172.16.100.2 icmp_seq=5 time=56.000 ms
接下来开始验证有关OSPF的网络类型的信息!
点到点型(Point-to-Point)
show ip ospf int s0/0查看OSPF的网络类型。如下显示,路由器间的网络类型是点到点型的网络。
Serial0/0 is up, line protocol is up
Internet Address 192.168.1.1/24, Area 1
Process ID 100, Router ID 10.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:05
Supports Link-local Signaling (LLS)
Index 3/3, 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 20.1.1.1
Suppress hello for 0 neighbor(s)
R1
r1#show ip ospf neighbor
20.1.1.1 0 FULL/ - 00:00:31 192.168.1.2 Serial0/0
r2#show ip ospf neighbor
30.1.1.1 0 FULL/ - 00:00:38 192.168.2.2 Serial0/1
10.1.1.1 0 FULL/ - 00:00:31 192.168.1.1 Serial0/0
r3#show ip ospf neighbor
20.1.1.1 0 FULL/ - 00:00:37 192.168.2.1 Serial0/0
40.1.1.1 0 FULL/ - 00:00:32 192.168.3.2 Serial0/1
r4#show ip ospf neighbor
30.1.1.1 0 FULL/ - 00:00:37 192.168.3.1 Serial0/0
R3
r3(config)#int s0/1
r3(config-if)#ip ospf network point-to-multipoint
r4(config)#int s0/0
r4(config-if)#ip ospf network point-to-multipoint
查看OSPF网络类型 ,网络类型已经更改为点到多点型。
Serial0/1 is up, line protocol is up
Internet Address 192.168.3.1/24, Area 2
Process ID 100, Router ID 30.1.1.1, Network Type POINT_TO_MULTIPOINT, Cost: 64
Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
oob-resync timeout 120
Hello due in 00:00:04
Supports Link-local Signaling (LLS)
Index 1/3, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 2
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 40.1.1.1
Suppress hello for 0 neighbor(s)
注意看,此处验证了在点到多点网络中也是不需要选举DR和BDR的。
R3
r3#show ip ospf neighbor
20.1.1.1 0 FULL/ - 00:00:33 192.168.2.1 Serial0/0
40.1.1.1 0 FULL/ - 00:01:42 192.168.3.2 Serial0/1
R4
r4#show ip ospf neighbor
30.1.1.1 0 FULL/ - 00:01:48 192.168.3.1 Serial0/0
r1(config)#int s0/0
r1(config-if)#ip ospf network broadcast
r2(config)#int s0/0
r2(config-if)#ip ospf network broadcast
Serial0/0 is up, line protocol is up
Internet Address 192.168.1.1/24, Area 1
Process ID 100, Router ID 10.1.1.1, Network Type BROADCAST, Cost: 64
Transmit Delay is 1 sec, State BDR, Priority 1
Designated Router (ID) 20.1.1.1, Interface address 192.168.1.2
Backup Designated router (ID) 10.1.1.1, Interface address 192.168.1.1
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:07
Supports Link-local Signaling (LLS)
Index 3/3, 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 20.1.1.1 (Designated Router)
Suppress hello for 0 neighbor(s)
R1
20.1.1.1 1 FULL/DR 00:00:31 192.168.1.2 Serial0/0
r2#show ip ospf neighbor
30.1.1.1 0 FULL/ - 00:00:33 192.168.2.2 Serial0/1
10.1.1.1 1 FULL/BDR 00:00:31 192.168.1.1 Serial0/0
r2(config)#int s0/1
r2(config-if)#ip ospf network non-broadcast
r3(config)#int s0/0
r3(config-if)#ip ospf network non-broadcast
命令为:
r2(config-router)#neighbor 192.168.2.2
r3(config-router)#neighbor 192.168.2.1
r2#show ip ospf int s0/1
Serial0/1 is up, line protocol is up
Internet Address 192.168.2.1/24, Area 0
Process ID 100, Router ID 20.1.1.1, Network Type NON_BROADCAST, Cost: 64
Transmit Delay is 1 sec, State BDR, Priority 1
Designated Router (ID) 30.1.1.1, Interface address 192.168.2.2
Backup Designated router (ID) 20.1.1.1, Interface address 192.168.2.1
Flush timer for old DR LSA due in 00:01:53
Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
oob-resync timeout 120
Hello due in 00:00:23
Supports Link-local Signaling (LLS)
Index 1/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 4 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 30.1.1.1 (Designated Router)
Suppress hello for 0 neighbor(s)
Neighbor ID Pri State Dead Time Address Interface
30.1.1.1 1 FULL/DR 00:01:46 192.168.2.2 Serial0/1
10.1.1.1 1 FULL/ - 00:00:34 192.168.1.1 Serial0/0
r3#show ip ospf neighbor
20.1.1.1 1 FULL/BDR 00:01:36 192.168.2.1 Serial0/0
40.1.1.1 0 FULL/ - 00:01:53 192.168.3.2 Serial0/1
验证OSPF的LSA类型
如下内容所示,
类型1(Router Link States)的LSA被扩散到区域内的所有路由器!
类型2( Net Link States)的LSA在广播和NBMA网络中生成的!
r1#show ip ospf database
10.1.1.1 10.1.1.1 43 0x80000002 0x00A30C 4
20.1.1.1 20.1.1.1 44 0x80000001 0x00A4EC 2
30.1.1.1 20.1.1.1 31 0x80000001 0x00A320
40.1.1.1 20.1.1.1 30 0x80000001 0x00A3D5
172.16.100.0 20.1.1.1 30 0x80000001 0x00F88A
192.168.2.0 20.1.1.1 41 0x80000001 0x007AFF
192.168.3.0 20.1.1.1 30 0x80000001 0x00F147
R1
r1#show ip ospf database
10.1.1.1 10.1.1.1 8 0x80000004 0x0045CC 3
20.1.1.1 20.1.1.1 9 0x80000003 0x006E7B 1
192.168.1.2 20.1.1.1 9 0x80000001 0x004250
30.1.1.1 20.1.1.1 359 0x80000001 0x00A320
40.1.1.1 20.1.1.1 165 0x80000001 0x00A3D5
172.16.100.0 20.1.1.1 165 0x80000001 0x00F88A
192.168.2.0 20.1.1.1 369 0x80000001 0x007AFF
192.168.3.1 20.1.1.1 179 0x80000001 0x006513
192.168.3.2 20.1.1.1 170 0x80000001 0x00DD59
R2
r2#show ip ospf database
20.1.1.1 20.1.1.1 21 0x80000004 0x007473 1
30.1.1.1 30.1.1.1 22 0x80000003 0x00B0F0 2
192.168.2.2 30.1.1.1 22 0x80000001 0x0091E1
10.1.1.1 20.1.1.1 461 0x80000001 0x00A82F
40.1.1.1 30.1.1.1 622 0x80000003 0x00C2EA
172.16.1.0 20.1.1.1 461 0x80000001 0x00BB6B
172.16.100.0 30.1.1.1 622 0x80000003 0x00189F
192.168.1.0 20.1.1.1 826 0x80000001 0x0085F5
192.168.3.1 30.1.1.1 638 0x80000001 0x008826
192.168.3.2 30.1.1.1 629 0x80000001 0x00016C
10.1.1.1 10.1.1.1 468 0x80000004 0x0045CC 3
20.1.1.1 20.1.1.1 468 0x80000003 0x006E7B 1
192.168.1.2 20.1.1.1 468 0x80000001 0x004250
30.1.1.1 20.1.1.1 19 0x80000001 0x00A320
40.1.1.1 20.1.1.1 20 0x80000001 0x00A3D5
172.16.100.0 20.1.1.1 20 0x80000001 0x00F88A
192.168.2.0 20.1.1.1 830 0x80000001 0x007AFF
192.168.3.1 20.1.1.1 20 0x80000001 0x006513
192.168.3.2 20.1.1.1 20 0x80000001 0x00DD59
末梢区域和完全末梢区域
我们把Area2设置为末梢区域。配置命令如下:
r3(config-router)#area 2 stub
r4(config-router)#area 2 stub
末梢区域不接受AS外部的路由信息。由于我们都处于同意AS内。所以这里就不验证了!
r1(config-router)#area 1 stub no-summary
r2(config-router)#area 1 stub no-summary
完全末梢区域不接受来自AS外部的路由汇总和来自AS中其他区域的汇总路由。
验证:如下所示LSA条目明显减少。这里验证了完全末梢区域的特点。
r1#show ip ospf database
10.1.1.1 10.1.1.1 123 0x80000009 0x00A16D 3
20.1.1.1 20.1.1.1 120 0x80000007 0x008463 1
192.168.1.2 20.1.1.1 120 0x80000004 0x005A37
0.0.0.0 20.1.1.1 125 0x80000001 0x00E73F
我们在R4上添加loop 1 IP地址为 40.1.0.1 255.255.255.0
Loop2 Ip地址为40.1.2.1 255.255.255.0
Loop3 Ip地址为40.1.3.1 255.255.255.0
在R2上查看路由表。我们看到R2的路由表的条目很长,怎样可以减少路由条目呢?这时就用到了路由汇总。
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
C 20.1.1.0 is directly connected, Loopback0
172.16.0.0/24 is subnetted, 2 subnets
O 172.16.1.0 [110/65] via 192.168.1.1, 00:15:08, Serial0/0
O IA 172.16.100.0 [110/129] via 192.168.2.2, 00:15:08, Serial0/1
40.0.0.0/32 is subnetted, 4 subnets
O IA 40.1.0.1 [110/129] via 192.168.2.2, 00:02:01, Serial0/1
O IA 40.1.1.1 [110/129] via 192.168.2.2, 00:15:08, Serial0/1
O IA 40.1.2.1 [110/129] via 192.168.2.2, 00:01:38, Serial0/1
O IA 40.1.3.1 [110/129] via 192.168.2.2, 00:01:18, Serial0/1
10.0.0.0/32 is subnetted, 1 subnets
O 10.1.1.1 [110/65] via 192.168.1.1, 00:15:08, Serial0/0
C 192.168.1.0/24 is directly connected, Serial0/0
C 192.168.2.0/24 is directly connected, Serial0/1
192.168.3.0/32 is subnetted, 2 subnets
O IA 192.168.3.2 [110/128] via 192.168.2.2, 00:15:10, Serial0/1
O IA 192.168.3.1 [110/64] via 192.168.2.2, 00:15:11, Serial0/1
30.0.0.0/32 is subnetted, 1 subnets
O 30.1.1.1 [110/65] via 192.168.2.2, 00:15:26, Serial0/1
r3(config-router)#area 2 range 40.1.0.0 255.255.252.0
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
C 20.1.1.0 is directly connected, Loopback0
172.16.0.0/24 is subnetted, 2 subnets
O 172.16.1.0 [110/65] via 192.168.1.1, 00:17:36, Serial0/0
O IA 172.16.100.0 [110/129] via 192.168.2.2, 00:17:36, Serial0/1
40.0.0.0/22 is subnetted, 1 subnets
O IA 40.1.0.0 [110/129] via 192.168.2.2, 00:00:30, Serial0/1
10.0.0.0/32 is subnetted, 1 subnets
O 10.1.1.1 [110/65] via 192.168.1.1, 00:17:36, Serial0/0
C 192.168.1.0/24 is directly connected, Serial0/0
C 192.168.2.0/24 is directly connected, Serial0/1
192.168.3.0/32 is subnetted, 2 subnets
O IA 192.168.3.2 [110/128] via 192.168.2.2, 00:17:36, Serial0/1
O IA 192.168.3.1 [110/64] via 192.168.2.2, 00:17:37, Serial0/1
30.0.0.0/32 is subnetted, 1 subnets
O 30.1.1.1 [110/65] via 192.168.2.2, 00:17:53, Serial0/1
本次试验中我们验证了:OSPF的区域类型;OSPF的网络类型;OSPF的LSA类型;末梢区域和完全末梢区域的特性以及OSPF的路由汇总。
怎么样,理论结合试验是不是会让我们对OSPF的理解更透彻呢!
循序渐进 OSPF的详细剖析(三)相关推荐
- 循序渐进 OSPF的详细剖析(四)
OSPF 虚链路在前文中我们曾经提到过:OSPF采用由两层组成的分层结构,所以要求所有的非主干区域都必须直接与主干区域连接.Area1和Area 2中路由不能直接相连.区域中传输的数据必须经过主干区域 ...
- sql replace替换多个字符_牛客网数据库SQL实战详细剖析(4150)
文章来源:大数据肌肉猿 作者:无精疯 这是一个系列文章,总共61题,分6期,有答案以及解题思路,并附上解题的一个思考过程.具体题目可参考牛客网的SQL实战模块:https://www.nowcoder ...
- libevent源码深度剖析三
libevent源码深度剖析三 --libevent基本使用场景和事件流程 张亮 1 前言 学习源代码该从哪里入手?我觉得从程序的基本使用场景和代码的整体处理流程入手是个不错的方法,至少从个人的经验上 ...
- 【es】es 分布式一致性原理剖析(三)-Data篇
1.概述 转载:Elasticsearch分布式一致性原理剖析(三)-Data篇 前言 "Elasticsearch分布式一致性原理剖析"系列将会对Elasticsearch的分布 ...
- sql not exists用法_牛客网数据库SQL实战详细剖析(5160)(更新完结)
文章来源:大数据肌肉猿 作者:无精疯 这是一个系列文章,总共61题,分6期,有答案以及解题思路,并附上解题的一个思考过程. 具体题目可参考牛客网的SQL实战模块: https://www.nowcod ...
- 二进制文件的读写详细剖析
一).一般问题 二进制文件与我们通常使用的文本文件储存方式有根本的不同.这样的不同很难用言语表达,自己亲自看一看,理解起来会容易得多.因此,我推荐学习二进制文件读写的朋友安装一款十六进制编辑器.这样的 ...
- 从特征分解到协方差矩阵:详细剖析和实现PCA算法
从特征分解到协方差矩阵:详细剖析和实现PCA算法 本文先简要明了地介绍了特征向量和其与矩阵的关系,然后再以其为基础解释协方差矩阵和主成分分析法的基本概念,最后我们结合协方差矩阵和主成分分析法实现数据降 ...
- 手把手教你读懂源码,View事件的注册和接收详细剖析
关于Android的Touch事件传递机制,只是知道事件传入Activity后的流程,但是这些事件是如何传递给Activity的一直模糊不清.现在再来好好回顾一遍,顺道整理一点儿东西出来,同时分享给大 ...
- 【Qt炫酷动画】1.easing官方demo详细剖析
文章目录 1.demo效果 2.demo项目构建 3.代码详细剖析 代码目录结构 代码实现 4.实现过程分析 1.demo效果 2.demo项目构建 打开Qt Creator,按照图上操作 使用Min ...
最新文章
- UA MATH566 统计理论2 C-R不等式简介
- 根据HttpServletRequest request 获取当前用户ip地址和ip所属区域
- pycharm怎么关联python_Python3 安装pylint 及与PyCharm关联
- Java VM –提防YoungGen空间
- 使用grep -v时候,想去除多个pattern
- 计算机网络之网络层:8、开放最短路径优先算法OSPF
- 初始化参数文件修改错误导致Oracle无法startup
- python 模板注入_SSTI模板注入
- Atitit. Atiposter 发帖机版本历史 编年史
- RSA非对称加密密钥生成方法
- 转动惯量与惯性矩(截面)比较
- 颜色码对照表(英文代码	形像颜色	HEX格式	RGB格式)
- RS-485串口通讯测试及四路集线器功能探究
- 车轮轨迹原理_方向盘与车轮轨迹图解,方向盘和车轮的动态图
- Ruoyi若依前后端分离框架【若依登录详细过程】
- Procmon.exe —— 强大的系统监视工具
- python项目之 路由器抓取器
- 仔细体验,我想从产品设计的角度分析分析微信的声音锁
- 移动端使用fiddler抓包步骤
- C++后端开发知识点总结