BGP Route Map Overview and Configuration

BGP Route map provide many different features to a variety of routing protocols. At the simplest level, BGP route map can filter networks much the same way as ACLs, but they also provide additional capability through the addition or modification of network attributes. To influence a routing protocol, a route map must be referenced from the routing protocol. Route maps are critical to BGP because they are the main component in modifying a unique routing policy on a neighbor-by-neighbor basis.


Route Map Four Components:

  • Sequence number: Dictates the processing order of the route map.
  • Conditional matching criteria: Identifies prefix characteristics (network, BGP path attribute, next hop, and so on) for a specific sequence.
  • Processing action: Permits or denies the prefix.
  • Optional action: Allows for manipulations, depending on how the route map is referenced on the router. Actions can include modification, addition, or removal of route characteristics.

BGP route map uses the command syntax route-map route-map-name [permit | deny] [sequence-number].

The following rules apply to route map statements:

  • If a processing action is not provided, the default value permit is used.
  • If a sequence number is not provided, the sequence number is incremented by 10 automatically.
  • If a matching statement is not included, an implied all prefixes is associated with the statement.
  • Processing within a route map stops after all optional actions have been processed (if configured) after matching a conditional matching criterion.


Conditional Matching

The table below provides the command syntax for the most common methods for conditionally matching prefixes and describes their usage. As you can see, there are a number of options available.

Match CommandDescription
match as-path acl-numberSelects prefixes based on a regex query to isolate the ASN in the BGP path attribute (PA) AS path. The AS path ACLs are numbered 1 to 500. This command allows for multiple match variables
match ip address {acl-number | acl-name}Selects prefixes based on network selection criteria defined in the ACL. This command allows for multiple match variables.
match ip address prefix-list prefix-list-nameSelects prefixes based on prefix selection criteria. This command allows for multiple match variables.
match local-preference local-preferenceSelects prefixes based on the BGP attribute local preference. This command allows for multiple match variables.
match metric {1-4294967295 | external 1-4294967295}[+- deviation]Selects prefixes based on a metric that can be exact, a range, or within acceptable deviation.
match tag tag-valueSelects prefixes based on a numeric tag (0 to 4294967295) that was set by another router. This command allows for multiple match variables.


Multiple Conditional Match Conditions

If there are multiple variables (ACLs, prefix lists, tags, and so on) configured for a specific route map sequence, only one variable must match for the prefix to qualify. The Boolean logic uses an OR operator for this configuration.

If there are multiple match options configured for a specific route map sequence, both match options must be met for the prefix to qualify for that sequence. The Boolean logic uses an AND operator for this configuration.


Complex Matching

Some network engineers find route maps too complex if the conditional matching criteria use an ACL, an AS path ACL, or a prefix list that contains a deny statement.

Reading configurations like this should follow the sequence order first and conditional matching criteria second, and only after a match occurs should the processing action and optional action be used. Matching a deny statement in the conditional match criteria excludes the route from that sequence in the route map.


Optional Actions

In addition to permitting the prefix to pass, route maps can modify route attributes.

Route Map Set Actions

Set ActionDescription
set as-path prepend {as-number-pattern | last-as 1-10}Prepends the AS path for the network prefix with the pattern specified or from multiple iterations from a neighboring AS.
set ip next-hop { ip-address | peer-address | self }Sets the next-hop IP address for any matching prefix. BGP dynamic manipulation uses the peer-address or self keywords.
set local-preference 0-4294967295Sets the BGP PA local preference.
set metric {+value | -value | value} (where value parameters are 0–4294967295)Modifies the existing metric or sets the metric for a route.
set origin {igp | incomplete}Sets the BGP PA origin.
set tag tag-valueSets a numeric tag (0–4294967295) for identification of networks by other routers
set weight 0–65535Sets the BGP PA weight.

Download our Free CCNA Study Guide PDF for complete notes on all the CCNA 200-301 exam topics in one book.

We recommend the Cisco CCNA Gold Bootcamp as your main CCNA training course. It’s the highest rated Cisco course online with an average rating of 4.8 from over 30,000 public reviews and is the gold standard in CCNA training: