# Advertising Routes

Each BGP speaker advertises to its peers the routes to prefixes that it can reach. These routes include:

- Routes to prefixes originating within the speaker’s AS
- Routes redistributed from another protocol, including static routes

By default, BGP does not advertise any route unless the router’s IP routing table also contains the route.

## Prefixes Originating in an AS

Use the network command to configure a router with the prefixes that originate within its AS. Thereafter the router advertises these configured prefixes with the origin attribute set to IGP. See Understanding the Origin Attribute for more information about origins. Figure 13 shows a network structure of three autonomous systems, each with a router that originates certain prefixes.

Figure 13: Prefixes Originating in an AS

The following commands configure router NY:

host1(config)#router bgp 300 host1(config-router)#neighbor 10.2.25.1 remote-as 100 host1(config-router)#neighbor 10.4.4.1 remote-as 400 host1(config-router)#network 192.168.33.0 mask 255.255.255.0

The following commands configure router Boston:

host2(config)#router bgp 100 host2(config-router)#neighbor 10.2.25.2 remote-as 300 host2(config-router)#neighbor 10.3.3.1 remote-as 400 host2(config-router)#network 172.19.0.0

Notice that a mask was not specified for the prefix originating with router Boston. The natural mask is assumed for networks without a mask.

The following commands configure router LA:

host3(config)#router bgp 400 host3(config-router)#neighbor 10.3.3.2 remote-as 100 host3(config-router)#neighbor 10.4.4.2 remote-as 300 host3(config-router)#network 172.28.8.0 mask 255.255.248.0

network

- Use to specify the prefixes in its AS that the BGP speaker advertises.
- BGP advertises the specified prefix only if a non-BGP route to the prefix exists in the IP forwarding table. If the non-BGP route does not exist when you issue the network command, then BGP is notified as soon as the route becomes available in the IP routing table or IP tunnel routing table.
- For IPv4 addressing, specify a network-number and an optional network-mask. For IPv6 addressing, specify the IPv6 prefix.
- You can specify a route map to filter network routes or modify their path attributes.
- The default weight for network routes is 32768; use the weight keyword to modify the weight in the range 0–65535.
- Use the backdoor keyword to lower the preference of an EBGP route to the specified prefix by setting the administrative distance to that of an internal BGP route, 200. Use this option to favor an IGP backdoor route over an EBGP route to a specific network. BGP does not advertise the specified network. See Configuring Backdoor Routes for more information.
- The next hop for the network is the next hop for the route contained in the routing table.
- This command takes effect immediately.
- Use the no version to remove the prefix.
- See network.

## Advertising Best Routes

By default, BGP selects from its routing table one best route to each destination. If BGP learned that best route from an internal peer, then the BGP speaker does not advertise a route to that destination to the speaker’s internal peers.

In earlier software releases, the default behavior was for BGP to select two best routes to any destination. The best route learned from external (including confederation) peers was advertised to the speaker’s internal peers. The best route learned from all sources was advertised to the speaker’s external peers.

You can issue the bgp advertise-external-to-internal command to cause BGP to revert to advertising two potentially different routes to its peers. See Selecting the Best Path for information about the process BGP uses to determine best routes.

bgp advertise-best-external-to-internal

- Use to cause BGP to select two best routes to every destination as follows:
  - For external peers, BGP selects the best route from the complete set of routes known to BGP.
  - For internal peers, BGP selects the best route from the set of routes BGP has received from external and confederation peers.
- Changes apply automatically whenever BGP subsequently runs the best-path decision process for a destination prefix; that is, whenever a best route is picked for a given prefix.
- The behavior enabled by this command is the default behavior for the E Series router running software releases lower than 5.0.0.
- The command is disabled by default.
- Example
  host2(config-router)#bgp advertise-best-external-to-internal
- Use the no version to restore the default condition, wherein BGP selects one best route for each destination from the complete set of routes; if the best route was received from an internal peer, no route to the destination is advertised to the internal peers.
- See bgp advertise-best-external-to-internal.

## Redistributing Routes into BGP

BGP can learn about routes from sources other than BGP updates from peers. Routes known to other protocols can be redistributed into BGP. Similarly, routes manually configured on a router—static routes—can be redistributed into BGP. After the routes are redistributed, BGP advertises the routes. When you redistribute routes, BGP sets the origin attribute for the route to Incomplete. See Understanding the Origin Attribute for more information about origins.

The following commands configure three static routes on router Boston and configure router Boston to redistribute the static routes and routes from OSPF into BGP for the network structure shown in Figure 14:

host2(config)#ip route 172.30.0.0 255.255.0.0 192.168.10.12 host2(config)#ip route 172.16.8.0 255.255.248.0 10.211.5.7 host2(config)#ip route 192.168.4.0 255.255.254.0 10.14.147.2 host2(config)#router bgp 29 host2(config-router)#neighbor 10.1.1.2 remote-as 92 host2(config-router)#redistribute static host2(config-router)#redistribute ospf

Figure 14: Redistributing Routes into BGP

clear bgp ipv6 redistribution

clear ip bgp redistribution

- Use to reapply policy to routes that have been redistributed into BGP.
- This command takes effect immediately.
- There is no no version.
- See clear bgp ipv6 redistribution.
- See clear ip bgp redistribution.

disable-dynamic-redistribute

- Use to halt the dynamic redistribution of routes that are initiated by changes to a route map.
- Dynamic redistribution is enabled by default.
- This command takes effect immediately.
- Example
  host1(config-router)#disable-dynamic-redistribute
- Use the no version to reenable dynamic redistribution.
- See disable-dynamic-redistribute.

redistribute

- Use to redistribute static routes and routes from other protocols into BGP.
- Specify the source protocol from which routes are being redistributed with one of the following keywords: isis, ospf, static, or connected. Use the static keyword to redistribute IP static routes. Use the connected keyword to redistribute routes that are established automatically by virtue of having enabled IP on an interface.
- You can specify a route map to filter the redistribution of routes from the source routing protocol into BGP. If you do not specify the route-map option, all routes are redistributed.
- Use the metric keyword to set the multiexit discriminator (MED) for routes redistributed into BGP. The default MED is the value of the IGP metric for the redistributed route.
- Use the weight keyword to set the weight for routes redistributed into BGP in the range 0–65535. The default weight is 32768.
- You can specify the type(s) of OSPF routes to redistribute into BGP: internal routes (ospf match internal), external routes of metric type 1 (ospf match external 1), or external routes of metric type 2 (ospf match external 2).
- This command takes effect immediately.
- Use the no version to end the redistribution of routes into BGP.
- See redistribute.

## Redistributing Routes from BGP

If you have redistributed routes from BGP into an IGP, by default only EBGP routes are redistributed. You can issue the bgp redistribute-internal command followed by clearing all BGP sessions to permit the redistribution of IBGP routes in addition to EBGP routes.

| Note: This default behavior does not apply to VPN routes. Redistribution of IBGP routes (routes received from an internal BGP peer) in a VRF is always enabled. You do not have to issue this command to enable redistribution of internal BGP routes in a VRF.

bgp redistribute-internal

- Use to enable the redistribution of IBGP routes in addition to EBGP routes into IGPs configured for BGP route redistribution.
- Redistribution of IBGP routes is disabled by default, except within a VRF where IBGP routes are always redistributed.
- You must clear all BGP sessions after issuing this command for it to take effect.
- Example
  host1(config-router)#bgp redistribute-internal host1(config-router)#exit host1(config)#exit host1(config)#clear ip bgp *
- All IBGP and EBGP routes subsequently placed in the IP routing table are redistributed to IGPs that have route redistribution enabled.

  To authorize redistribution of routes that are already present in the IP routing table, you must use the clear ip bgp * command (this command will bounce the BGP sessions) or the clear ip routes * command to reinstall BGP routes in the IP routing table.

- Use the no version to restore the default of permitting the redistribution only of EBGP routes.
- See bgp redistribute-internal.

## Configuring a Default Route

Default routes can provide backup routes if primary connections fail or if the route information for a destination is unknown. A router uses the default route in its IP forwarding table to route traffic toward a destination for which no routing entry exists. The accepted BGP convention is to represent a default route by the network prefix 0.0.0.0/0.

### Advertising Default Routes

If you want a router to serve as a default destination for traffic from other routers that do not know where to forward traffic, you can configure the router to advertise a default route. Use the neighbor default-originate command to specify the neighbors to which this router will advertise the default route. Said another way, these neighbors will dynamically learn the default route from the router you configure.

If you issue the neighbor default-originate command, BGP sends the default route to that neighbor regardless of whether the default route exists in the IP forwarding table.

In Figure 15, router NY originates the default route 0.0.0.0/0 to router Albany only. Router Chicago does not receive the default route.

Figure 15: Advertising a Default Route

To configure router NY:

host1(config)#router bgp 200 host1(config-router)#network 192.168.42.0 mask 255.255.254.0 host1(config-router)#neighbor 10.3.3.1 remote-as 300 host1(config-router)#neighbor 192.168.10.2 remote-as 100 host1(config-router)#neighbor 192.168.10.2 default-originate

You can also specify a route map to modify the attributes of the default route. If the default route does not match the route map, then the default route is not advertised.

### Redistributing Default Routes

By default, the redistribute command does not permit a default route to be redistributed into BGP. You can use the default-information originate command to override this behavior and permit the redistribution of default routes into BGP.

default-information originate

- Use to enable the redistribution of default routes into BGP.
- Use the route-map keyword to specify outbound route maps to apply to the default route. The route map can modify the attributes of the default route.
- This command takes effect immediately. However, if the contents of the route map specified with this command change, the new route map may or may not take effect immediately. If the disable-dynamic-redistribute command has been configured, you must issue the clear ip bgp redistribution command to apply the changed route map.
- Outbound policy configured for the neighbor (using the neighbor route-map out command) is applied to default routes that are advertised because of the default-information originate command.
- Policy specified by a route map with the default-information originate command is applied at the same time as the policy for redistributed routes, before any outbound policy for peers.
- Example
  host1(config)#router bgp 100 host1(config-router)#default-information originate
- Use the no version to restore the default, preventing the redistribution of default routes.
- See default-information originate.

### Setting a Static Default Route

You might not want your routers to rely on dynamically learned default routes. Instead, you might prefer to specify a static default route that your routers use to forward traffic when they do not have a routing entry for a destination. Use the ip route command to configure a default route on a router. The static route can point to a network number, an IP address, or a physical interface. You can add a distance value to give preference to a specific static route when multiple entries exist for the same route.

Suppose that in Figure 16, router KC has been configured to advertise a default route to router Chicago:

host1(config)#router bgp 62 host1(config-router)#network 172.17.24.0 mask 255.255.248.0 host1(config-router)#neighbor 10.8.3.1 remote-as 21 host1(config-router)#neighbor 10.8.3.1 default-originate

You prefer that router Chicago send traffic with unknown destinations to router StLouis, so you configure a static default route on router Chicago:

host2(config)#router bgp 21 host2(config-router)#network 192.168.48.0 mask 255.255.240.0 host2(config-router)#neighbor 10.8.3.4 remote-as 62 host2(config-router)#neighbor 10.24.5.1 remote-as 37 host2(config-router)#exit host2(config)#ip route 0.0.0.0 0.0.0.0 172.25.122.0

Router StLouis is configured to advertise network 172.25.122.0/23 to router Chicago:

host3(config)#router bgp 37 host3(config-router)#network 172.25.122.0 mask 255.255.254.0 host3(config-router)#neighbor 10.24.5.3 remote-as 21

Figure 16: Setting a Static Default Route

ip route

- Use to establish static routes.
- Use the no version to remove static routes.
- See ip route.

neighbor default-originate

- Use to cause a BGP speaker (the local router) to send the default route 0.0.0.0/0 to a neighbor for use as a default route.
- Use the route-map keyword to specify outbound route maps to apply to the default route. The route map can modify the attributes of the default route.
- If you specify a BGP peer group by using the peerGroupName argument, all the members of the peer group inherit the characteristic configured with this command. You cannot override the characteristic for a specific member of the peer group.
- Outbound policy configured for the neighbor (using the neighbor route-map out command) is not applied to default routes that are advertised because of the neighbor default-originate command.
- This command takes effect immediately.
- Use the no version to prevent the default route from being advertised by BGP. Use the default version to remove the explicit configuration from the peer or peer group and reestablish inheritance of the feature configuration.
- See neighbor default-originate.

## Setting the Minimum Interval Between Routing Updates

You can use the neighbor advertisement-interval command to set the minimum interval between the sending of BGP updates. Lower values for the advertisement interval cause route changes to be reported more quickly, but may cause routers to use more bandwidth and processor time.

In the following example, the minimum time between sending BGP routing updates is set to 5 seconds:

host1(config)#router bgp 100 host1(config-router)#neighbor 10.2.2.2 advertisement-interval 5

neighbor advertisement-interval

- Use to set the minimum interval between the sending of BGP updates for a given prefix.
- If you specify a BGP peer group by using the peerGroupName argument, all the members of the peer group inherit the characteristic configured with this command unless it is overridden for a specific peer.
- This command takes effect immediately.
- Use the no version to restore the default, 30 seconds for external peers and 5 seconds for internal peers.
- See neighbor advertisement-interval.

## Aggregating Routes

Aggregation applies only to routes that are present in the BGP routing table. BGP advertises an aggregate route only if the routing table contains at least one prefix that is more specific than the aggregate. You aggregate IPv4 routes by specifying the aggregate IP address, and IPv6 routes by specifying the aggregate IPv6 prefix.

Figure 17 illustrates an IPv4 network structure where you might use aggregation. The following commands configure router LA and router SanJose so that router SanJose advertises an IPv4 aggregate route, 172.24.0.0/16, for the more specific prefixes 172.24.1.0/24, 172.24.2.0/24, and 172.24.24.0/21.

Figure 17: Configuring Aggregate Addresses

To configure router LA:

host1(config)#router bgp 873 host1(config-router)#neighbor 10.2.2.4 remote-as 873 host1(config-router)#network 172.24.1.0 mask 255.255.255.0 host1(config-router)#network 172.24.2.0 mask 255.255.255.0

To configure router SanJose:

host2(config)#router bgp 873 host2(config-router)#neighbor 10.2.2.3 remote-as 873 host2(config-router)#neighbor 10.5.5.1 remote-as 17 host2(config-router)#network 172.24.24.0 mask 255.255.248.0 host2(config-router)#aggregate-address 172.24.0.0 255.255.224.0

As configured above, router SanJose advertises the more specific routes as well as the aggregate route to router Boston. Alternatively, you can use the summary-only option to configure router SanJose to suppress the more specific routes and advertise only the aggregate route:

host2(config)#router bgp 873 host2(config-router)#neighbor 10.2.2.3 remote-as 873 host2(config-router)#neighbor 10.5.5.1 remote-as 17 host2(config-router)#network 172.24.24.0 mask 255.255.248.0 host2(config-router)#aggregate-address 172.24.0.0 255.255.224.0 summary-only

Each of these configurations sets the atomic-aggregate attribute in the aggregate route. This attribute informs recipients that the route is an aggregate and must not be deaggregated into more specific routes.

Aggregate routes discard the path information carried in the original routes. To preserve the paths, you must use the as-set option. This option creates an AS-Set that consists of all the AS numbers traversed by the summarized paths. The AS-Set is enclosed within curly brackets; for example, {3, 2}. Each AS number appears only once, even if it appears in more than one of the original paths. If you use the as-set option, the atomic-aggregate attribute is not set for the aggregated route. The following commands configure router SanJose to aggregate the routes while preserving the path information:

host2(config)#router bgp 873 host2(config-router)#neighbor 10.2.2.3 remote-as 873 host2(config-router)#neighbor 10.5.5.1 remote-as 17 host2(config-router)#network 172.24.24.0 mask 255.255.248.0 host2(config-router)#aggregate-address 172.24.0.0 255.255.224.0 summary-only as-set

If you do not want to aggregate all more specific routes, you can use a route map to limit aggregation. Consider Figure 17 again. Suppose you do not want router SanJose to aggregate prefix 172.24.48.0/20. The following commands show how you can configure a route map on router SanJose to match this prefix, and how to invoke the route map with the advertise-map option:

host2(config)#router bgp 873 host2(config-router)#neighbor 10.2.2.3 remote-as 873 host2(config-router)#neighbor 10.5.5.1 remote-as 17 host2(config-router)#neighbor 10.2.2.3 route-map lmt_agg in host2(config-router)#network 172.24.24.0 mask 255.255.248.0 host2(config-router)#aggregate-address 172.24.0.0 255.255.224.0 advertise-map lmt_agg host2(config-router)#exit host2(config)#route-map lmt_agg permit 10 host2(config-route-map)#match ip address 1 host2(config-route-map)#exit host2(config)#access-list 1 permit 172.24.48.0 0.240.255.255

You can use the attribute-map option to configure attributes for the aggregated route. In Figure 17, suppose that router LA has been configured to set the community attribute for route 172.24.160.0/19 to no-export. This attribute is passed along to router SanJose and preserved when the aggregate route is created. As a result, the aggregate route is not advertised outside the AS. The following commands demonstrate how to configure router SanJose to prevent the aggregate from not being advertised:

host2(config)#router bgp 873 host2(config-router)#neighbor 10.2.2.3 remote-as 873 host2(config-router)#neighbor 10.5.5.1 remote-as 17 host2(config-router)#network 172.24.24.0 mask 255.255.248.0 host2(config-router)#aggregate-address 172.24.0.0 255.255.224.0 attribute-map conf_agg_att host2(config-router)#exit host2(config)#route-map conf_agg_att permit 10 host2(config-route-map)#set community no-export

aggregate-address

- Use to create an aggregate entry in a BGP routing table that summarizes more specific routes.
- For IPv4 routes, you must specify an aggregate IP address (address) and aggregate IP mask (mask). For IPv6 routes, you must specify an aggregate IPv6 prefix (ipv6Prefix).
- The optional as-set keyword preserves path information by creating an AS-Set that contains all the AS numbers traversed by the aggregated routes.

  | Note: Do not use the as-set keyword when you have many paths to aggregate. If you do, the aggregated route is continually withdrawn and reupdated as AS-path reachability information changes for the summarized routes.

- The summary-only keyword advertises only the aggregate route; it suppresses the advertisement of all more specific routes. Contrast with the suppress-map keyword.
- The suppress-map keyword enables you to specify a route map to filter particular routes covered by the aggregate that will be suppressed. Contrast with the summary-only keyword.

  | Note: If you want to suppress advertisements only to certain neighbors, you can—with caution—use the neighbor distribute-list command. If a more specific route leaks out, all BGP speakers will prefer that route over the less specific aggregate you are generating (using longest-match routing).

- The advertise-map keyword enables you to specify the advertise-map-tag, a string of up to 32 characters that identifies the route map that sets the routes to create AS-Set origin communities.
- The attribute-map keyword enables you to specify the attribute-map-tag, a string of up to 32 characters that identifies the route map that sets the attributes of the aggregate route.
- This command takes effect immediately.
- Use the no version to remove the aggregate route entry from the routing table.
- See aggregate-address.

## Advertising Inactive Routes

Under normal circumstances, routes that are not being used to forward traffic—inactive routes—are not advertised to peers unless synchronization is enabled. For example, suppose a BGP speaker receives a route to a particular prefix, determines that it is the best route to the prefix, and stores the route in the IP routing table (sometimes known as the forwarding information base, or FIB). This route might not be used for forwarding to that prefix; for example, if you have configured a static route to the same destination prefix. Because static routes have better administrative distances than BGP received routes, IP will use the static route rather than the BGP received route for forwarding traffic to that prefix. The BGP received route is inactive and is not advertised to peers. You can use the bgp advertise-inactive command to enable the advertisement of inactive received routes.

bgp advertise-inactive

- Use to enable the BGP speaker to advertise inactive routes—best routes in the IP forwarding table that are not being used to forward traffic. This feature is disabled by default.
- Issuing this command does not affect the BGP rules for best route selection, or how BGP populates the IP forwarding table.
- Example
  host1(config-router)#bgp advertise-inactive
- The new value is applied to all routes that are subsequently placed in the IP routing table.

  To apply the new value to routes that are already present in the IP routing table, you must use the clear ip bgp * command (this command will bounce the BGP sessions).

- Use the no version to prevent the advertising of received BGP routes unless one or both of the following are true:
  - The received route is in the BGP forwarding table and is being used to forward traffic (the route is active).
  - Synchronization is enabled.
- See bgp advertise-inactive.

## Verifying an AS Path

You can use the bgp enforce-first-as command to cause BGP to compare the first AS in the AS-path of a received route with the configured remote AS number of that EBGP peer. If the check fails, BGP returns a notification message to the peer.

bgp enforce-first-as

- Use to cause BGP to determine whether the first AS in the AS path of a route received from an EBGP peer matches the remote AS number of that peer.
- If the AS does not match, BGP sends a notification to the peer with the error code “ update message error” and error subcode “ malformed as-path.”
- This feature is disabled by default.
- Example
  host1(config-router)#bgp enforce-first-as
- Causes BGP to check the AS path of all routes received after you issue the command.

  To apply the new behavior to routes that are already present in the BGP routing table, you must use the clear ip bgp command to perform a soft clear or hard clear of the current BGP session.

- Use the no version to prevent the AS comparison from taking place.
- See bgp enforce-first-as.

## Advertising IPv4 Routes Between IPv6 BGP Peers

When an IPv6 network connects two separate IPv4 networks, you can use IPv6 to advertise the IPv4 routes over the BGP session, using TCP IPv6 as the transport mechanism. Similarly, you can advertise IPv6 routes between two IPv4 peers over their BGP session.

Configure the peers by using IPv6 addresses within the IPv4 unicast address family. You can set the IPv4 next hop with a static route or by configuring an inbound or outbound route map. This action overrides the IPv4 next hop that is advertised to the peer for IPv4 routes over BGP IPv6 peers.

If you do not use the route map, then the advertised IPv4 next hop is set to the BGP router ID. That value generally makes the next hop unreachable by the other BGP IPv6 peer.

host1(config)#router bgp 100 host1(config-router)#neighbor 21:1 remote-as 200 host1(config-router)#route-map my-v4-nexthop host1(config-router)#set ip next-hop 10.13.5.1 host1(config-router)#address-family ipv4 unicast host1(config-router-af)#neighbor 21:1 activate host1(config-router-af)#neighbor 21:1 route-map my-v4-nexthop out

## Advertising Routes Conditionally

By default, a BGP speaker advertises the best routes in its routing table to its peers. However, in some circumstances, you might prefer that some routes be advertised to a peer or peer group only when another route is in the BGP routing table, or only when that route is not in the routing table. BGP conditional advertisement enables you to control route advertisement without having to rely on only the best routes.

For example, in a multi-homed network, you might want to advertise certain prefixes to one of the providers when a failure occurs in the peering session with a different provider, or when there is only partial reachability to that peer.

In other cases, the advertisement to a peer of certain routes might be useful only in the event that some other routes are present in the BGP routing table.

You can use the neighbor advertise-map command with route maps to configure conditional advertisement of BGP routes to a peer or peer group within an address family. BGP conditional advertisement does not create routes. The routes specified by the route map in the neighbor advertise-map command must already be present in the BGP routing table.

BGP conditional advertisement is supported in only the following address families:

- Unicast IPv4
- Unicast IPv6
- Multicast IPv4
- Multicast IPv6
- VPNv4 unicast
- VPNv6 unicast

  | Note: For VPNv4 unicast and VPNv6 unicast address families, we recommend that you include a match extcommunity clause to match a route with a specific route target. However, conditional advertisement in these address families can sometimes result in unintended behaviors: advertisement of or based on an incorrect VPN route or a non-VPN route.

BGP conditional advertisement is not supported in the following address families:

- L2VPN
- Route-target
- VPLS
- VPWS

Use the exist-map keyword when you want a route advertised only when another route is present. The determining route must match the specified route map. If the route map you specify with the exist-map keyword references multiple routes, only one of those routes needs to be in the routing table to trigger the conditional advertisement.

Use the non-exist-map keyword when you want a route advertised only when another route is absent. The determining route must match the specified route map. If the route map you specify with the non-exist-map keyword references multiple routes, all of those routes must be absent to trigger the conditional advertisement.

You can optionally specify a sequence number for the advertise route map that matches the determining route. The sequence number specifies the order in which the advertise route maps are processed. It indicates the position the specified advertise route map has in the list of all advertise route maps that are configured for a particular neighbor within the same address family.

If you do not specify a sequence number, the position of the advertise route map is considered to be the sum of the current largest sequence number plus five. An advertise route map with a lower sequence number has a higher priority and is processed before one with a higher sequence number.

If the route matches more than one advertise route map, only the first matching advertise route map, based on the sequence, controls the advertisement of a BGP route.

You can configure a maximum of 50 advertise maps for a given peer or peer group in an address family. However, the name and sequence number for the advertise route map must be unique for each entry. BGP applies any policy specified by the advertise map to the conditionally advertised routes before outbound policy specified for the neighbor is applied.

The route maps referenced by the neighbor advertise-map command must include a match ip-address clause. You can also include additional match clauses. All match commands supported by existing outbound policies are supported. The additional clauses are useful when you want to match only on a specific route with a specific set of attributes. Only the permit keyword is acted on in a match clause. The deny keyword is ignored. Only exact matching of a prefix referenced by exist maps or non-exist maps is supported. Consequently a range specified by the ge or le keyword in the prefix list referenced by these route maps is ignored.

Clauses in a route map that include set commands or the match-set summary prefix-tree command are ignored. To change the attributes of conditionally advertised routes, you must use outbound routing policy.

If the contents of a referenced route map are changed, the new route map takes effect automatically.

neighbor advertise-map

- Use to specify a peer or peer group within the current address family to which routes specified by a route map are advertised conditionally, depending on whether a second route map is matched by some other routes in the BGP routing table.
- If you specify a BGP peer group by using the peerGroupName argument, all the members of the peer group inherit the characteristic configured with this command. This characteristic cannot be overridden for individual members of the peer group.
- This command takes effect immediately.
- Example
  host1(config-router-af)#neighbor 192.168.2.2 advertise-map advertiseroutes exist-map matchroute sequence 10
- Use the no version to remove the conditions set for advertising to the peer or peer group the routes specified by the route map. Use the default version to remove the explicit configuration from the peer or peer group and reestablish inheritance of the feature configuration.
- See neighbor advertise-map.

### Advertising a Route Only When Another Route is Present

You can use the exist-map keyword with the neighbor advertise-map command to advertise a route only when the routing table contains some other particular route.

In the network shown in Figure 18, router 2 (R2) has established BGP sessions with both router 1 (R1) and router 3 (R3). The plan is for router 2 to send router 1 an advertisement for the route to prefix 10.10.20.0/24 only if router 2 has received a route to prefix 172.24.19.0/24 from router 3.

Alternatively, if the route to prefix 172.24.20.0 has been installed in the BGP routing table on router 2, then router 2 advertises to router 1 the route to prefix 10.10.30.0. In this case, the route does not have to be learned from router 3.

Figure 18: Advertising a Route When Another Route is Present

The following commands represent a partial configuration of router R2:

host1(config)#router bgp 200 host1(config-router)#address-family ipv4 unicast host1(config-router-af)#neighbor 10.2.0.1 remote-as 100 host1(config-router-af)#neighbor 10.2.0.1 advertise-map advertisetoR1 exist-map trigger1 sequence 10 host1(config-router-af)#neighbor 10.2.0.1 advertise-map alternatetoR1 exist-map trigger2 host1(config-router-af)#exit host1(config-router)#exit !!Configure route map to send one route to R1!host1(config)#access-list 77 permit 10.10.20.0 0.0.0.255 host1(config)#route-map advertisetoR1 permit 10 host1(config-route-map)#match ip address 77 host1(config-route-map)#exit !!Configure route map to match one trigger route from R3!host1(config)#ip as-path access-list 1 permit ^300 host1(config)#access-list 70 permit 172.24.19.0 0.0.0.255 host1(config)#route-map trigger1 permit 10 host1(config-route-map)#match ip address 70 host1(config-route-map)#match as-path 1 host1(config-route-map)#exit !!Configure route map to send alternate route to R1!host1(config)#access-list test permit 10.10.30.0 0.0.0.255 host1(config)#route-map alternatetoR1 permit 10 host1(config-route-map)#match ip address test host1(config-route-map)#exit !!Configure route map to match alternate route from R3!host1(config)#access-list check permit 172.24.20.0 0.0.0.255 host1(config)#route-map trigger2 permit 10 host1(config-route-map)#match ip address check host1(config-route-map)#exit

The match as-path clause in the route map referenced by the exist-map keyword ensures that router 2 sends router 1 the route to prefix 10.10.20.0 only if a route to 172.24.19.0/24 with an AS path of 300 is present in the BGP routing table. Similarly, you can impose additional restraints by including any other match clause that is supported by an existing outbound policy.

In this configuration, the condition1 route map has a sequence number of ten. Advertise route maps configured for this peer within the same address family and a lower sequence number are processed before the condition1 route map. The condition2 route map has no sequence number configured, thus giving the route map a sequence number of 15 and ensuring that condition2 is processed after the condition1 route map.

### Advertising a Route Only When Another Route is Absent

You can use the non-exist-map keyword with the neighbor advertise-map command to advertise a route only when the BGP routing table does not contain some other particular route.

In the network shown in Figure 19, router R2 has established BGP sessions with both router R1 and router R3. The plan is for router R2 to send peergroup1 an advertisement for the route to prefix 10.10.30.0/24 only if the route to prefix 172.24.20.0/24 is not present in the BGP routing table. Alternatively, if router R2 has not received a route to prefix 172.21.30.0 from router R3, then router R2 advertises to peergroup1 the route to prefix 10.10.20.0. In this sample network, router R3 advertises neither of the routes to router R2. Consequently, router R2 advertises both 10.10.20.0/24 and 10.10.30.0/24 to peergroup1.

Figure 19: Advertising a Route When Another Route is Absent

The following commands configure router R2:

host1(config)#router bgp 200 host1(config-router)#neighbor peergroup1 peer-group host1(config-router)#neighbor peergroup1 remote-as 100 host1(config-router)#neighbor 10.6.6.2 peer-group peergroup1 host1(config-router)#neighbor 10.7.3.2 peer-group peergroup1 host1(config-router)#neighbor 10.4.4.2 peer-group peergroup1 host1(config-router)#neighbor peergroup1 advertise-map advertisetoPG1 non-exist-map condition1 sequence 5 host1(config-router)#neighbor peer-group1 advertise-map alternatetoPG1 non-exist-map condition2 host1(config-router)#exit host1(config)#ip as-path access-list 1 permit ^300 !!Configure route map to send one route to peergroup1!host1(config)#access-list 77 permit 10.10.30.0 0.0.0.255 host1(config)#route-map advertisetoPG1 permit 10 host1(config-route-map)#match ip address 77 host1(config-route-map)#exit !!Configure route map to match one trigger route!host1(config)#access-list 70 permit 172.24.20.0 0.0.0.255 host1(config)#route-map condition1 permit 10 host1(config-route-map)#match ip address 70 host1(config-route-map)#exit !!Configure route map to send alternate route to peergroup1 !host1(config)#access-list allow permit 10.10.20.0 0.0.0.255 host1(config)#route-map alternatetoPG1 permit 10 host1(config-route-map)#match ip address allow host1(config-route-map)#exit !!Configure route map to match an alternate trigger route!host1(config)#access-list test permit 172.21.30.0 0.0.0.255 host1(config)#route-map condition2 permit 10 host1(config-route-map)#match ip address test host1(config-route-map)#match as-path 1 host1(config-route-map)#exit

In this configuration, the condition1 route map has a sequence number of five, placing it high in the list of all configured advertise route maps for this peer group within the same address family. The condition2 route map has no sequence number configured, thus placing it at the bottom of the route map list.

In this configuration, the condition1 route map has a sequence number of ten. Route maps configured for this peer group within the same address family and a lower sequence number are processed before the condition1 route map. The condition2 route map has no sequence number configured, thus giving the route map the sequence number of ten and ensuring that condition2 is processed after the condition1 route map.

### Advertising a Default Route Only When Another Route Is Present

In some circumstances, you might want to control the advertisement of a default route based on the reachability of an IGP prefix. Because conditional advertisement tracks the BGP routing table rather than the IP routing table, the prefixes that govern the advertisement (the conditional prefixes) must be present in the BGP routing table. In order to use the IGP prefix as a condition, you must import the IGP prefixes into the BGP routing table. You must also configure the origination of the default route.

In the network shown in Figure 20, router R2 has an EBGP session with router R3 and has an IGP session with router R1. Suppose you want to advertise the default route to router R3 based on the reachability of an IGP prefix, 172.55.55.0/24, on router R2.

On router R2, configure a conditional advertisement entry for the neighbor R3. The advertise map must match the default route and the route map referenced by the exist-map keyword must match the imported IGP prefix.

In case router R3 must not learn about the IGP prefix 172.55.55.0/24, you must configure an additional outbound route map to deny this prefix so that it is not advertised to router R3.

With this configuration, the default route is advertised to router R3 only when the IGP prefix 172.55.55.0/24 is reachable on router R2. The default route is withdrawn if this prefix becomes unreachable.

Figure 20: Advertising a Default Route When Another Route is Present

The following commands configure router R2:

host1(config)#ip prefix-list default permit 0.0.0.0/0 host1(config)#route-map default permit 10 host1(config-route-map)#match ip address prefix-list default host1(config-route-map)#exit host1(config)#ip prefix-list test-default permit 172.55.0.0/16 host1(config)#route-map test permit 10 host1(config-route-map)#match ip address prefix-list test-default host1(config-route-map)#exit host1(config)#route-map outbound deny 10 host1(config-route-map)#match ip address prefix-list test-default host1(config-route-map)#exit host1(config)#route-map outbound permit 20 host1(config-route-map)#exit host1(config)#router bgp 200 host1(config-router)#neighbor 10.12.12.2 remote-as 300 host1(config-router)#network 172.55.55.0/24 host1(config-router)#aggregate-address 172.55.0.0/16 summary-only host1(config-router)#neighbor 10.12.12.2 advertise-map default exist-map test host1(config-router)#neighbor 10.12.12.2 default-originate host1(config-router)#neighbor 10.12.12.2 route-map outbound out host1(config-router)#exit