Example for Configuring RIP to Import External Routes

This section describes how to configure RIP to import external routes to increase the number of routes in the RIP routing table.

Networking Requirements

In Figure 1, two RIP processes, RIP 100 and RIP 200, run on Device B. Device B exchanges routing information with Device A through RIP 100 and exchanges routing information with Device C through RIP 200.

It is required that the two RIP processes of Device B import the RIP routes from each other. The cost of the routes imported from RIP 200 defaults to 3.

It is required that a filtering policy be configured on Device B to filter out the route 192.168.4.0/24 imported from RIP 200 so that the route is not advertised to Device A.

Figure 1 Configuring RIP to import external routes

Interfaces 1 through 3 in this example represent GE 0/1/0, GE 0/1/8, and GE 0/1/16, respectively.



Precautions

You can run one of the following commands to set the cost of the imported route. The following commands are listed in descending order of priorities:

  • Run the apply cost command to set the cost of a route.

  • Run the import-route (RIP) command to set the cost of the imported route.

  • Run the default-cost (RIP) command to set the cost of the default route.

Configuration Roadmap

The configuration roadmap is as follows:

  1. Enable RIP 100 and RIP 200 on each router and specify network segments.

  2. Configure the two RIP processes on Device B to import routes from each other and set the default cost of the routes imported from RIP 200 to 3.

  3. Configure an ACL on Device B to filter out the routes imported from RIP 200.

Data Preparation

To complete the configuration, you need the following data:

  • RIP network segments 192.168.0.0 and 192.168.1.0 on Device A

  • RIP network segments 192.168.1.0 and 192.168.2.0 on Device B

  • RIP network segments 192.168.2.0, 192.168.3.0, and 192.168.4.0 on Device C

Procedure

  1. Configure an IP address for each interface.

    For configuration details, see Configuration Files in this section.

  2. Configure basic RIP functions.

    # Enable RIP process 100 on Device A.

    [~DeviceA] rip 100
    [*DeviceA-rip-100] network 192.168.0.0
    [*DeviceA-rip-100] network 192.168.1.0
    [*DeviceA-rip-100] commit
    [~DeviceA-rip-100] quit

    # Enable the two RIP processes (RIP 100 and RIP 200) on Device B.

    [~DeviceB] rip 100
    [*DeviceB-rip-100] network 192.168.1.0
    [*DeviceB-rip-100] quit
    [*DeviceB] rip 200
    [*DeviceB-rip-200] network 192.168.2.0
    [*DeviceB-rip-200] commit
    [~DeviceB-rip-200] quit

    # Enable RIP process 200 on Device C.

    [~DeviceC] rip 200
    [*DeviceC-rip-200] network 192.168.2.0
    [*DeviceC-rip-200] network 192.168.3.0
    [*DeviceC-rip-200] network 192.168.4.0
    [*DeviceC-rip-200] commit
    [~DeviceC-rip-200] quit

    # Check the routing table of Device A.

    [~DeviceA] display ip routing-table
    Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
    ------------------------------------------------------------------------------
    Routing Table: _public_
             Destinations : 7       Routes : 7
    Destination/Mask    Proto  Pre  Cost   Flags    NextHop        Interface
          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
        192.168.0.0/24  Direct 0    0        D      192.168.0.1    GigabitEthernet0/1/8
        192.168.0.1/32  Direct 0    0        D      127.0.0.1      GigabitEthernet0/1/8
        192.168.1.0/24  Direct 0    0        D      192.168.1.1    GigabitEthernet0/1/0
        192.168.1.1/32  Direct 0    0        D      127.0.0.1      GigabitEthernet0/1/0
        192.168.1.2/32  Direct 0    0        D      192.168.1.2    GigabitEthernet0/1/0

    The command output shows that there are no routes of other processes in the routing table of Device A.

  3. Configure RIP to import external routes.

    # Set the default route cost to 3 on Device B and import the routes of the two RIP processes into the routing table of each other.

    [~DeviceB] rip 100
    [*DeviceB-rip-100] default-cost 3
    [*DeviceB-rip-100] import-route rip 200
    [*DeviceB-rip-100] quit
    [*DeviceB] rip 200
    [*DeviceB-rip-200] import-route rip 100
    [*DeviceB-rip-200] commit
    [~DeviceB-rip-200] quit

    # Check the routing table of Device A after the routes are imported.

    [~DeviceA] display ip routing-table
    Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
    ------------------------------------------------------------------------------
    Routing Table: _public_
             Destinations : 10       Routes : 10
    Destination/Mask    Proto  Pre  Cost   Flags    NextHop         Interface
         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
      192.168.0.0/24    Direct 0    0       D       192.168.0.1     GigabitEthernet0/1/8
      192.168.0.1/32    Direct 0    0       D       127.0.0.1       GigabitEthernet0/1/8
      192.168.1.0/24    Direct 0    0       D       192.168.1.1     GigabitEthernet0/1/0
      192.168.1.1/32    Direct 0    0       D       127.0.0.1       GigabitEthernet0/1/0
      192.168.1.2/32    Direct 0    0       D       192.168.1.2     GigabitEthernet0/1/0
        192.168.2.0/24  RIP    100  4       D          192.168.1.2     GigabitEthernet0/1/0
        192.168.3.0/24  RIP    100  4       D          192.168.1.2     GigabitEthernet0/1/0
        192.168.4.0/24  RIP    100  4       D          192.168.1.2     GigabitEthernet0/1/0

    The command output shows that routes to 192.168.2.0/24, 192.168.3.0/24, and 192.168.3.0/24 are displayed in the RIP routing table of Device A. These new routes are learned from RIP 200 on Device B.

  4. Configure RIP to filter the imported routes.

    # Configure an ACL on Device B and set a rule to filter out the packets with source address 192.168.4.0/24.

    [~DeviceB] acl 2000
    [*DeviceB-acl4-basic-2000] rule deny source 192.168.4.0 0.0.0.255
    [*DeviceB-acl4-basic-2000] rule permit
    [*DeviceB-acl4-basic-2000] quit

    # Filter out the route 192.168.4.0/24 imported from RIP 200 on Device B based on the ACL rule.

    [*DeviceB] rip 100
    [*DeviceB-rip-100] filter-policy 2000 export
    [*DeviceB-rip-100] quit
    [*DeviceB] commit

  5. Verify the configuration.

    # Check the routing table of Device A after the filtering.

    [~DeviceA] display ip routing-table
    Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
    ------------------------------------------------------------------------------
    Routing Table: _public_
             Destinations : 9        Routes : 9
    Destination/Mask    Proto  Pre  Cost   Flags    NextHop         Interface
          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
        192.168.0.0/24  Direct 0    0       D       192.168.0.1     GigabitEthernet0/1/8
        192.168.0.1/32  Direct 0    0       D       127.0.0.1       GigabitEthernet0/1/8
        192.168.1.0/24  Direct 0    0       D       192.168.1.1     GigabitEthernet0/1/0
        192.168.1.1/32  Direct 0    0       D       127.0.0.1       GigabitEthernet0/1/0
        192.168.1.2/32  Direct 0    0       D       192.168.1.2     GigabitEthernet0/1/0
        192.168.2.0/24  RIP    100  4       D       192.168.1.2     GigabitEthernet0/1/0
        192.168.3.0/24  RIP    100  4       D       192.168.1.2     GigabitEthernet0/1/0

    The command output shows that the route with source address 192.168.4.0/24 has been deleted from the RIP routing table of Device A.

Configuration Files

  • Device A configuration file

    #
    sysname DeviceA
    #
    interface GigabitEthernet0/1/8
     undo shutdown
     ip address 192.168.0.1 255.255.255.0
    #
    interface GigabitEthernet0/1/0
     undo shutdown
     ip address 192.168.1.1 255.255.255.0
    #
    rip 100
     network 192.168.0.0
     network 192.168.1.0
    #
    return
  • Device B configuration file

    #
     sysname DeviceB
    #
    acl number 2000
     rule 5 deny source 192.168.4.0 0.0.0.255
     rule 10 permit
    #
    interface GigabitEthernet0/1/0
     undo shutdown
     ip address 192.168.1.2 255.255.255.0
    #
    interface GigabitEthernet0/1/8
     undo shutdown
     ip address 192.168.2.1 255.255.255.0
    #
    rip 100
     default-cost 3
     network 192.168.1.0
     filter-policy 2000 export
     import-route rip 200
    #
    rip 200
     network 192.168.2.0
     import-route rip 100
    #
    return
  • Device C configuration file

    #
     sysname DeviceC
    #
    interface GigabitEthernet0/1/0
     undo shutdown
     ip address 192.168.2.2 255.255.255.0
    #
    interface GigabitEthernet0/1/8
     undo shutdown
     ip address 192.168.3.1 255.255.255.0
    #
    interface GigabitEthernet0/1/16
     undo shutdown
     ip address 192.168.4.1 255.255.255.0
    #
    rip 200
     network 192.168.2.0
     network 192.168.3.0
     network 192.168.4.0
    #
    return
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >