多区域OSPF
一..多区域ospf网络类型分骨干区域(area0),非骨干区域,外部区域,以及区域间链路信息。
二.多区域中,出现lsa1—5类链路信息。
三.OSPF的外部路由分为:类型1(在路由表前缀打“E1”表示)和类型2(在路由表中前缀打“E2”表示)。
四.Ospf区域外部路由“E1”“E2”metric计算区别。
一.拓扑搭建。
R1:
R1(config)#intlo0
R1(config-if)#ipadd1.1.1.1255.255.255.0
R1(config-if)#ints0/0
R1(config-if)#ipadd12.1.1.1255.255.255.0
R1(config)#routeros110
R1(config-router)#router-id1.1.1.1
R1(config-router)#network12.1.1.00.0.0.255area1
R1(config-router)#network1.1.1.00.0.0.255area1
R2:
R2(config)#intlo0
R2(config-if)#ipadd2.2.2.2255.255.255.0
R2(config)#ints0/0
R2(config-if)#ipadd23.1.1.1255.255.255.0
R2(config)#routeros110
R2(config-if)#ints0/1
R2(config-if)#ipadd12.1.1.2255.255.255.0
R2(config-router)#router-id2.2.2.2
R2(config-router)#network12.1.1.00.0.0.255area1
R2(config-router)#network2.2.2.00.0.0.255area0
R2(config-router)#network23.1.1.00.0.0.255area0
R3:
R3(config)#intlo0
R3(config-if)#ipadd3.3.3.3255.255.255.0
R3(config-if)#ints0/0
R3(config-if)#ipadd34.1.1.1255.255.255.0
R3(config-if)#ints0/1
R3(config-if)#ipadd23.1.1.2255.255.255.0
R3(config)#routeros110
R3(config-router)#router-id3.3.3.3
R3(config-router)#network23.1.1.00.0.0.255area0
R3(config-router)#network3.3.3.00.0.0.255area2
R3(config-router)#network34.1.1.00.0.0.255area2
R4:
R4(config)#intlo0
R4(config-if)#ipadd4.4.4.4255.255.255.0
R4(config-if)#ints0/1
R4(config-if)#ipadd34.1.1.2255.255.255.0
R4(config-if)#ints0/0
R4(config-if)#ipadd45.1.1.1255.255.255.0
R4(config)#routerrip
R4(config-router)#v2
R4(config-router)#network45.0.0.0
R4(config-router)#noauto-summary
R4(config)#routeros110
R4(config-router)#router-id4.4.4.4
R4(config-router)#network34.1.1.00.0.0.255area2
R4(config-router)#network4.4.4.00.0.0.255area2
R4(config)#routeros110
R4(config-router)#redistributeripsubnets
R5:
R5(config)#intlo0
R5(config-if)#ipadd5.5.5.5255.255.255.0
R5(config-if)#ints0/1
R5(config-if)#ipadd45.1.1.2255.255.255.0
R5(config)#routerrip
R5(config-router)#v2
R5(config-router)#noauto-summary
R5(config-router)#network45.0.0.0
R5(config-router)#network5.0.0.0
在R1上查看路由表:
R1#shiproos
34.0.0.0/24issubnetted,1subnets
OIA34.1.1.0[110/192]via12.1.1.2,00:55:00,Serial0/0
2.0.0.0/32issubnetted,1subnets
OIA2.2.2.2[110/65]via12.1.1.2,00:56:12,Serial0/0
3.0.0.0/32issubnetted,1subnets
OIA3.3.3.3[110/129]via12.1.1.2,00:55:10,Serial0/0
4.0.0.0/32issubnetted,1subnets
OIA4.4.4.4[110/193]via12.1.1.2,00:54:03,Serial0/0
5.0.0.0/24issubnetted,1subnets
OE25.5.5.0[110/20]via12.1.1.2,00:00:01,Serial0/0
23.0.0.0/24issubnetted,1subnets
OIA23.1.1.0[110/128]via12.1.1.2,00:55:57,Serial0/0
45.0.0.0/24issubnetted,1subnets
OE245.1.1.0[110/20]via12.1.1.2,00:00:01,Serial0/0
注:R1学习到其他区域间链路信息,路由前缀都是打OIA,ospf区域外的链路信息,路由前缀打OE2
R1查看ospf数据库:
R1#shiposdatabase
OSPFRouterwithID(1.1.1.1)(ProcessID110)
RouterLinkStates(Area1)area0类型LSA1
LinkIDADVRouterAgeSeq#ChecksumLinkcount
1.1.1.11.1.1.116460x800000040x0065F93
2.2.2.22.2.2.215760x800000030x0096D82
SummaryNetLinkStates(Area1)area1类型LSA3
LinkIDADVRouterAgeSeq#Checksum
2.2.2.22.2.2.215760x800000020x00F832
3.3.3.32.2.2.215760x800000020x004D99
4.4.4.42.2.2.215760x800000020x00A101
23.1.1.02.2.2.215760x800000020x008A50
34.1.1.02.2.2.215760x800000020x007D12
SummaryASBLinkStates(Area1)area1类型LSA4
LinkIDADVRouterAgeSeq#Checksum
4.4.4.42.2.2.21980x800000010x008B18
Type-5ASExternalLinkStates无Area类型LSA5
LinkIDADVRouterAgeSeq#ChecksumTag
5.5.5.04.4.4.42040x800000010x00BAC60
45.1.1.04.4.4.42050x800000010x000D540
注:
1.路由表中前缀打“OIA”路由:
area1中有lsa3链路信息(summary)
Linkid中表示是路由信息,而且是其他区域的链路信息,说明R1是通过lsa3学习到其他区域的路由。
Lsa3(summary)由ABR产生,描述ABR和某个本地区域的内部路由器之
间的链路信息。
2.路由表中前缀打“OE2”路由:
是通过LSA4学习到,由ASBR(R4)产生LSA5类链路信息。
R1是通过R2(ABR)路由器学习到其他区域路由信息。
R1#shiposborder-routers
OSPFProcess110internalRoutingTable
Codes:i-Intra-arearoute,I-Inter-arearoute
I4.4.4.4[192]via12.1.1.2,Serial0/0,ASBR,Area1,SPF4
i2.2.2.2[64]via12.1.1.2,Serial0/0,ABR,Area1,SPF4
二.分别查看R1/R2/R3OSPF路由表信息中(45.1.1.0/24)路由条目:
R1路由表:
R1#shiproos
34.0.0.0/24issubnetted,1subnets
OIA34.1.1.0[110/192]via12.1.1.2,01:30:58,Serial0/0
2.0.0.0/32issubnetted,1subnets
OIA2.2.2.2[110/65]via12.1.1.2,01:32:09,Serial0/0
3.0.0.0/32issubnetted,1subnets
OIA3.3.3.3[110/129]via12.1.1.2,01:31:08,Serial0/0
4.0.0.0/32issubnetted,1subnets
OIA4.4.4.4[110/193]via12.1.1.2,01:30:01,Serial0/0
5.0.0.0/24issubnetted,1subnets
OE25.5.5.0[110/20]via12.1.1.2,00:35:58,Serial0/0
23.0.0.0/24issubnetted,1subnets
OIA23.1.1.0[110/128]via12.1.1.2,01:31:54,Serial0/0
45.0.0.0/24issubnetted,1subnets
OE245.1.1.0[110/20]via12.1.1.2,00:35:58,Serial0/0
R2路由表:
R2#shiproos
34.0.0.0/24issubnetted,1subnets
OIA34.1.1.0[110/128]via23.1.1.2,01:31:07,Serial0/0
1.0.0.0/32issubnetted,1subnets
O1.1.1.1[110/65]via12.1.1.1,01:32:19,Serial0/1
3.0.0.0/32issubnetted,1subnets
OIA3.3.3.3[110/65]via23.1.1.2,01:31:17,Serial0/0
4.0.0.0/32issubnetted,1subnets
OIA4.4.4.4[110/129]via23.1.1.2,01:30:10,Serial0/0
5.0.0.0/24issubnetted,1subnets
OE25.5.5.0[110/20]via23.1.1.2,00:36:08,Serial0/0
45.0.0.0/24issubnetted,1subnets
OE245.1.1.0[110/20]via23.1.1.2,00:36:08,Serial0/0
R3路由表:
R3#shiproos
1.0.0.0/32issubnetted,1subnets
OIA1.1.1.1[110/129]via23.1.1.1,00:36:20,Serial0/1
2.0.0.0/32issubnetted,1subnets
O2.2.2.2[110/65]via23.1.1.1,01:31:15,Serial0/1
4.0.0.0/32issubnetted,1subnets
O4.4.4.4[110/65]via34.1.1.2,00:36:20,Serial0/0
5.0.0.0/24issubnetted,1subnets
OE25.5.5.0[110/20]via34.1.1.2,00:36:20,Serial0/0
12.0.0.0/24issubnetted,1subnets
OIA12.1.1.0[110/128]via23.1.1.1,00:36:20,Serial0/1
45.0.0.0/24issubnetted,1subnets
OE245.1.1.0[110/20]via34.1.1.2,00:36:20,Serial0/0
注:都是学习到同一外部路由,并且metric一样“20”,说明由R5过来外部路由“E2类型”metric=20,路由路径上不做累加。
可以通过命令R4(config-router)#redistributeripsubnetsmetric-type2metric(0-16777214)修改E2类型metric值。
-----------------------------------------------------------------------------------------------------
三.在R4上,把rip重分布ospf中外部路由类型改成“E1”
R4:
R4(config)#routeros110
R4(config-router)#redistributeripmetric-type1
分别在R1/R2/R3查看ospf路由表信息:
R1:
R1#shiproospf
34.0.0.0/24issubnetted,1subnets
OIA34.1.1.0[110/192]via12.1.1.2,01:50:58,Serial0/0
2.0.0.0/32issubnetted,1subnets
OIA2.2.2.2[110/65]via12.1.1.2,01:52:09,Serial0/0
3.0.0.0/32issubnetted,1subnets
OIA3.3.3.3[110/129]via12.1.1.2,01:51:08,Serial0/0
4.0.0.0/32issubnetted,1subnets
OIA4.4.4.4[110/193]via12.1.1.2,01:50:01,Serial0/0
5.0.0.0/24issubnetted,1subnets
OE15.5.5.0[110/212]via12.1.1.2,00:00:50,Serial0/0
23.0.0.0/24issubnetted,1subnets
OIA23.1.1.0[110/128]via12.1.1.2,01:51:54,Serial0/0
45.0.0.0/24issubnetted,1subnets
OE145.1.1.0[110/212]via12.1.1.2,00:00:49,Serial0/0
R2:
R2#shiproospf
34.0.0.0/24issubnetted,1subnets
OIA34.1.1.0[110/128]via23.1.1.2,01:51:10,Serial0/0
1.0.0.0/32issubnetted,1subnets
O1.1.1.1[110/65]via12.1.1.1,01:52:22,Serial0/1
3.0.0.0/32issubnetted,1subnets
OIA3.3.3.3[110/65]via23.1.1.2,01:51:20,Serial0/0
4.0.0.0/32issubnetted,1subnets
OIA4.4.4.4[110/129]via23.1.1.2,01:50:14,Serial0/0
5.0.0.0/24issubnetted,1subnets
OE15.5.5.0[110/148]via23.1.1.2,00:01:02,Serial0/0
45.0.0.0/24issubnetted,1subnets
OE145.1.1.0[110/148]via23.1.1.2,00:01:02,Serial0/0
R3:
R3#shiproos
1.0.0.0/32issubnetted,1subnets
OIA1.1.1.1[110/129]via23.1.1.1,00:56:26,Serial0/1
2.0.0.0/32issubnetted,1subnets
O2.2.2.2[110/65]via23.1.1.1,01:51:21,Serial0/1
4.0.0.0/32issubnetted,1subnets
O4.4.4.4[110/65]via34.1.1.2,00:56:26,Serial0/0
5.0.0.0/24issubnetted,1subnets
OE15.5.5.0[110/84]via34.1.1.2,00:01:13,Serial0/0
12.0.0.0/24issubnetted,1subnets
OIA12.1.1.0[110/128]via23.1.1.1,00:56:26,Serial0/1
45.0.0.0/24issubnetted,1subnets
OE145.1.1.0[110/84]via34.1.1.2,00:01:13,Serial0/0
注:ospf外部路由E1类型,是由路由路径入方向metric累加值。
(R3metric=20+R3S0/0的COST),以此知道到R2累加个R2S0/0的cost,到R1再累加R1S0/0的cost值。
同样可以通过命令可以通过命令R4(config-router)#redistributeripsubnetsmetric-type1metric(0-16777214)修改“E1”metric的。