BSCI―8-(2):OSPF的特殊区域类型与配置

 

原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。 http://justim.blog.51cto.com/740099/271764

一、NSSA区域:

1.只有NSSA区域中才会现LSA7,可以存在ASBR,阻止LSA4/5

2.ABR将LSA7转成LSA5,传播到其他区域,这时,ABR也成为了ASBR,因为它也引入了LSA5,其它路由器看到LSA5的通告路由器是ABR。
 
 
二、实验拓扑如下:R1到R2属区域0,R2到R3属区域1并配置为NSSA区域,R1与R3分别运行RIP与EIGRP模拟OSPF外部路由,接口与IP地址信息如下所示.
BSCI―8-(2):OSPF的特殊区域类型与配置_第1张图片
 
步骤一:配置3台路由器及路由协议,并如图发布网段.
 
R1:
Router>
Router>en
Router#conf t
Router(config)#hostname R1
R1(config-line)#exit
R1(config)#interface 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)#interface loopback 0
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R1(config-if)#ip ospf network point-to-point    //防止学习32位的主机路由
R1(config-if)#int lo1
R1(config-if)#ip address 1.1.2.1 255.255.255.0
R1(config-if)#ip ospf network point-to-point    //防止学习32位的主机路由
R1(config-if)#exit
R1(config)#router ospf 1        //启用OSPF路由协议
R1(config-router)#router-id 1.1.1.1    //指定ROUTE-ID
R1(config-router)#network 192.168.1.1 0.0.0.0 area 0    //发布网段到区域0
R1(config-router)#exit
R1(config)#router rip     //启用RIP路由协议
R1(config-router)#version 2     //指定版本2
R1(config-router)#no auto-summary      //不要自动汇总
R1(config-router)#network 1.1.1.0    //发布网段
R1(config-router)#network 1.1.2.0    //同上
R1(config-router)#end
R1#
 

R2:
start
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)#exit
R2(config)#interface f0/1
R2(config-if)#ip address 192.168.2.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#interface loopback 0
R2(config-if)#ip address 2.2.1.1 255.255.255.0
R2(config-if)#ip ospf network point-to-point
R2(config-if)#int lo1
R2(config-if)#ip address 2.2.2.1 255.255.255.0
R2(config-if)#ip ospf network point-to-point
R2(config-if)#exit
R2(config)#router ospf 1     //启用OSPF路由协议
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 192.168.2.2 0.0.0.0 area 1
R2(config-router)#network 2.2.1.1 0.0.0.0 area 0   
R2(config-router)#network 2.2.2.1 0.0.0.0 area 0
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 192.168.2.1 255.255.255.0
R3(config-if)#no sh
R3(config-if)#exit
R3(config)#interface loopback 0
R3(config-if)#ip address 172.16.1.1 255.255.255.0
R3(config-if)#int lo1
R3(config-if)#ip address 172.16.2.1 255.255.255.0
R3(config-if)#exit
R3(config)#router ospf 1     //启用OSPF路由协议
R3(config-router)#router-id 3.3.3.3     //同上
R3(config-router)#network 192.168.2.1 0.0.0.0 area 1
R3(config-router)#exit
R3(config)#router eigrp 1
R3(config-router)#no auto-summary
R3(config-router)#network 172.16.1.0 0.0.0.255
R3(config-router)#network 172.16.2.0 0.0.0.255
R3(config-router)#end
R3#
 
 
 
步骤二:在R1与R3上进行路由的重发布,使得路由器能够互相学习外部路由.
 
R1(config)#router ospf 1
R1(config-router)#redistribute rip subnets    //将RIP重发布进OSPF
R1(config-router)#exit
R1(config)#router rip
R1(config-router)#redistribute ospf 1 metric 1     //将OSPF重发布进RIP度量为1
R1(config-router)#end
R1#
R3(config)#router ospf 1
R3(config-router)#redistribute eigrp 1 subnets     //将EIGRP重发布进OSPF
R3(config-router)#exit
R3(config)#router eigrp 1
R3(config-router)#redistribute ospf 1 metric 100000 5 255 1 1500
//将OSPF重发布进EIGRP,带宽=100000KM 廷迟=5 可靠性=255 负载=1 最大传输单元=1500
R3(config-router)#end
R3#
 
 

步骤三:将区域1配置为NSSA区域.
 
R2(config)#router ospf 1
R2(config-router)#area 1 nssa     //将区域1配置为NSSA
R2(config-router)#end
R2#
R3(config)#router ospf 1
R3(config-router)#area 1 nssa     //将区域1配置为NSSA
R3(config-router)#end
R3#
 
 

步骤四:在R1,R2与R3上分别验证
 
查看R1路由表:
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, 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
Gateway of last resort is not set
     1.0.0.0/24 is subnetted, 2 subnets
C       1.1.1.0 is directly connected, Loopback0
C       1.1.2.0 is directly connected, Loopback1
     2.0.0.0/24 is subnetted, 2 subnets
O       2.2.1.0 [110/2] via 192.168.1.2, 00:08:29, FastEthernet0/0
O       2.2.2.0 [110/2] via 192.168.1.2, 00:08:29, FastEthernet0/0
     172.16.0.0/24 is subnetted, 2 subnets
O E2    172.16.1.0 [110/20] via 192.168.1.2, 00:07:34, FastEthernet0/0
O E2    172.16.2.0 [110/20] via 192.168.1.2, 00:07:34, FastEthernet0/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
O IA 192.168.2.0/24 [110/2] via 192.168.1.2, 00:08:04, FastEthernet0/0
R1#    
//R1上可以学习到所有路由,因为它是正常区域,没有做任何配置,可以学习所以类型的LSA
 

查看R2路由表:
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, 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
Gateway of last resort is not set
     1.0.0.0/24 is subnetted, 2 subnets
O E2    1.1.1.0 [110/20] via 192.168.1.1, 00:04:19, FastEthernet0/0
O E2    1.1.2.0 [110/20] via 192.168.1.1, 00:04:19, FastEthernet0/0
     2.0.0.0/24 is subnetted, 2 subnets
C       2.2.1.0 is directly connected, Loopback0
C       2.2.2.0 is directly connected, Loopback1
     172.16.0.0/24 is subnetted, 2 subnets
O N2    172.16.1.0 [110/20] via 192.168.2.1, 00:04:19, FastEthernet0/1
O N2    172.16.2.0 [110/20] via 192.168.2.1, 00:04:19, FastEthernet0/1
C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.2.0/24 is directly connected, FastEthernet0/1
R2#
//有人肯定会说NSSA区域不是不会学习5类LSA吗,怎么多了2条E2的路由?
因为R2是NSSA的ABR,它所要做的事情就是将7类型LSA转成5类LSA并传播到区域间每个路由器,还有NSSA区域可以学习本区域引入的外部路由,上面两条N2的路由为从R3上EIGRP所学的外部路由.

查看R3路由表:
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, 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
Gateway of last resort is not set
     2.0.0.0/24 is subnetted, 2 subnets
O IA    2.2.1.0 [110/2] via 192.168.2.2, 00:13:21, FastEthernet0/1
O IA    2.2.2.0 [110/2] via 192.168.2.2, 00:13:21, FastEthernet0/1
     172.16.0.0/24 is subnetted, 2 subnets
C       172.16.1.0 is directly connected, Loopback0
C       172.16.2.0 is directly connected, Loopback1
O IA 192.168.1.0/24 [110/2] via 192.168.2.2, 00:13:21, FastEthernet0/1
C    192.168.2.0/24 is directly connected, FastEthernet0/1
R3#
//R3属于NSSA区域内,而非NSSA区域ABR,所以它就验证了NSSA区域不能学习其它区域引入的外部路由。
 
 
 
疑问:为什么在R2上面会发生7类LSA转5类LSA?
我们来看看R2的OSPF链路状态数据库:
R2#show ip ospf database
                Type-7 AS External Link States (Area 1)
Link ID         ADV Router      Age         Seq#       Checksum Tag
172.16.1.0      3.3.3.3         1501        0x80000001 0x00C09F 0
172.16.2.0      3.3.3.3         1501        0x80000001 0x00B5A9 0
                Type-5 AS External Link States
Link ID         ADV Router      Age         Seq#       Checksum Tag
1.1.1.0         1.1.1.1         483         0x80000002 0x00A3F4 0
1.1.2.0         1.1.1.1         484         0x80000002 0x0098FE 0
172.16.1.0      2.2.2.2         1495        0x80000001 0x0073FA 0
172.16.2.0      2.2.2.2         1495        0x80000001 0x006805 0
R2#

注:前面说过,只有NSSA区域存放7类LSA,所以7类LSA传播到其它区域根本就不识别,仔细看R2上5类与7类LSA的摘要,都存放了172.16.1.0与172.16.2.0,所以这就7类变5类LSA的转折点.
 
 
总结:相信通过这两篇文章,大家对OSPF的特殊区域有个比较好的认识与掌握.

你可能感兴趣的:(职场,Cisco,休闲,nass)