BSCI—6:OSPF链路状态通告(LSA)与虚链路(Virtual Links)配置

一、OSPF的七种类型LSA详解
 
 1、路由器LSA (Router LSA):由区域内所有路由器产生,并且只能在本个区域内泛洪广播,这些最基本的LSA通告列出了路由器所有的链路和接口,并指明了它们的状态和沿每条链路方向出站的代价。

2、网络lsa (Network LSA):由区域内的DR或BDR路由器产生,报文包括DR和BDR连接的路由器的链路信息,网络LSA也仅仅在产生这条网络LSA的区域内部进行泛洪。

3、网络汇总LSA (Network Summary Lsa):由ABR产生,可以通知本区域内的路由器通往区域外的路由信息,在一个区域外部但是仍然在一个ospf自治系统内部的缺省路由也可以通过这种LSA来通告,如果一台ABR路由器经过骨干区域从其他的ABR路由器收到多条网络汇总LSA,那么这台始发的ABR路由器将会选择这些LSA通告中代价最低的LSA,并且将这个LSA的最低代价通告给与它相连的非骨干区域。

4、ASBR汇总LSA (ASBR Summary LSA):也是由ABR产生,但是它是一条主机路由,指向asbr路由器地址的路由。

5、自治系统外部LSA (Autonomous System External LSA):由ASBR产生,告诉相同自治区的路由器通往外部自治区的路径,自治系统外部LSA是惟一不和具体的区域相关联的lsa通告,将在整个自治系统中进行泛洪 6、组成员LSA (Group Membership LSA):目前不支持组播ospf (Mospf协议)

7、Nssa外部LSA (Nssa External LSA):由ASBR产生,几乎和LSA 5通告是相同的,但Nssa外部LSA通告仅仅在始发这个Nssa外部LSA通告的非纯末梢区域内部进行泛洪,在Nsa区域中,当有一个路由器是ASBR时,不得不产生LSA 5报文,但是Nssa中不能有LSA 5报文,所有ASBR产生LSA 7报文,发给本区域的路由器。
 
 

二、虚链路配置
 
思考:我们都知道在OSPF网络当中必需有一个骨干区域(AREA0),非骨干区域必需与骨干区域相连,但是我们在遇到网络扩容的情况下,比如两家公司网络合并,在此之前他们各自都有自己的骨干区域,那么在不重新做网的情况下如何使在一个网络两中有两个骨干区域互连呢?
 
实验拓扑如下:接口信息及IP信息已经标注,在R1与R2之间我们起AREA0,在R2与R3之间起AREA1,R3与R4之间还起AREA0,这是一个不合理的网络,一个OSPF网络不允许有两个区域0,但使用虚链路这项技术之后可以解决此问题.
BSCI—6:OSPF链路状态通告(LSA)与虚链路(Virtual Links)配置

步骤一:如图的示,配置4台路由器,并启用OSPF,是否会出错?
 
R1:
Router>
Router>en
Router#conf t
Router(config)#hostname R1
R1(config)#interface loopback 0
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R1(config-if)#int f0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#router ospf 1      //启用OSPF路由协议
R1(config-router)#router-id 1.1.1.1     //指定路由器ID
R1(config-router)#network 192.168.1.1 0.0.0.0 area 0     //发布网段
R1(config-router)#network 1.1.1.1 0.0.0.0 area 0
R1(config-router)#end
R1#
 
R2:
 
Router>
Router>en
Router#conf t
Router(config)#hostname R2
R2(config)#interface f0/0
R2(config-if)#ip address 192.168.1.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int f0/1
R2(config-if)#ip address 172.16.1.1 255.255.255.252
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#router ospf 1      //同上
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 192.168.1.2 0.0.0.0 area 0
R2(config-router)#network 172.16.1.0 0.0.0.3 area 1
R2(config-router)#end
R2#
 
R3:
Router>
Router>en
Router#conf t
Router(config)#hostname R3
R3(config)#interface f0/1
R3(config-if)#ip address 172.16.1.2 255.255.255.252
R3(config-if)#no sh
R3(config-if)#int f0/0
R3(config-if)#ip address 192.168.2.2 255.255.255.0
R3(config-if)#no sh
R3(config-if)#exit
R3(config)#router ospf 1     //同上
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 172.16.1.0 0.0.0.3 area 1
R3(config-router)#network 192.168.2.2 0.0.0.0 area 0
R3(config-router)#end
R3#

R4;
Router>
Router>en
Router#conf t
Router(config)#hostname R4
R4(config)#interface f0/0
R4(config-if)#ip address 192.168.2.1 255.255.255.0
R4(config-if)#no sh
R4(config-if)#int lo0
R4(config-if)#ip address 4.4.4.4 255.255.255.0
R4(config-if)#exit
R4(config)#router ospf 1     //同上
R4(config-router)#router-id 4.4.4.4
R4(config-router)#network 4.4.4.4 0.0.0.0 area 0
R4(config-router)#network 192.168.2.1 0.0.0.0 area 0
R4(config-router)#end
R4#

查看R2与R3路由表:
R2#show ip route 
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       i - IS-IS, 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
Gateway of last resort is not set
     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/2] via 192.168.1.1, 00:05:30, FastEthernet0/0
     172.16.0.0/30 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, FastEthernet0/1
C    192.168.1.0/24 is directly connected, FastEthernet0/0
//只有1.1.1.1的路由,而没有4.4.4.4的路由
 
------------------------------------------------------------------------------------------
R3#show ip route 
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       i - IS-IS, 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
Gateway of last resort is not set
     4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/2] via 192.168.2.1, 00:04:00, FastEthernet0/0
     172.16.0.0/30 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, FastEthernet0/1
C    192.168.2.0/24 is directly connected, FastEthernet0/0
R3#
//只有4.4.4.4的路由而没有1.1.1.1的路由
注:它们只能学习本路由器区域0的路由,可想而知R1与R4不可能互相学习.
 
 

步骤二:在区域1的两台路由器R2,R3配置虚链路,并查看路由表.

R2:
R2(config)#router ospf 1
R2(config-router)#area 1 virtual-link 3.3.3.3
//因为区域1中0区域之间的连接区域,所以在区域1上的路由分别指定对方的route-id。
R2(config-router)#end
R2#
 
R3:
R3(config)#router ospf 1
R3(config-router)#area 1 virtual-link 2.2.2.2
//同上
R3(config-router)#end
R3#
 
查看路由表:
R2#show ip route 
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       i - IS-IS, 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
Gateway of last resort is not set
     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/2] via 192.168.1.1, 00:15:46, FastEthernet0/0
     4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/3] via 172.16.1.2, 00:01:25, FastEthernet0/1
     172.16.0.0/30 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, FastEthernet0/1
C    192.168.1.0/24 is directly connected, FastEthernet0/0
O    192.168.2.0/24 [110/2] via 172.16.1.2, 00:01:25, FastEthernet0/1
R2#
//R2已经有R4上的4.4.4.4的路由

------------------------------------------------------------------------------------------
R3#show ip route 
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       i - IS-IS, 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
Gateway of last resort is not set
     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/3] via 172.16.1.1, 00:01:51, FastEthernet0/1
     4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/2] via 192.168.2.1, 00:11:18, FastEthernet0/0
     172.16.0.0/30 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, FastEthernet0/1
O    192.168.1.0/24 [110/2] via 172.16.1.1, 00:01:51, FastEthernet0/1
C    192.168.2.0/24 is directly connected, FastEthernet0/0
R3#
//R3也有R1上的1.1.1.1的路由
 
 
 
步骤三:查看R1与R4路由表,并且验证是否能拼能.
 
R1#show ip route 
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       i - IS-IS, 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
Gateway of last resort is not set
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/4] via 192.168.1.2, 00:04:52, FastEthernet0/0
     172.16.0.0/30 is subnetted, 1 subnets
O IA    172.16.1.0 [110/2] via 192.168.1.2, 00:18:02, FastEthernet0/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
O    192.168.2.0/24 [110/3] via 192.168.1.2, 00:04:52, FastEthernet0/0
R1#
 
------------------------------------------------------------------------------------------

 
R4#show ip route 
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       i - IS-IS, 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
Gateway of last resort is not set
     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/4] via 192.168.2.2, 00:05:33, FastEthernet0/0
     4.0.0.0/24 is subnetted, 1 subnets
C       4.4.4.0 is directly connected, Loopback0
     172.16.0.0/30 is subnetted, 1 subnets
O IA    172.16.1.0 [110/2] via 192.168.2.2, 00:15:00, FastEthernet0/0
O    192.168.1.0/24 [110/3] via 192.168.2.2, 00:05:33, FastEthernet0/0
C    192.168.2.0/24 is directly connected, FastEthernet0/0
R4#
 
在R4上验证:
R4#ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 21/50/81 ms
R4#
 
 
总结:但是虚链路始终不建议我们使用,因为它不稳定,它本身的设计也是针对这种不合理的网络结构!









本文转自 meiyanaa 51CTO博客,原文链接:http://blog.51cto.com/justim/269560,如需转载请自行联系原作者
上一篇:30亿元收购比特币公司 鲁亿通称不是炒概念


下一篇:.Net Micro Framework研究—模拟器改造