Configuration Guide Vol. 3


14.2.2 RIP learned route filtering

<Structure of this section>

(1) Learning routes for a specific destination network

Configure RIP to learn RIP routes destined for only 192.168.0.0/16, but disregard RIP routes destined for other networks.

Points to note

To apply learned route filtering, configure the distribute-list in command. To filter routes by their destination networks, use an ip prefix-list filter.

First, configure an ip prefix-list filter to permit routes to the 192.168.0.0/16 address range. When this filter is referenced from the distribute-list in command, the learned RIP routes are filtered according to their destination network.

Command examples

  1. (config)# ip prefix-list ONLY192168 seq 10 permit 192.168.0.0/16

    Configures prefix-list to permit only routes in the 192.168.0.0/16 range. Because ONLY192168 has no other conditions, the filter denies routes with any other destination address or mask length.

  2. (config)# router rip

    (config-router)# distribute-list prefix ONLY192168 in

    Applies ONLY192168 to routes learned by RIP.

(2) For a specific interface, learn routes for a specific destination network.

Configure RIP to learn only those RIP routes from VLAN 10 that have 192.168.0.0/16 as their destination. Routes learned from interfaces other than VLAN 10 will not be filtered.

Points to note

To apply RIP learned route filtering on a per-interface basis, specify the <Interface> in the parameter of the distribute-list in command.

First, configure an ip prefix-list filter to permit routes to the 192.168.0.0/16 address range. When this filter is referenced from distribute-list in VLAN 10, RIP routes learned from VLAN 10 are filtered according to their destination network.

Command examples

  1. (config)# ip prefix-list ONLY192168 seq 10 permit 192.168.0.0/16

    Configures prefix-list to permit only routes in the 192.168.0.0/16 range. Because ONLY192168 has no other conditions, the filter denies routes with any other destination address or mask length.

  2. (config)# router rip

    (config-router)# distribute-list prefix ONLY192168 in vlan 10

    Applies ONLY192168 to routes learned from VLAN 10.

(3) Learned route filtering by both tag value and destination network

Configure RIP not to learn routes that have a destination address in the 192.168.0.0/16 range and a tag value other than 15. All other RIP routes will be learned.

Points to note

The example below shows how to use route-map to filter a route by an attribute other than its destination network, or to modify some of its attributes. You can reference this route-map from the distribute-list in command.

First, configure an ip prefix-list filter to permit the routes whose prefixes are in the 192.168.0.0/16 range. Next, configure route-map to deny any routes that are permitted by this prefix-list filter and also have a tag value other than 15.

Finally, by referencing route-map from the distribute-list in command, you can configure RIP learned route filtering based on a combination of tag value and destination network.

You must be using RIP version 2 to filter based on tag values. Keep in mind that RIP version 1 does not support tags.

Command examples

  1. (config)# ip prefix-list PERMIT192168LONGER seq 10 permit 192.168.0.0/16 ge 16 le 32

    Configures prefix-list to permit routes in the 192.168.0.0/16 range.

  2. (config)# route-map TAG permit 10

    (config-route-map)# match ip address prefix-list PERMIT192168LONGER

    (config-route-map)# match tag 15

    (config-route-map)# exit

    Configures route-map to permit routes in the 192.168.0.0/16 range that have a tag value of 15.

  3. (config)# route-map TAG deny 20

    (config-route-map)# match ip address prefix-list PERMIT192168LONGER

    (config-route-map)# exit

    Configures route-map to deny routes in the 192.168.0.0/16 range if they do not match the conditions associated with sequence number 10.

  4. (config)# route-map TAG permit 30

    (config-route-map)# exit

    Configures route-map to permit any route that does not match the conditions associated with sequence numbers 10 and 20.

  5. (config)# router rip

    (config-router)# distribute-list route-map TAG in

    Applies the above filter to RIP learned route filtering. This means that RIP does not learn routes that are in the 192.168.0.0/16 range and have a tag value other than 15.

(4) Changing Distance Values by Destination Network

Assign a distance value 50 to RIP-learned routes whose destination network is in the 192.168.0.0/16 range, to give such routes priority over OSPF routes.

Points to note

First, configure an ip prefix-list filter to permit routes in the 192.168.0.0/16 range. Next, configure route-map to assign a distance value of 50 to routes permitted by the prefix-list filter.

Finally, by referencing route-map from the distribute-list in command, configure RIP learned route filtering to change a route's distance value based on its destination network.

Command examples

  1. (config)# ip prefix-list PERMIT192168LONGER seq 10 permit 192.168.0.0/16 ge 16 le 32

    Configures prefix-list to permit routes in the 192.168.0.0/16 range.

  2. (config)# route-map Distance50 permit 10

    (config-route-map)# match ip address prefix-list PERMIT192168LONGER

    (config-route-map)# set distance 50

    (config-route-map)# exit

    192.168.0.0 Sets the route included in /16 to permit by changing the distance to 50.

  3. (config)# route-map Distance50 permit 20

    (config-route-map)# exit

    Configures the route-map to permit routes that do not match the conditions associated with sequence number 10, without changing any of their attributes.

  4. (config)# router rip

    (config-router)# distribute-list route-map Distance50 in

    Applies the above filter to RIP learned route filtering. This means that a distance value of 50 is assigned to RIP-learned routes in the 192.168.0.0/16 range.