BGP

This section shows how to use route maps and implement useful BGP routing policies. First, I use different kinds of match clauses to build policy sets. Then I relate different ways that route maps and other kinds of access lists can be used.

Match clauses in BGP

At the start of this chapter, I went over different kinds of access lists. In this section, I’ll show how to use them to build policy sets that are part of match clauses in route maps.

Prefix lists are matched with the following format:

match ip address prefix-list {prefix-list name}

where prefix-list name is the name of the prefix list. Let’s say we wanted to set prefixes of 172.28.0.0/16 that are less than or equal to /19 to have a local preference of 110 (we’ll talk more about local preference later). We define a route map and prefix list with the following:

ip prefix-list prefixes-19-and-shorter seq 5 172.28.0.0/16 le 19

route-map VALID-INCOMING-ROUTES permit 10
  match ip address prefix-list prefixes-19-and-shorter
  set local-preference 110

and then apply this route map to a BGP neighbor. The prefix list prefixes-19-and-shorter defines a policy set, and in the route map, we take this policy set and apply a local preference of 110 to it.

Similarly, we can do the same with AS-path access lists:

as-path access-list 3 permit ^\(65001(_.*)*\).*$ as-path access-list 4 permit ^\(65002(_.*)*\).*$ access-list 3 permit any route-map INCOMING-ROUTES permit 10 match as-path 3 set as-path prepend 65001 route-map INCOMING-ROUTES permit ...

Get Cisco IOS Access Lists now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.