CCNP9-OSPF 网络类型,不规则区域

一、loopback,环回

1,接口
环回接口
2,hello时间
不发hello包
3,是否自动建立邻居
不建立邻居
4,是否选举DR
无DR
5,特点
传递的为32位的主机路由,metric值为1,metric不会因为带宽的改变而改变
不能将其他的接口修改为loopback接口

查看R1环回接口的网络类型

R1#sho ip ospf interface lo0
Loopback0 is up, line protocol is up 
  Internet Address 1.1.1.1/24, Area 1 
  Process ID 100, Router ID 91.1.1.1, Network Type LOOPBACK , Cost: 1
  Enabled by interface config, including secondary ip addresses
  Loopback interface is treated as a stub Host

在R2上查看ospf路由

R2#sho ip route ospf 
多余的省略
     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/65] via 12.1.1.1, 00:00:55, Serial1/0

可以看到R1的环回接口是一个32位的主机路由,但是我们的目的是使用R1的环回接口模拟一个网段,因此可以将此接口的网络类型改为point-to-point来还原网络的真实掩码

R1(config)#int lo0
R1(config-if)#ip ospf network point-to-point 

R2#sho ip route ospf 
多余的省略
     1.0.0.0/24 is subnetted, 1 subnets
O       1.1.1.0 [110/65] via 12.1.1.1, 00:00:02, Serial1/0

二、point-to-point,点对点

1,接口
串行接口
2,hello时间
10s 40s
3,是否自动建立邻居
可以
4,是否选举DR
不选DR
5,特点

查看

R1#sho ip ospf interface s1/1
Serial1/1 is up, line protocol is up 
  Internet Address 12.1.1.1/24, Area 1 
  Process ID 100, Router ID 91.1.1.1, Network Type POINT_TO_POINT, Cost: 64
  Enabled by interface config, including secondary ip addresses
  Transmit Delay is 1 sec, State POINT_TO_POINT
  Timer intervals configured, Hello 10, Dead 40

三、BMA,广播型多路访问

1,接口
以太网
2,hello时间
10s 40s
3,是否自动建立邻居
可以
4,是否选举DR

5,特点
MA网络中产生二类lsa,一类lsa不完整

查看

R3#sho ip ospf interface f0/0
FastEthernet0/0 is up, line protocol is up 
  Internet Address 34.1.1.1/24, Area 0 
  Process ID 100, Router ID 93.3.3.3, Network Type BROADCAST, Cost: 1
  Enabled by interface config, including secondary ip addresses
  Transmit Delay is 1 sec, State BDR, Priority 1
  Designated Router (ID) 94.4.4.4, Interface address 34.1.1.2
  Backup Designated router (ID) 93.3.3.3, Interface address 34.1.1.1
  Timer intervals configured, Hello 10, Dead 40

四、NBMA,非广播型多路访问

不允许出现广播
1,接口
帧中继物理接口,MGRE(多点通用路由封装)
2,hello时间
30s 120s
3,是否自动建立邻居
手工指定单播邻居
4,是否选举DR
选举DR
5,特点

查看

R1(config)#int s1/1
R1(config-if)#ip ospf network non-broadcast 
R1(config-if)#en
R1#sho ip ospf interface s1/1
Serial1/1 is up, line protocol is up 
  Internet Address 12.1.1.1/24, Area 1 
  Process ID 100, Router ID 91.1.1.1, Network Type NON_BROADCAST, Cost: 64
  Enabled by interface config, including secondary ip addresses
  Transmit Delay is 1 sec, State WAITING, Priority 1
  No designated router on this network
  No backup designated router on this network
  Timer intervals configured, Hello 30, Dead 120, Wait 120
R2(config)#int s1/0
R2(config-if)#ip ospf network non-broadcast 

手工指邻居

R1(config)#router ospf 100
R1(config-router)#neighbor 12.1.1.2

R2(config)#router ospf 100
R2(config-router)#neighbor 12.1.1.1

R1#sho ip ospf neighbor 
Neighbor ID     Pri   State           Dead Time   Address         Interface
92.2.2.2          1   FULL/BDR        00:01:53    12.1.1.2        Serial1/1

R2#sho ip ospf neighbor 
Neighbor ID     Pri   State           Dead Time   Address         Interface
91.1.1.1          1   FULL/DR         00:01:57    12.1.1.1        Serial1/0

注意要选举DR

在MGRE网络中

在这里插入图片描述
MGRE–多点GRE 属于NBMA网络类型
若需要同时将多个网络通过普通的tunnel合成为一个整体网络,tunnel接口的数量、网段的数量和路由条目数量指数上升,造成资源浪费和管理难度;
MGRE可以将多个网络通过一条tunnel来实现;
优点:
1、每个站点仅需配置一个tunnel接口;所有分支站点物理接口ip地址可以动态变化;
2、所有分支节点仅和中心节点建立tunnel,但也可以直接和其他分支站点直接通讯;
原理:
1、中心站点,固定的公有ip地址;建议定义为NHRP的server为中心站点;
2、tunnel配置完成,所有的分支站点将自己当下的信息发送到NHRP的server处,生成映射列表;
3、此时中心站点可以直接和所有的分支站点进行GRE通讯;分支站点间直接GRE通讯时,需要先到NHRP的server处下载映射列表,之后再进行GRE通讯;

R5为ISP,在R1,R2,R3之间起MGRE
1,先保证路由能通,在R1,R2,R3上写指向R5的缺省

R1(config)#ip route 0.0.0.0 0.0.0.0 15.1.1.2
R2(config)#ip route 0.0.0.0 0.0.0.0 25.1.1.2
R3(config)#ip route 0.0.0.0 0.0.0.0 35.1.1.2

2,起MGRE

中心站点:R1
R1(config)#int tunnel 0	//建立tunnel接口
R1(config-if)#ip address 10.1.1.1 255.255.255.0	//接口地址
R1(config-if)#tunnel source 15.1.1.1            //源地址,固定共有IP地址
R1(config-if)#tunnel mode gre multipoint 		//模式为点到多点
R1(config-if)#ip nhrp map multicast dynamic 	//本地为NHRP的服务器
R1(config-if)#ip nhrp network-id 100			//所有站点必须处于同一ID内
分支:R2
R2(config)#int tunnel 0
R2(config-if)#ip address 10.1.1.2 255.255.255.0
R2(config-if)#tunnel source s1/1				//源为连接ISP的接口
R2(config-if)#tunnel mode gre multipoint 
R2(config-if)#ip nhrp nhs 10.1.1.1				//NHRP的服务器地址,此处必须为tunnel口地址
R2(config-if)#ip nhrp map 10.1.1.1 15.1.1.1		//映射tunnel接口的公网地址
R2(config-if)#ip nhrp network-id 100
R2(config-if)#en
R2#ping 10.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:
!!!!!	
分支:R3
R3(config)#int tunnel 0
R3(config-if)#ip address 10.1.1.3 255.255.255.0
R3(config-if)#tunnel source s1/1
R3(config-if)#tunnel mode gre multipoint 
R3(config-if)#ip nhrp nhs 10.1.1.1
R3(config-if)#ip nhrp map 10.1.1.1 15.1.1.1
R3(config-if)#ip nhrp network-id 100
R3(config-if)#en
R3#ping 10.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:
!!!!!

此时,在R1,R2,R3上起ospf

R1(config)#router ospf 100
R1(config-router)#router-id 91.1.1.1
R1(config-router)#network 10.1.1.1 0.0.0.0 area 0

R2(config)#router ospf 100
R2(config-router)#router-id 92.2.2.2
R2(config-router)#network 10.1.1.2 0.0.0.0 area 0

R3(config)#router ospf 100
R3(config-router)#router-id 93.3.3.3
R3(config-router)#network 10.1.1.3 0.0.0.0 area 0

查看邻居

R2#sho ip ospf neighbor 
Neighbor ID     Pri   State           Dead Time   Address         Interface
91.1.1.1          0   INIT/  -        00:00:32    10.1.1.1        Tunnel0

R3#sho ip ospf neighbor 
Neighbor ID     Pri   State           Dead Time   Address         Interface
91.1.1.1          0   INIT/  -        00:00:33    10.1.1.1        Tunnel0

发现邻居卡在init状态,这是因为ospf是以组播方式发送数据,而在MGRE网路中若希望分支节点可以以组播或广播地址为目标ip,那么需要定义流量的具体目标

R2(config)#int tunnel 0
R2(config-if)#ip nhrp map ?
  A.B.C.D    IP address of destination
  group      NHRP group mapping
  multicast  Use this NBMA mapping for broadcasts/multicasts
R2(config-if)#ip nhrp map multicast 15.1.1.1

R3(config)#int tunnel 0
R3(config-if)#ip nhrp map multicast 15.1.1.1

改完之后,发现R1一直弹日志,邻居翻滚,这是因为MGRE接口默认的工作方式point-to-point;该工作方式只能允许建立一个邻居关系,而MGRE构建的又是一个MA网络,存在多个邻居,导致邻居关系不停翻滚;
解决方法:只能修改接口的工作方式

R1(config)#int tunnel 0
R1(config-if)#ip ospf network ?
  broadcast            Specify OSPF broadcast multi-access network
  non-broadcast        Specify OSPF NBMA network
  point-to-multipoint  Specify OSPF point-to-multipoint network
  point-to-point       Specify OSPF point-to-point network

1、修改接口工作方式为broadcast;
由于broadcast和point-to-point的hello time均为10s,故可以建立邻居,但在DR/BDR选择上不同;故即使建立邻居关系,也不能正常收敛;所以需要将该NBMA网段中所有的接口均修改为broadcast;
:在NBMA网络若使用broadcast的工作方式,需要关注拓扑结构
1) 星型结构(中心到站点)—DR位置问题 需要解决 中心点为DR,不要BDR
2) 全连网状结构(该网段内所有节点间均为正常的邻居关系) 正常选择一个DR/BDR即可
3) 部分网状结构(该网段内部分节点间为邻居关系,但又不是的星型接口) --根据实际情况来判断DR的位置需求
2、修改该网段内所有接口的工作方式为point-to-multipoint;
point-to-multipoint hello time 30s,自动建邻,不选DR/BDR;从哪个邻居学习到LSA,路由下一跳指向该邻居;
该工作方式为手工设定,缺点是没有DR/BDR选举规则;在全连网状结构中将导致重复更新;
总结(建议):
1、星型结构使用broadcast,将DR定义在中心站点;
也可使用point-to-multipoint,DR位置不好定的时候;
2、全连网状结构使用broadcast,正常选举DR/BDR;
3、部分网状结构使用point-to-multipoint
故在这里,将三个路由器隧道接口的工作方式改为broadcast,并且,让R2,R3放弃选举DR,即可。

R1(config-if)#ip ospf network broadcast

R2(config-if)#ip ospf network broadcast 
R2(config-if)#ip ospf priority 0

R3(config-if)#ip ospf network broadcast 
R3(config-if)#ip ospf priority 0

这时查看邻居

R1#sho ip ospf neighbor 
Neighbor ID     Pri   State           Dead Time   Address         Interface
92.2.2.2          0   FULL/DROTHER    00:00:33    10.1.1.2        Tunnel0
93.3.3.3          0   FULL/DROTHER    00:00:38    10.1.1.3        Tunnel0

R2#sho ip ospf neighbor 
Neighbor ID     Pri   State           Dead Time   Address         Interface
91.1.1.1          1   FULL/DR         00:00:39    10.1.1.1        Tunnel0

R3#sho ip ospf neighbor 
Neighbor ID     Pri   State           Dead Time   Address         Interface
91.1.1.1          1   FULL/DR         00:00:31    10.1.1.1        Tunnel0

五、point-to-multipoint

1,接口

2,hello时间
30s 120s
3,是否自动建立邻居
可以
4,是否选举DR
无DR
5,特点
学习对方主机路由

六、point-to-multipoint non-broadcast

1,接口
没有
2,hello时间
30s 120s
3,是否自动建立邻居
不可以,需要手工指定邻居
4,是否选举DR
无DR
5,特点
学习对方主机路由

OSPF网络类型总结

接口类型hello时间是否自动建立邻居是否选举DR特点
环回环回接口不发hloo包不建邻居传递的为32位的主机路由,metric值为1,metric不会因为带宽的改变而改变不能将其他的接口修改为loopback接口
点到点串行接口,GRE接口10s 40s自动
BMA(broadcast)以太网10s 40s自动MA网络中产生二类lsa,一类lsa不完整
NMBAMGRE30s 120s手工指定
点到多点MGRE30s 120s自动学习对方主机路由
点多多点非广播MGRE30s 120s手工指定学习对方主机路由

注:点到点和BMA两个接口可以建立邻居(满足条件),但是路由不加表,因为MA网络中的一类lsa不完整,点到点中的一类lsa是完整的,两者结合起来并不能计算出路径,ospf算法无法运作。

七、OSPF不规则区域的解决方法

1,存在不唯一的0区域
2,非骨干区域没有连接到骨干区域上
在这里插入图片描述

area0R1的lo0口
area1R1的s1/1,R2的s1/0,lo0
area2R2的f0/0,R3的lo0,f0/0

解决方法:

1,ospf双进程重发布

在R2上起两个ospf进程,将左边区域的路由重发布进右边区域,将右边区域的路由重发布进左边区域。
注意:需要将R2的f0/0口宣告进第二个ospf进程

R2(config)#router ospf 200
R2(config-router)#router-id 2.2.2.2
R2(config-router)#int f0/0
R2(config-if)#ip ospf 200 area 2

在R2上进行重发布

R2(config)#router ospf 100
R2(config-router)#redistribute ospf 200 subnets 
R2(config-router)#router os 200
R2(config-router)#redistribute ospf 100 subnets 

之后查看R1和R3的路由

R1#sho ip route ospf 
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/65] via 12.1.1.2, 00:08:40, Serial1/1
     3.0.0.0/32 is subnetted, 1 subnets
O E2    3.3.3.3 [110/2] via 12.1.1.2, 00:00:21, Serial1/1
     23.0.0.0/24 is subnetted, 1 subnets
O E2    23.1.1.0 [110/1] via 12.1.1.2, 00:00:21, Serial1/1

R3#sho ip route ospf 
     1.0.0.0/32 is subnetted, 1 subnets
O E2    1.1.1.1 [110/65] via 23.1.1.1, 00:00:01, FastEthernet0/0
     2.0.0.0/24 is subnetted, 1 subnets
O E2    2.2.2.0 [110/1] via 23.1.1.1, 00:00:01, FastEthernet0/0
     12.0.0.0/24 is subnetted, 1 subnets
O E2    12.1.1.0 [110/64] via 23.1.1.1, 00:00:01, FastEthernet0/0

可以看出,路由完整

2,vritual-link虚链路

先恢复初始情况
因为R1属于area0和area1,R2属于area1和area2,所以在R1和R2的area1区域建立一条虚链路,将area0区域延长到area1
注:虚链路永远属于area0,且虚链路在非0区域做

R1(config)#router ospf 100
R1(config-router)#area 1 virtual-link 92.2.2.2 

R2(config)#router ospf 100
R2(config-router)#area 1 virtual-link 91.1.1.1

此时在R2上将会和R1由两个邻居,其中一个就是虚连接

R2#sho ip ospf neighbor 
Neighbor ID     Pri   State           Dead Time   Address         Interface
91.1.1.1          0   FULL/  -           -        12.1.1.1        OSPF_VL0
91.1.1.1          0   FULL/  -        00:00:34    12.1.1.1        Serial1/0
93.3.3.3          1   FULL/DR         00:00:35    23.1.1.2        FastEthernet0/0

优点:
1、没有新生网段和链路,故没有选路不佳的问题,只有物理选路
2、为了避免周期和触发信息对中间区域的影响,取消所有周期信息,周期的hello,每
30min一次的周期更新。
缺点:取消周期行为导致协议不可靠;路由不老化。

3,tunnel隧道

先恢复初始情况
在R1和R2之间建立一条虚拟隧道,用于连接area0和area2

R1(config)#int tunnel 1   //起tunnel接口
R1(config-if)#ip address 10.1.1.1 255.255.255.0 //tunnel接口地址
R1(config-if)#tunnel source 12.1.1.1			//源地址
R1(config-if)#tunnel destination 12.1.1.2		//目标地址
R1(config-if)#tunnel mode ipip 					//模式
R1(config-if)#ip ospf 100 area 2				//宣告到area2区域


R2(config)#int tunnel 1
R2(config-if)#ip address 10.1.1.2 255.255.255.0
R2(config-if)#tunnel source 12.1.1.2
R2(config-if)#tunnel destination 12.1.1.1
R2(config-if)#tunnel mode ipip 
R2(config-if)#ip ospf 100 area 2

此时查看R1路由

R1#sho ip route ospf 
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/65] via 12.1.1.2, 04:45:48, Serial1/1
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/1002] via 10.1.1.2, 00:02:26, Tunnel1
     23.0.0.0/24 is subnetted, 1 subnets
O       23.1.1.0 [110/1001] via 10.1.1.2, 00:02:26, Tunnel1
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值