A-A+

华为路由RIP OSPF相互引入路由的实验

2015年11月27日 站长资讯 暂无评论

学习目的:

1、理解路由相互引入的意义。

2、掌握从OSPF向RIP注入路由的方法。

3、掌握从RIP向OSPF注入路由的方法。

拓扑图:

场景"你是公司的网络管理员。当前公司网络使用了RIPv2和OSPF协议。为了实现RIP区域设备与OSPF区域设备之间的互通。你需要配置路由的相互引入操作。配置时需要注意不同路由协议度量值定义的标准。

学习任务

步骤一,基本配置与IP编址

  1. [Huawei]sysname R1  
  2. [R1]interface s1/0/0  
  3. [R1-Serial1/0/0]ip add 10.0.12.1 24  
  4. [R1-Serial1/0/0]desc this port connect to R2-S1/0/0  
  5. [R1-Serial1/0/0]interface g0/0/0  
  6. [R1-GigabitEthernet0/0/0]ip add 10.0.13.1 24  
  7. [R1-GigabitEthernet0/0/0]desc this port connect toR3-G0/0/0  
  8. [R1-GigabitEthernet0/0/0]interface loopback0  
  9. [R1-LoopBack0]ip add 10.0.1.1 24  
  10. [R1-LoopBack0]q  

R2、R3、IP编址参照R1配置

步骤二,OSPF协议配置及验证

R1与R2之间运行OSPF,配置属于Area0.

  1. [R1]ospf 1 rout       
  2. [R1]ospf 1 router-id 10.0.1.1  
  3. [R1-ospf-1]area 0  
  4. [R1-ospf-1-area-0.0.0.0]network 10.0.12.0 0.0.0.255   
  5. [R1-ospf-1-area-0.0.0.0]  
  6.    
  7. [R2]ospf 1 router-id 10.0.2.2  
  8. [R2-ospf-1]area 0  
  9. [R2-ospf-1-area-0.0.0.0]network 10.0.2.0 0.0.0.255  
  10. [R2-ospf-1-area-0.0.0.0]network 10.0.12.0 0.0.0.255  

查看R1、R2的路由表、确认已通过OSPF学习其他网段的路由。

  1. <R1>dis ip routing-table protocol ospf  
  2. Route Flags: R - relay, D - download to fib  
  3. ---------------------------------   
  4. Public routing table : OSPF  
  5.         Destinations : 1        Routes :1         
  6.    
  7. OSPF routing table status : <Active>  
  8.         Destinations : 1        Routes : 1  
  9.    
  10. Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface  
  11.    
  12.       10.0.2.2/32  OSPF    10  48          D   10.0.12.2    Serial1/0/0   
  13.    
  14. OSPF routing table status : <Inactive>  
  15.         Destinations : 0        Routes : 0  
  16.    
  17. <R2>dis ip routing-table protocol ospf  
  18. <R2>  

OSPF区域的网络都与R2直连,所以R2未通过OSPF学到额外的路由信息。

步骤三,RIPv2协议配置及验证

在R1上开启RIP协议进程,配置实用版本号为2.将10.0.0.0网段通告进RIP路由进程。

[R1]rip 1

[R1-rip-1]version 2

[R1-rip-1]network 10.0.0.0

在R3上开启RIP协议进程,配置实用版本号为2,将172.16.0.0和10.0.0.0两个网段通告进RIP路由进程。

[R3]rip 1

[R3-rip-1]version 2

[R3-rip-1]network 10.0.0.0

[R3-rip-1]network 172.16.0.0

查看R1和R3的路由表,确认路由器已经通过RIP学习到相应的路由。

  1. [R1]dis ip routing-table protocol rip  
  2. Route Flags: R - relay, D - download to fib  
  3. -----------------------------------   
  4. Public routing table : RIP   
  5.         Destinations : 5        Routes :5         
  6.    
  7. RIP routing table status : <Active>  
  8.         Destinations : 5        Routes : 5  
  9.    
  10. Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface  
  11.    
  12.        10.0.3.0/24  RIP    100  1           D  10.0.13.3     GigabitEthernet0/0/0  
  13.     172.16.0.0/24  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0  
  14.     172.16.1.0/24  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0   
  15.     172.16.2.0/24  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0  
  16.     172.16.3.0/24  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0  
  17.    
  18. RIP routing table status : <Inactive>  
  19.         Destinations : 0        Routes : 0  
  20. [R3]disp ip routing-table protocol rip  
  21. Route Flags: R - relay, D - download to fib  
  22. -------------------------------   
  23. Public routing table : RIP  
  24.         Destinations : 2        Routes : 2         
  25.    
  26. RIP routing table status : <Active>  
  27.         Destinations : 2        Routes : 2  
  28.   
  29.   
  30.    
  31. Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface  
  32.    
  33.        10.0.1.0/24  RIP    100  1           D  10.0.13.1     GigabitEthernet0/0/0  
  34.       10.0.12.0/24  RIP    100  1           D  10.0.13.1     GigabitEthernet0/0/0  
  35.    
  36. RIP routing table status : <Inactive>  
  37.         Destinations : 0        Routes : 0  

步骤四、RIPv2和OSPF协议相互引入配置及验证

到目前为止,R2、R3未学到对方的路由信息,原因是他们不在同一种路由区域。在R1上将RIP学到的路由引入到OSPF路由表中。

[R1]ospf 1

[R1-ospf-1]impor

[R1-ospf-1]import-route rip 1 cost 100

在R1上执行将ospf路由引入到RIP路由域。

[R1]rip 1

[R1-rip-1]import-route ospf 1 cost 1

验证R1、R2、R3的路由表,确认学习到路由

  1. [R1]display ip routing-table  
  2. Route Flags: R - relay, D - download to fib  
  3. ------------------------   
  4. Routing Tables: Public  
  5.         Destinations : 20       Routes :20        
  6.    
  7. Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface  
  8.    
  9.       10.0.1.0/24  Direct  0   0           D   10.0.1.1        LoopBack0  
  10.       10.0.1.1/32  Direct  0   0           D   127.0.0.1       LoopBack0   
  11.     10.0.1.255/32  Direct  0   0           D   127.0.0.1       LoopBack0  
  12.       10.0.2.2/32  OSPF    10  48          D   10.0.12.2       Serial1/0/0  
  13.       10.0.3.0/24  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0  
  14.      10.0.12.0/24  Direct  0   0           D   10.0.12.1       Serial1/0/0  
  15.      10.0.12.1/32  Direct  0   0           D   127.0.0.1       Serial1/0/0   
  16.      10.0.12.2/32  Direct  0   0           D   10.0.12.2       Serial1/0/0  
  17.    10.0.12.255/32  Direct  0   0           D   127.0.0.1       Serial1/0/0  
  18.      10.0.13.0/24  Direct  0   0           D   10.0.13.1       GigabitEthernet0/0/0  
  19.      10.0.13.1/32  Direct  0   0           D   127.0.0.1       GigabitEthernet0/0/0  
  20.    10.0.13.255/32  Direct  0   0           D   127.0.0.1       GigabitEthernet0/0/0   
  21.      127.0.0.0/8   Direct  0   0           D   127.0.0.1       InLoopBack0  
  22.      127.0.0.1/32  Direct  0   0           D   127.0.0.1       InLoopBack0  
  23. 127.255.255.255/32  Direct 0    0           D  127.0.0.1       InLoopBack0  
  24.     172.16.0.0/24  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0  
  25.     172.16.1.0/24  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0   
  26.     172.16.2.0/24  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0  
  27.     172.16.3.0/24  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0  
  28. 255.255.255.255/32  Direct 0    0           D  127.0.0.1       InLoopBack0  

R1的路由表之前比较无变化,原因是R1同时处于OSPF和RIP路由区域,在引入路由之前就已经学习到了所有的路由信息。

确认R2、R3的路由表已经学习到如下路由。

  1. <R2>displ ip routing-table protocolospf  
  2. Route Flags: R - relay, D - download to fib  
  3. ------------------------------------------------------------------------------  
  4. Public routing table : OSPF  
  5.         Destinations : 7        Routes :7         
  6.    
  7. OSPF routing table status : <Active>  
  8.         Destinations : 7        Routes : 7  
  9.    
  10. Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface  
  11.    
  12.       10.0.1.0/24  O_ASE   150 100         D   10.0.12.1       Serial1/0/0  
  13.       10.0.3.0/24  O_ASE   150 100         D   10.0.12.1       Serial1/0/0  
  14.      10.0.13.0/24  O_ASE   150 100         D   10.0.12.1       Serial1/0/0  
  15.     172.16.0.0/24  O_ASE   150 100         D   10.0.12.1       Serial1/0/0   
  16.     172.16.1.0/24  O_ASE   150 100         D   10.0.12.1       Serial1/0/0  
  17.     172.16.2.0/24  O_ASE   150 100         D   10.0.12.1       Serial1/0/0  
  18.     172.16.3.0/24  O_ASE   150 100         D   10.0.12.1       Serial1/0/0  
  19.    
  20. OSPF routing table status : <Inactive>  
  21.         Destinations : 0        Routes : 0  
  22. <R3>disp ip routing-table protocol rip  
  23. Route Flags: R - relay, D - download to fib  
  24. ------------------------------------------------------------------------------  
  25. Public routing table : RIP  
  26.         Destinations : 3        Routes :3         
  27.    
  28. RIP routing table status : <Active>  
  29.         Destinations : 3        Routes : 3  
  30.    
  31. Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface  
  32.    
  33.       10.0.1.0/24  RIP     100 1           D   10.0.13.1      GigabitEthernet0/0/0  
  34.       10.0.2.2/32  RIP     100 2           D   10.0.13.1      GigabitEthernet0/0/0  
  35.      10.0.12.0/24  RIP     100 1           D   10.0.13.1      GigabitEthernet0/0/0   
  36.    
  37. RIP routing table status : <Inactive>  
  38.         Destinations : 0        Routes : 0  

测试网络连通性。在R2上使用扩展ping命令,定义数据包的源地址,测试到达地址10.0.3.3的连通性。

  1. <R2>ping -a 10.0.2.2 10.0.3.3  
  2.   PING10.0.3.3: 56  data bytes, press CTRL_C tobreak  
  3.    Request time out  
  4.    Reply from 10.0.3.3: bytes=56 Sequence=2 ttl=254 time=30 ms  
  5.    Reply from 10.0.3.3: bytes=56 Sequence=3 ttl=254 time=10 ms  
  6.    Reply from 10.0.3.3: bytes=56 Sequence=4 ttl=254 time=20 ms  
  7.    Reply from 10.0.3.3: bytes=56 Sequence=5 ttl=254 time=10 ms  
  8.    
  9.   ---10.0.3.3 ping statistics ---  
  10.     5packet(s) transmitted  
  11.     4packet(s) received  
  12.    20.00% packet loss  
  13.    round-trip min/avg/max = 10/17/30 ms  
  14.    
  15. <R2>ping -a 10.0.2.2 172.16.0.1   
  16.   PING172.16.0.1: 56  data bytes, press CTRL_Cto break  
  17.    Reply from 172.16.0.1: bytes=56 Sequence=1 ttl=254 time=30 ms  
  18.    Reply from 172.16.0.1: bytes=56 Sequence=2 ttl=254 time=10 ms  
  19.    Reply from 172.16.0.1: bytes=56 Sequence=3 ttl=254 time=20 ms  
  20.    Reply from 172.16.0.1: bytes=56 Sequence=4 ttl=254 time=10 ms  
  21.    Reply from 172.16.0.1: bytes=56 Sequence=5 ttl=254 time=10 ms  
  22.    
  23.   ---172.16.0.1 ping statistics ---  
  24.     5packet(s) transmitted  
  25.     5 packet(s) received  
  26.    0.00% packet loss  
  27.    round-trip min/avg/max = 10/16/30 ms  

在R3的接口G0/0/0上配置RIP手动路由汇总。

[R3]interface g0/0/0

[R3-GigabitEthernet0/0/0]rip summary

[R3-GigabitEthernet0/0/0]rip summary-address172.16.0.0 255.255.252.0

验证R1、R2的路由表、比较与步骤三中显示的路由表的区别。

  1. <R1>displ ip routing-table   
  2. Route Flags: R - relay, D - download to fib  
  3. ------------------------------------------------------------------------------  
  4. Routing Tables: Public  
  5.         Destinations : 17       Routes :17        
  6.    
  7. Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface  
  8.    
  9.       10.0.1.0/24  Direct  0   0           D   10.0.1.1        LoopBack0  
  10.       10.0.1.1/32  Direct  0   0           D   127.0.0.1       LoopBack0  
  11.     10.0.1.255/32  Direct  0   0           D  127.0.0.1       LoopBack0   
  12.       10.0.2.2/32  OSPF    10  48          D   10.0.12.2       Serial1/0/0  
  13.       10.0.3.0/24  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0  
  14.      10.0.12.0/24  Direct  0   0           D   10.0.12.1       Serial1/0/0  
  15.      10.0.12.1/32  Direct  0   0           D   127.0.0.1       Serial1/0/0  
  16.      10.0.12.2/32  Direct  0   0           D   10.0.12.2       Serial1/0/0   
  17.    10.0.12.255/32  Direct  0   0           D   127.0.0.1       Serial1/0/0  
  18.       10.0.13.0/24 Direct  0    0          D   10.0.13.1       GigabitEthernet0/0/0  
  19.      10.0.13.1/32  Direct  0   0           D   127.0.0.1       GigabitEthernet0/0/0  
  20.    10.0.13.255/32  Direct  0   0           D   127.0.0.1       GigabitEthernet0/0/0  
  21.       127.0.0.0/8   Direct 0    0           D  127.0.0.1       InLoopBack0   
  22.      127.0.0.1/32  Direct  0   0           D   127.0.0.1       InLoopBack0  
  23. 127.255.255.255/32  Direct 0    0           D  127.0.0.1       InLoopBack0  
  24.      172.16.0.0/22  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0  
  25. 255.255.255.255/32  Direct 0    0           D  127.0.0.1       InLoopBack0  
  26. <R2>disp ip routing-table protocol ospf  
  27. Route Flags: R - relay, D - download to fib  
  28. ----------------------------------   
  29. Public routing table : OSPF  
  30.         Destinations : 4        Routes :4         
  31.    
  32. OSPF routing table status : <Active>  
  33.         Destinations : 4        Routes : 4  
  34.    
  35. Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface  
  36.    
  37.       10.0.1.0/24  O_ASE   150 100         D   10.0.12.1       Serial1/0/0  
  38.       10.0.3.0/24  O_ASE   150 100         D   10.0.12.1       Serial1/0/0  
  39.      10.0.13.0/24  O_ASE   150 100         D  10.0.12.1       Serial1/0/0  
  40.     172.16.0.0/22  O_ASE   150 100         D   10.0.12.1       Serial1/0/0   
  41.    
  42. OSPF routing table status : <Inactive>  
  43.         Destinations : 0        Routes : 0  

此时R1、R2学到的路由是汇总路由172.16.0.0/22,而不是明细路由172.16.0.0/24等。

标签:

给我留言