您的位置:首页 > 其它

华为路由RIP OSPF相互引入路由

2015-10-20 09:12 489 查看
RIP、OSPF相互引入路由学习目的:
理解路由相互引入的意义

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

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

拓扑图:
      


场景
       你是公司的网络管理员。当前公司网络使用了RIPv2和OSPF协议。为了实现RIP区域设备与OSPF区域设备之间的互通。你需要配置路由的相互引入操作。配置时需要注意不同路由协议度量值定义的标准。
学习任务
步骤一.基本配置与IP编址
[Huawei]sysname R1
[R1]interface s1/0/0
[R1-Serial1/0/0]ip add 10.0.12.1 24
[R1-Serial1/0/0]desc this port connect to R2-S1/0/0
[R1-Serial1/0/0]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip add 10.0.13.1 24
[R1-GigabitEthernet0/0/0]desc this port connect toR3-G0/0/0
[R1-GigabitEthernet0/0/0]interface loopback0
[R1-LoopBack0]ip add 10.0.1.1 24
[R1-LoopBack0]q
R2、R3、IP编址参照R1配置
步骤二.OSPF协议配置及验证
       R1与R2之间运行OSPF,配置属于Area0.
[R1]ospf 1 rout     
[R1]ospf 1 router-id 10.0.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 10.0.12.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]
 
[R2]ospf 1 router-id 10.0.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 10.0.2.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 10.0.12.0 0.0.0.255
查看R1、R2的路由表、确认已通过OSPF学习其他网段的路由。
<R1>dis ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
        Destinations : 1        Routes :1       
 
OSPF routing table status : <Active>
        Destinations : 1        Routes : 1
 
Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface
 
      10.0.2.2/32  OSPF    10  48          D   10.0.12.2    Serial1/0/0
 
OSPF routing table status : <Inactive>
        Destinations : 0        Routes : 0
 
<R2>dis ip routing-table protocol ospf
<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学习到相应的路由。
[R1]dis ip routing-table protocol rip
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : RIP
        Destinations : 5        Routes :5       
 
RIP routing table status : <Active>
        Destinations : 5        Routes : 5
 
Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface
 
       10.0.3.0/24  RIP    100  1           D  10.0.13.3     GigabitEthernet0/0/0
    172.16.0.0/24  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0
    172.16.1.0/24  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0
    172.16.2.0/24  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0
    172.16.3.0/24  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0
 
RIP routing table status : <Inactive>
        Destinations : 0        Routes : 0
[R3]disp ip routing-table protocol rip
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : RIP
        Destinations : 2        Routes : 2       
 
RIP routing table status : <Active>
        Destinations : 2        Routes : 2
 
Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface
 
       10.0.1.0/24  RIP    100  1           D  10.0.13.1     GigabitEthernet0/0/0
      10.0.12.0/24  RIP    100  1           D  10.0.13.1     GigabitEthernet0/0/0
 
RIP routing table status : <Inactive>
        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的路由表,确认学习到路由
[R1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
        Destinations : 20       Routes :20      
 
Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface
 
      10.0.1.0/24  Direct  0   0           D   10.0.1.1        LoopBack0
      10.0.1.1/32  Direct  0   0           D   127.0.0.1       LoopBack0
    10.0.1.255/32  Direct  0   0           D   127.0.0.1       LoopBack0
      10.0.2.2/32  OSPF    10  48          D   10.0.12.2       Serial1/0/0
      10.0.3.0/24  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0
     10.0.12.0/24  Direct  0   0           D   10.0.12.1       Serial1/0/0
     10.0.12.1/32  Direct  0   0           D   127.0.0.1       Serial1/0/0
     10.0.12.2/32  Direct  0   0           D   10.0.12.2       Serial1/0/0
   10.0.12.255/32  Direct  0   0           D   127.0.0.1       Serial1/0/0
     10.0.13.0/24  Direct  0   0           D   10.0.13.1       GigabitEthernet0/0/0
     10.0.13.1/32  Direct  0   0           D   127.0.0.1       GigabitEthernet0/0/0
   10.0.13.255/32  Direct  0   0           D   127.0.0.1       GigabitEthernet0/0/0
     127.0.0.0/8   Direct  0   0           D   127.0.0.1       InLoopBack0
     127.0.0.1/32  Direct  0   0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct 0    0           D  127.0.0.1       InLoopBack0
    172.16.0.0/24  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0
    172.16.1.0/24  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0
    172.16.2.0/24  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0
    172.16.3.0/24  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0
255.255.255.255/32  Direct 0    0           D  127.0.0.1       InLoopBack0
R1的路由表之前比较无变化,原因是R1同时处于OSPF和RIP路由区域,在引入路由之前就已经学习到了所有的路由信息。
确认R2、R3的路由表已经学习到如下路由。
<R2>displ ip routing-table protocolospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
        Destinations : 7        Routes :7       
 
OSPF routing table status : <Active>
        Destinations : 7        Routes : 7
 
Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface
 
      10.0.1.0/24  O_ASE   150 100         D   10.0.12.1       Serial1/0/0
      10.0.3.0/24  O_ASE   150 100         D   10.0.12.1       Serial1/0/0
     10.0.13.0/24  O_ASE   150 100         D   10.0.12.1       Serial1/0/0
    172.16.0.0/24  O_ASE   150 100         D   10.0.12.1       Serial1/0/0
    172.16.1.0/24  O_ASE   150 100         D   10.0.12.1       Serial1/0/0
    172.16.2.0/24  O_ASE   150 100         D   10.0.12.1       Serial1/0/0
    172.16.3.0/24  O_ASE   150 100         D   10.0.12.1       Serial1/0/0
 
OSPF routing table status : <Inactive>
        Destinations : 0        Routes : 0
<R3>disp ip routing-table protocol rip
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : RIP
        Destinations : 3        Routes :3       
 
RIP routing table status : <Active>
        Destinations : 3        Routes : 3
 
Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface
 
      10.0.1.0/24  RIP     100 1           D   10.0.13.1      GigabitEthernet0/0/0
      10.0.2.2/32  RIP     100 2           D   10.0.13.1      GigabitEthernet0/0/0
     10.0.12.0/24  RIP     100 1           D   10.0.13.1      GigabitEthernet0/0/0
 
RIP routing table status : <Inactive>
        Destinations : 0        Routes : 0
测试网络连通性。在R2上使用扩展ping命令,定义数据包的源地址,测试到达地址10.0.3.3的连通性。
<R2>ping -a 10.0.2.2 10.0.3.3
  PING10.0.3.3: 56  data bytes, press CTRL_C tobreak
   Request time out
   Reply from 10.0.3.3: bytes=56 Sequence=2 ttl=254 time=30 ms
   Reply from 10.0.3.3: bytes=56 Sequence=3 ttl=254 time=10 ms
   Reply from 10.0.3.3: bytes=56 Sequence=4 ttl=254 time=20 ms
   Reply from 10.0.3.3: bytes=56 Sequence=5 ttl=254 time=10 ms
 
  ---10.0.3.3 ping statistics ---
    5packet(s) transmitted
    4packet(s) received
   20.00% packet loss
   round-trip min/avg/max = 10/17/30 ms
 
<R2>ping -a 10.0.2.2 172.16.0.1
  PING172.16.0.1: 56  data bytes, press CTRL_Cto break
   Reply from 172.16.0.1: bytes=56 Sequence=1 ttl=254 time=30 ms
   Reply from 172.16.0.1: bytes=56 Sequence=2 ttl=254 time=10 ms
   Reply from 172.16.0.1: bytes=56 Sequence=3 ttl=254 time=20 ms
   Reply from 172.16.0.1: bytes=56 Sequence=4 ttl=254 time=10 ms
   Reply from 172.16.0.1: bytes=56 Sequence=5 ttl=254 time=10 ms
 
  ---172.16.0.1 ping statistics ---
    5packet(s) transmitted
    5 packet(s) received
   0.00% packet loss
   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的路由表、比较与步骤三中显示的路由表的区别。
<R1>displ ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
        Destinations : 17       Routes :17      
 
Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface
 
      10.0.1.0/24  Direct  0   0           D   10.0.1.1        LoopBack0
      10.0.1.1/32  Direct  0   0           D   127.0.0.1       LoopBack0
    10.0.1.255/32  Direct  0   0           D  127.0.0.1       LoopBack0
      10.0.2.2/32  OSPF    10  48          D   10.0.12.2       Serial1/0/0
      10.0.3.0/24  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0
     10.0.12.0/24  Direct  0   0           D   10.0.12.1       Serial1/0/0
     10.0.12.1/32  Direct  0   0           D   127.0.0.1       Serial1/0/0
     10.0.12.2/32  Direct  0   0           D   10.0.12.2       Serial1/0/0
   10.0.12.255/32  Direct  0   0           D   127.0.0.1       Serial1/0/0
      10.0.13.0/24 Direct  0    0          D   10.0.13.1       GigabitEthernet0/0/0
     10.0.13.1/32  Direct  0   0           D   127.0.0.1       GigabitEthernet0/0/0
   10.0.13.255/32  Direct  0   0           D   127.0.0.1       GigabitEthernet0/0/0
      127.0.0.0/8   Direct 0    0           D  127.0.0.1       InLoopBack0
     127.0.0.1/32  Direct  0   0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct 0    0           D  127.0.0.1       InLoopBack0
    
9ca1
172.16.0.0/22  RIP     100 1           D   10.0.13.3      GigabitEthernet0/0/0
255.255.255.255/32  Direct 0    0           D  127.0.0.1       InLoopBack0
<R2>disp ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
        Destinations : 4        Routes :4       
 
OSPF routing table status : <Active>
        Destinations : 4        Routes : 4
 
Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface
 
      10.0.1.0/24  O_ASE   150 100         D   10.0.12.1       Serial1/0/0
      10.0.3.0/24  O_ASE   150 100         D   10.0.12.1       Serial1/0/0
     10.0.13.0/24  O_ASE   150 100         D  10.0.12.1       Serial1/0/0
    172.16.0.0/22  O_ASE   150 100         D   10.0.12.1       Serial1/0/0
 
OSPF routing table status : <Inactive>
        Destinations : 0        Routes : 0
此时R1、R2学到的路由是汇总路由172.16.0.0/22,而不是明细路由172.16.0.0/24等
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: