OSPF 地址汇总试验报告 <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />



1. 实验拓扑:



ospf DN位置1 ospf地址汇总_网络





2. 实验目的: 2.1按照拓扑图正确连接三台路由器。



             2.2 正确配置相应的接口IP地址



             2.3 配置OSPF虚链路把不与主干区域相连的区域逻辑连接



                 ( Config-router)#area 区域号virtual-link 对方路由ID



             2.4配置OSPF区域汇总和外部路由汇总



2.5配置辅助地址
               (config-if)#ip add IP地址 掩码 secondary
                 注:只有主地址也运行OSPF时,才会通告辅助网络
                   OSPF 把辅助地址看成末梢区域,无法与辅助网络的路由建立邻接关系



3. 详细配置步骤:



Setp 1. 配置路由器 R1,R2.R3 相应的接口 IP 地址 , 及辅助地址:



R1 配置如下:



Router>en 
   
 
  
Router#conf t 
   
 
  
Router(config)#ho R1 
   
 
  
R1(config)#int s1/0 
   
 
  
R1(config-if)#ip add <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />10.1.1.1 255.255.255.0 
   
 
  
R1(config-if)#no shut 
   
 
  
R1(config-if)#exit 
   
 
  
R1(config)#int lo0 
   
 
  
R1(config-if)#ip add 1.1.1.1 255.255.255.0 
   
 
  
R1(config-if)#no shut 
   
 
  
R1(config-if)#exit 
   
 
  
R1(config)#



R2 配置如下:



Router>en 
   
 
  
Router#conf t 
   
 
  
Router(config)#ho R2 
   
 
  
R2(config)#int s1/0 
   
 
  
R2(config-if)#ip add 10.1.1.2 255.255.255.0 
   
 
  
R2(config-if)#no shut 
   
 
  
R2(config-if)#exit 
   
 
  
R2(config)#int s1/1 
   
 
  
R2(config-if)#ip add 11.1.1.1 255.255.255.0 
   
 
  
R2(config-if)#no shut 
   
 
  
R2(config-if)#exit 
   
 
  
R2(config)#int lo0 
   
 
  
R2(config-if)#ip add 2.2.2.2 255.255.255.0 
   
 
  
R2(config-if)#exit 
   
 
  
R2(config)#int lo1 
   
 
  
R2(config-if)#ip add 12.1.0.1 255.255.255.0 secondary 
   
 
  
R2(config-if)#ip add 12.2.0.1 255.255.255.0 secondary 
   
 
  
R2(config-if)#ip add 12.3.0.1 255.255.255.0 secondary 
   
 
  
R2(config-if)#ip add 12.4.0.1 255.255.255.0 secondary 
   
 
  
R2(config-if)#ip add 12.5.0.1 255.255.255.0 secondary 
   
 
  
R2(config-if)#ip add 12.6.0.1 255.255.255.0 secondary 
   
 
  
R2(config-if)#ip add 12.7.0.1 255.255.255.0 secondary 
   
 
  
R2(config-if)#ip add 12.0.0.1 255.255.255.0 
   
 
  
R2(config-if)#exit 
   
 
  
R2(config)#



 



R3 配置如下:



Router>en 
   
 
  
Router#conf t 
   
 
  
Router(config)#ho R3 
   
 
  
R3(config)#int s1/0 
   
 
  
R3(config-if)#ip add 11.1.1.2 255.255.255.0 
   
 
  
R3(config-if)#no shut 
   
 
  
R3(config-if)#exit 
   
 
  
R3(config)#int lo0 
   
 
  
R3(config-if)#ip add 3.3.3.3 255.255.255.0 
   
 
  
R3(config-if)#exit 
   
 
  
R3(config)#int lo1 
   
 
  
R3(config-if)#ip add 13.0.0.1 255.255.255.0 
   
 
  
R3(config-if)#ip add 13.1.0.1 255.255.255.0 secondary 
   
 
  
R3(config-if)#ip add 13.2.0.1 255.255.255.0 secondary 
   
 
  
R3(config-if)#ip add 13.3.0.1 255.255.255.0 secondary 
   
 
  
R3(config-if)#ip add 13.4.0.1 255.255.255.0 secondary 
   
 
  
R3(config-if)#ip add 13.5.0.1 255.255.255.0 secondary 
   
 
  
R3(config-if)#ip add 13.6.0.1 255.255.255.0 secondary 
   
 
  
R3(config-if)#ip add 13.7.0.1 255.255.255.0 secondary



step2 . 配置 OSPF 路由协议



R1 配置如下:



R1(config)#router ospf 7 
   
 
  
R1(config-router)#net 1.1.1.0 0.0.0.255 area 0 
   
 
  
R1(config-router)#net 10.1.1.0 0.0.0.255 area 0 
   
 
  
R1(config-router)#exit 
   
 
  
R1(config)# 
   
 
  
*Mar  1 00:13:26.943: %OSPF-5-ADJCHG: Process 7, Nbr 2.2.2.2 on Serial1/0 from L 
   
 
  
OADING to FULL, Loading Done



R2 配置如下:



R2(config)#router ospf 8 
   
 
  
R2(config-router)#router-id 2.2.2.2    //指定Router-id 
   
 
  
R2(config-router)#net 10.1.1.0 0.0.0.255 area 0 
   
 
  
R2(config-router)#net 11.1.1.0 0.0.0.255 area 1 
   
 
  
R2(config-router)#exit 
   
 
  
R2(config)#



R3 配置如下:


R3(config-if)#exit 
   
 
  
R3(config)#router ospf 9 
   
 
  
R3(config-router)#router-id 3.3.3.3         //指定Router-id 
   
 
  
R3(config-router)#net 11.1.1.0 0.0.0.255 area 1 
   
 
  
R3(config-router)#net 3.3.3.0 0.0.0.255 area 51 
   
 
  
R3(config-router)# network 13.0.0.0 0.0.255.255 area 51 
   
 
  
R3(config-router)# network 13.1.0.0 0.0.255.255 area 51 
   
 
  
R3(config-router)# network 13.2.0.0 0.0.255.255 area 51 
   
 
  
R3(config-router)# network 13.3.0.0 0.0.255.255 area 51 
   
 
  
R3(config-router)# network 13.4.0.0 0.0.255.255 area 51 
   
 
  
R3(config-router)# network 13.5.0.0 0.0.255.255 area 51 
   
 
  
R3(config-router)# network 13.6.0.0 0.0.255.255 area 51 
   
 
  
R3(config-router)# network 13.7.0.0 0.0.255.255 area 51 
   
 
  
R3(config-router)#



查看R1路由表:


R1#show ip rou 
   
 
  
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 
   
 
  
 
   
 
 
  
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 
   
 
  
     10.0.0.0/24 is subnetted, 1 subnets 
   
 
  
C       10.1.1.0 is directly connected, Serial1/0          
   
 
  
     11.0.0.0/24 is subnetted, 1 subnets 
   
 
  
O IA    11.1.1.0 [110/128] via 10.1.1.2, 00:01:12, Serial1/0 
   
 
  
// 此时R1还学习不到R3的路由信息



Step3.配置虚链路:


R2(config)#router ospf 8 
   
 
  
R2(config-router)#area 1 virtual-link 3.3.3.3 
   
 
  
R2(config-router)#exit 
   
 
  
R2(config)# 
   
 
  
 
   
 
 
  
R3(config)#router ospf 9 
   
 
  
R3(config-router)#area 1 virtual-link 2.2.2.2 
   
 
  
R3(config-router)#exit 
   
 
  
R3(config)#



查看R1路由表:



R1#show ip rou 
   
 
  
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 
   
 
  
 
   
 
 
  
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 
   
 
  
     3.0.0.0/32 is subnetted, 1 subnets 
   
 
  
O IA    3.3.3.3 [110/129] via 10.1.1.2, 00:00:37, Serial1/0 
   
 
  
     10.0.0.0/24 is subnetted, 1 subnets 
   
 
  
C       10.1.1.0 is directly connected, Serial1/0 
   
 
  
     11.0.0.0/24 is subnetted, 1 subnets 
   
 
  
O IA    11.1.1.0 [110/128] via 10.1.1.2, 00:00:37, Serial1/0 
   
 
  
     13.0.0.0/8 is variably subnetted, 8 subnets, 2 masks 
   
 
  
O IA    13.5.0.0/24 [110/129] via 10.1.1.2, 00:00:37, Serial1/0 
   
 
  
O IA    13.4.0.0/24 [110/129] via 10.1.1.2, 00:00:37, Serial1/0 
   
 
  
O IA    13.7.0.0/24 [110/129] via 10.1.1.2, 00:00:37, Serial1/0 
   
 
  
O IA    13.6.0.0/24 [110/129] via 10.1.1.2, 00:00:37, Serial1/0 
   
 
  
O IA    13.1.0.0/24 [110/129] via 10.1.1.2, 00:00:38, Serial1/0 
   
 
  
O IA    13.0.0.1/32 [110/129] via 10.1.1.2, 00:00:38, Serial1/0 
   
 
  
O IA    13.3.0.0/24 [110/129] via 10.1.1.2, 00:00:38, Serial1/0 
   
 
  
O IA    13.2.0.0/24 [110/129] via 10.1.1.2, 00:00:38, Serial1/0



//此时R1学习到R3的路由信息。



Step4.配置OSPF区域路由汇总:(要对红色字体的路由表进行汇总)



区域汇总就是区域之间的地址汇总,一般配置在ABR上;



通过计算得出汇总的地址是13.0.0.0/13


R3配置如下:



R3(config)#router ospf 9 
   
 
  
R3(config-router)#area 51 range 13.0.0.0 255.248.0.0 
   
 
  
R3(config-router)#exit 
   
 
  
R3(config)#ip route 13.0.0.0 255.248.0.0 null0  //避免路由环路 
   
 
  
R3(config)#



查看R1路由表:


R1#show ip rou 
   
 
  
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 
   
 
  
 
   
 
 
  
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 
   
 
  
     3.0.0.0/32 is subnetted, 1 subnets 
   
 
  
O IA    3.3.3.3 [110/129] via 10.1.1.2, 00:02:06, Serial1/0 
   
 
  
     10.0.0.0/24 is subnetted, 1 subnets 
   
 
  
C       10.1.1.0 is directly connected, Serial1/0 
   
 
  
     11.0.0.0/24 is subnetted, 1 subnets 
   
 
  
O IA    11.1.1.0 [110/128] via 10.1.1.2, 00:02:06, Serial1/0 
   
 
  
     13.0.0.0/13 is subnetted, 1 subnets 
   
 
  
O IA    13.0.0.0 [110/129] via 10.1.1.2, 00:00:35, Serial1/0 
   
 
  
//此时汇总成了一条地址. 
   
 
  
Step5.配置路由重分发,把R2的直连地址发布到OSPF区域内: 
   
 
  
R2(config)#router ospf 8 
   
 
  
R2(config-router)#redistribute connected subnets 
   
 
  
R2(config-router)#



查看R1路由表:



 


R1#show ip rou 
   
 
  
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 
   
 
  
 
   
 
 
  
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 
   
 
  
     2.0.0.0/24 is subnetted, 1 subnets 
   
 
  
O E2    2.2.2.0 [110/20] via 10.1.1.2, 00:00:22, Serial1/0 
   
 
  
     3.0.0.0/32 is subnetted, 1 subnets 
   
 
  
O IA    3.3.3.3 [110/129] via 10.1.1.2, 00:00:32, Serial1/0 
   
 
  
     10.0.0.0/24 is subnetted, 1 subnets 
   
 
  
C       10.1.1.0 is directly connected, Serial1/0 
   
 
  
     11.0.0.0/24 is subnetted, 1 subnets 
   
 
  
O IA    11.1.1.0 [110/128] via 10.1.1.2, 00:00:32, Serial1/0 
   
 
  
     12.0.0.0/24 is subnetted, 7 subnets 
   
 
  
O E2    12.4.0.0 [110/20] via 10.1.1.2, 00:00:02, Serial1/0 
   
 
  
O E2    12.5.0.0 [110/20] via 10.1.1.2, 00:00:02, Serial1/0 
   
 
  
O E2    12.6.0.0 [110/20] via 10.1.1.2, 00:00:03, Serial1/0 
   
 
  
O E2    12.7.0.0 [110/20] via 10.1.1.2, 00:00:03, Serial1/0 
   
 
  
O E2    12.1.0.0 [110/20] via 10.1.1.2, 00:00:03, Serial1/0 
   
 
  
O E2    12.2.0.0 [110/20] via 10.1.1.2, 00:00:03, Serial1/0 
   
 
  
O E2    12.3.0.0 [110/20] via 10.1.1.2, 00:00:03, Serial1/0 
   
 
  
     13.0.0.0/13 is subnetted, 1 subnets 
   
 
  
O IA    13.0.0.0 [110/129] via 10.1.1.2, 00:00:33, Serial1/0



//对红色字体的路由信息进行汇总



Step6.配置外部路由汇总



外部路由的汇总在ASBR上进行,配置如下



汇总的地址为12.0.0.0/13。


R2(config)#router ospf 8 
   
 
  
R2(config-router)#summary-address 12.0.0.0 255.248.0.0 
   
 
  
R2(config-router)#end



查看R3路由表:



R3#show ip rou 
   
 
  
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 
   
 
  
 
   
 
 
  
Gateway of last resort is not set 
   
 
  
 
   
 
 
  
     2.0.0.0/24 is subnetted, 1 subnets 
   
 
  
O E2    2.2.2.0 [110/20] via 11.1.1.1, 00:00:22, Serial1/0 
   
 
  
     3.0.0.0/24 is subnetted, 1 subnets 
   
 
  
C       3.3.3.0 is directly connected, Loopback0 
   
 
  
     11.0.0.0/24 is subnetted, 1 subnets 
   
 
  
C       11.1.1.0 is directly connected, Serial1/0 
   
 
  
     12.0.0.0/13 is subnetted, 1 subnets 
   
 
  
O E2    12.0.0.0 [110/20] via 11.1.1.1, 00:00:22, Serial1/0    //此时汇总成了一条地址 
   
 
  
     13.0.0.0/8 is variably subnetted, 9 subnets, 2 masks 
   
 
  
C       13.5.0.0/24 is directly connected, Loopback1 
   
 
  
C       13.4.0.0/24 is directly connected, Loopback1 
   
 
  
C       13.7.0.0/24 is directly connected, Loopback1 
   
 
  
C       13.6.0.0/24 is directly connected, Loopback1 
   
 
  
C       13.1.0.0/24 is directly connected, Loopback1 
   
 
  
C       13.0.0.0/24 is directly connected, Loopback1 
   
 
  
S       13.0.0.0/13 is directly connected, Null0 
   
 
  
C       13.3.0.0/24 is directly connected, Loopback1 
   
 
  
C       13.2.0.0/24 is directly connected, Loopback1



查看R1路由表:



R1#show ip rou 
   
 
  
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 
   
 
  
 
   
 
 
  
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 
   
 
  
     2.0.0.0/24 is subnetted, 1 subnets 
   
 
  
O E2    2.2.2.0 [110/20] via 10.1.1.2, 00:00:02, Serial1/0 
   
 
  
     3.0.0.0/32 is subnetted, 1 subnets 
   
 
  
O IA    3.3.3.3 [110/129] via 10.1.1.2, 00:00:02, Serial1/0 
   
 
  
     10.0.0.0/24 is subnetted, 1 subnets 
   
 
  
C       10.1.1.0 is directly connected, Serial1/0 
   
 
  
     11.0.0.0/24 is subnetted, 1 subnets 
   
 
  
O IA    11.1.1.0 [110/128] via 10.1.1.2, 00:00:02, Serial1/0 
   
 
  
     12.0.0.0/13 is subnetted, 1 subnets 
   
 
  
O E2    12.0.0.0 [110/20] via 10.1.1.2, 00:00:02, Serial1/0 
   
 
  
     13.0.0.0/13 is subnetted, 1 subnets           //此时汇总成了一条地址 
   
 
  
O IA    13.0.0.0 [110/129] via 10.1.1.2, 00:00:03, Serial1/0



试验总结:



地址汇总:减少泛洪的LSA的数量



在OSPF中进行汇总。区域汇总和外部路由汇总



区域汇总:



area area-id range ip-address mask



外部路由汇总:



summary-address ip-address mask



配置OSPF虚链路



( Config-router)#area 区域号virtual-link 对方路由ID


配置辅助地址 : ( config-if ) #ip add IP 地址 掩码 secondary

   

注:只有主地址也运行 OSPF 时,才会通告辅助网络

          OSPF

把辅助地址看成末梢区域,无法与辅助网络的路由建立邻接关系

转载于:https://blog.51cto.com/dongwei/62966