Easily control route redistribution using a route-map

Route map are useful to control route redistribution into OSPF, EIGRP or any other routing protocol.

Let's start with an example : allow redistribution of all static route except those which are tagged with the number '8'

!
router ospf 1
redistribute static subnets route-map STATIC
! ......
!
ip route 10.10.1.0 255.255.255.0 10.10.0.1 tag 8
ip route 10.20.45.0 255.255.255.0 10.10.0.3
!
route-map STATIC deny 10
match tag 8
!
route-map STATIC permit 20
!

10.20.45.0 will be redistributed in OSPF1, 10.10.1.0 will not. As you can see, this route-map uses an ACL syntax to match the routes.

Available match statements :

  • match interface : select outgoing interface

  • match ip address : select based on ip address  (ACL or prefix-list)

  • match ip next-hop : select based on route next-hop

  • match metric : select based on route metric

  • match ip source-route : select based on LSA router-id originator

  • match route-type :  select based on E1 or E2 route type (external 1 or external 2)

  • match tag : see example above.

You can also change some route properties, on the fly, like in this example :
!
router ospf 1
redistribute static subnets route-map STATIC
! ......
!
ip route 10.10.1.0 255.255.255.0 10.10.0.1 tag 8
ip route 10.20.45.0 255.255.255.0 10.10.0.3
!
route-map STATIC deny 10
match tag 8
!
route-map STATIC permit 20
set tag 9
!

All redistributed route (which had a 8 tag) will now have tag 9.

Available set statements :

  • set as-path : set BGP as-path

  • set community : set BPG community

  • set ip next-hop : set BGP next-hop

  • set level : set which level (l1, l2, stub, backbone) a matching route should be

  • set local-preference : set BGP local preference for matching route to exit the current AS

  • set metric : set route metric

  • set nlri : set BGP nlri (choose which BGP table a matching route should go)

  • set origin : set BGP origin

  • set tag : set a new tag (see example above)

  • set weight : set BGP route weight