Configuration Guide Vol. 3


14.2.5 OSPF advertised route filtering [SL-L3A]

<Structure of this section>

(1) Advertisement of specific protocol routes

Configure OSPF to advertise static routes and RIP routes to OSPF domain 1

Points to note

The example below shows how to use the redistribute command to advertise routes that would not be advertised by default. In the redistribute command, specify the protocols that you want advertised.

Command examples

  1. (config)# router ospf 1

    (config-router)# redistribute static

    Configures OSPFv3 to advertise static routes.

  2. (config-router)# redistribute rip

    Configures OSPF to advertise RIP routes.

(2) Advertising Specific Destination Network Routes for Specific Protocols

You can configure the switch to advertise static routes, and RIP routes whose destination network is 192.168.0.0/16, into OSPF domain 1.

Points to note

To filter advertised routes based on their learning source protocol, specify route-map in the redistribute command. Configure an ip prefix-list filter to supply the destination network conditions for route-map, and call the list from the match ip address command.

First, configure an ip prefix-list filter to permit only routes in the 192.168.0.0/16 range. Next, configure route-map to use this filter as its conditions. Finally, use the redistribute command to configure the switch to advertise static routes and RIP routes. In the redistribute command for the RIP routes, specify route-map.

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)# route-map ONLY192168 permit 10

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

    (config-route-map)# exit

    Configures route-map to permit routes whose destination network is in the 192.168.0.0/16 range.

  3. (config)# router ospf 1

    (config-router)# redistribute static

    Configures OSPF to advertise static routes into OSPF domain 1.

  4. (config-router)# redistribute rip route-map ONLY192168

    Configures OSPF to filter RIP routes by ONLY192168 and only advertise those routes permitted by the filter.

(3) Suppressing advertisement of specific destination network routes

Configure OSPF to advertise static routes and RIP routes to OSPF domain 1 , except for routes destined for the 192.168.0.0/16 address range.

Points to note

The example below shows how to use the distribute-list out command to filter advertised routes regardless of their learning source protocol.

First, configure an ip prefix-list filter to deny routes to the 192.168.0.0/16 address range. By referencing this filter from the distribute-list out command, you can configure the switch to perform advertised route filtering by destination network.

Finally, use the redistribute command to configure the switch to advertise static routes and RIP routes.

Command examples

  1. (config)# ip prefix-list OMIT192168 seq 10 deny 192.168.0.0/16

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

  2. (config)# ip prefix-list OMIT192168 seq 100 permit 0.0.0.0/0 ge 0 le 32

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

  3. (config)# router ospf 1

    (config-router)# distribute-list prefix OMIT192168 out

    Configures OSPF to filter advertised routes by OMIT192168.

  4. (config-router)# redistribute static

    (config-router)# redistribute rip

    Configures OSPF to advertise static routes and RIP routes.

(4) Route advertisement between OSPF domains

The procedure below configures the reciprocal exchange of routes between OSPF domain 1 and OSPF domain 2.

Routes associated with OSPF domain 1 are tagged with a value of 1001 and advertised to OSPF domain 2. In turn, the domain 2 does not advertise routes that have a tag value of 1001 to the domain 1. This process prevents routing loops by stopping OSPF domain 2 from advertising OSPF domain 1 routes back to OSPF domain 1.

Similarly, routes associated with OSPF domain 2 are tagged with a value of 1002 and advertised to OSPF domain 1. If OSPF domain 1 routes are tagged with a value of 1002, they are not advertised to OSPF domain 2.

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 you wish to change a route attribute other than the metric. You can reference this route-map from redistribute and distribute-list out among other commands.

Configure advertising to OSPF domain 1 by specifying a route-map filter to deny routes with a tag value of 1001 and permits the advertisement of all other routes after assigning them a tag value of 1002. Specify this as redistribute that advertises OSPF domain 2 routes for OSPF domain 1.

Similarly, configure advertisement to OSPF domain 2 by specifying route-map to deny routes with a tag value of 1002 but permits the advertisement of all other routes after assigning them a tag value of 1001. Then, specify this filter in the redistribute command that configures the advertisement of the domain 2 routes to the domain 1.

Command examples

  1. (config)# route-map OSPF2to1 deny 10

    (config-route-map)# match tag 1001

    (config-route-map)# exit

    Configures the route-map filter OSPF2to1 to deny routes with a tag value of 1001.

  2. (config)# route-map OSPF2to1 permit 20

    (config-route-map)# set tag 1002

    (config-route-map)# exit

    Configures route-map to assign a tag value of 1002 to routes that do not satisfy the above conditions.

  3. (config)# router ospf 1

    (config-router)# redistribute ospf 2 route-map OSPF2to1

    (config-router)# exit

    Configures OSPF to advertise routes in OSPF domain 2 to OSPF domain 1. Specify OSPF2to1 as a filter.

  4. (config)# route-map OSPF1to2 deny 10

    (config-route-map)# match tag 1002

    (config-route-map)# exit

    (config)# route-map OSPF1to2 permit 20

    (config-route-map)# set tag 1001

    (config-route-map)# exit

    Configures the route-map filter OSPF1to2 to deny routes with a tag value of 1002, and assign a tag value of 1001 to all other routes.

  5. (config)# router ospf 2

    (config-router)# redistribute ospf 1 route-map OSPF1to2

    (config-router)# exit

    OSPF domain 1 advertises routes to OSPF domain 2. Specify OSPF1to2 as a filter.