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.
![]()
The following commands configure router NY:
host1(config)#router bgp 300host1(config-router)#neighbor 10.2.25.1 remote-as 100host1(config-router)#neighbor 10.4.4.1 remote-as 400host1(config-router)#network 192.168.33.0 mask 255.255.255.0The following commands configure router Boston:
host2(config)#router bgp 100host2(config-router)#neighbor 10.2.25.2 remote-as 300host2(config-router)#neighbor 10.3.3.1 remote-as 400host2(config-router)#network 172.19.0.0Notice 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 400host3(config-router)#neighbor 10.3.3.2 remote-as 100host3(config-router)#neighbor 10.4.4.2 remote-as 300host3(config-router)#network 172.28.8.0 mask 255.255.248.0network
- 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 065535.
- 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.
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
- 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-internalUse 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. 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 routerstatic routescan 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.12host2(config)#ip route 172.16.8.0 255.255.248.0 10.211.5.7host2(config)#ip route 192.168.4.0 255.255.254.0 10.14.147.2host2(config)#router bgp 29host2(config-router)#neighbor 10.1.1.2 remote-as 92host2(config-router)#redistribute statichost2(config-router)#redistribute ospf
![]()
clear bgp ipv6 redistribution
- Use to reapply policy to routes that have been redistributed into BGP.
- This command takes effect immediately.
- There is no no version.
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-redistributeUse the no version to reenable dynamic redistribution. 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 065535. 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.
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.
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-internalhost1(config-router)#exithost1(config)#exithost1(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.
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.
host1(config)#router bgp 200host1(config-router)#network 192.168.42.0 mask 255.255.254.0host1(config-router)#neighbor 10.3.3.1 remote-as 300host1(config-router)#neighbor 192.168.10.2 remote-as 100host1(config-router)#neighbor 192.168.10.2 default-originateYou 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 100host1(config-router)#default-information originateUse the no version to restore the default, preventing the redistribution of default routes. 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 62host1(config-router)#network 172.17.24.0 mask 255.255.248.0host1(config-router)#neighbor 10.8.3.1 remote-as 21host1(config-router)#neighbor 10.8.3.1 default-originateYou 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 21host2(config-router)#network 192.168.48.0 mask 255.255.240.0host2(config-router)#neighbor 10.8.3.4 remote-as 62host2(config-router)#neighbor 10.24.5.1 remote-as 37host2(config-router)#exithost2(config)#ip route 0.0.0.0 0.0.0.0 172.25.122.0Router StLouis is configured to advertise network 172.25.122.0/23 to router Chicago:
host3(config)#router bgp 37host3(config-router)#network 172.25.122.0 mask 255.255.254.0host3(config-router)#neighbor 10.24.5.3 remote-as 21
![]()
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.
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 100host1(config-router)#neighbor 10.2.2.2 advertisement-interval 5neighbor 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.
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 Snakes so that router Snakes 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.
host1(config)#router bgp 873host1(config-router)#neighbor 10.2.2.4 remote-as 873host1(config-router)#network 172.24.1.0 mask 255.255.255.0host1(config-router)#network 172.24.2.0 mask 255.255.255.0host2(config)#router bgp 873host2(config-router)#neighbor 10.2.2.3 remote-as 873host2(config-router)#neighbor 10.5.5.1 remote-as 17host2(config-router)#network 172.24.24.0 mask 255.255.248.0host2(config-router)#aggregate-address 172.24.0.0 255.255.224.0As 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 873host2(config-router)#neighbor 10.2.2.3 remote-as 873host2(config-router)#neighbor 10.5.5.1 remote-as 17host2(config-router)#network 172.24.24.0 mask 255.255.248.0host2(config-router)#aggregate-address 172.24.0.0 255.255.224.0 summary-onlyEach 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 873host2(config-router)#neighbor 10.2.2.3 remote-as 873host2(config-router)#neighbor 10.5.5.1 remote-as 17host2(config-router)#network 172.24.24.0 mask 255.255.248.0host2(config-router)#aggregate-address 172.24.0.0 255.255.224.0 summary-only as-setIf 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 873host2(config-router)#neighbor 10.2.2.3 remote-as 873host2(config-router)#neighbor 10.5.5.1 remote-as 17host2(config-router)#neighbor 10.2.2.3 route-map lmt_agg inhost2(config-router)#network 172.24.24.0 mask 255.255.248.0host2(config-router)#aggregate-address 172.24.0.0 255.255.224.0 advertise-map lmt_agghost2(config-router)#exithost2(config)#route-map lmt_agg permit 10host2(config-route-map)#match ip address 1host2(config-route-map)#exithost2(config)#access-list 1 permit 172.24.48.0 0.240.255.255You 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 873host2(config-router)#neighbor 10.2.2.3 remote-as 873host2(config-router)#neighbor 10.5.5.1 remote-as 17host2(config-router)#network 172.24.24.0 mask 255.255.248.0host2(config-router)#aggregate-address 172.24.0.0 255.255.224.0 attribute-map conf_agg_atthost2(config-router)#exithost2(config)#route-map conf_agg_att permit 10host2(config-route-map)#set community no-exportaggregate-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.
- 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.
- 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.
Advertising Inactive Routes
Under normal circumstances, routes that are not being used to forward trafficinactive routesare 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 routesbest 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-inactiveThe 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.
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-asCauses 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.
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 100host1(config-router)#neighbor 21:1 remote-as 200host1(config-router)#route-map my-v4-nexthophost1(config-router)#set ip next-hop 10.13.5.1host1(config-router)#address-family ipv4 unicasthost1(config-router-af)#neighbor 21:1 activatehost1(config-router-af)#neighbor 21:1 route-map my-v4-nexthop outAdvertising 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
BGP conditional advertisement is not supported in the following address families:
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 10Use 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. 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 11, 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.
![]()
The following commands represent a partial configuration of router R2:
host1(config)#router bgp 200host1(config-router)#address-family ipv4 unicasthost1(config-router-af)#neighbor 10.2.0.1 remote-as 100host1(config-router-af)#neighbor 10.2.0.1 advertise-map advertisetoR1 exist-map trigger1 sequence 10host1(config-router-af)#neighbor 10.2.0.1 advertise-map alternatetoR1 exist-map trigger2host1(config-router-af)#exithost1(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.255host1(config)#route-map advertisetoR1 permit 10host1(config-route-map)#match ip address 77host1(config-route-map)#exit!!Configure route map to match one trigger route from R3!host1(config)#ip as-path access-list 1 permit ^300host1(config)#access-list 70 permit 172.24.19.0 0.0.0.255host1(config)#route-map trigger1 permit 10host1(config-route-map)#match ip address 70host1(config-route-map)#match as-path 1host1(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.255host1(config)#route-map alternatetoR1 permit 10host1(config-route-map)#match ip address testhost1(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.255host1(config)#route-map trigger2 permit 10host1(config-route-map)#match ip address checkhost1(config-route-map)#exitThe 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.
![]()
The following commands configure router R2:
host1(config)#router bgp 200host1(config-router)#neighbor peergroup1 peer-grouphost1(config-router)#neighbor peergroup1 remote-as 100host1(config-router)#neighbor 10.6.6.2 peer-group peergroup1host1(config-router)#neighbor 10.7.3.2 peer-group peergroup1host1(config-router)#neighbor 10.4.4.2 peer-group peergroup1host1(config-router)#neighbor peergroup1 advertise-map advertisetoPG1 non-exist-map condition1 sequence 5host1(config-router)#neighbor peer-group1 advertise-map alternatetoPG1 non-exist-map condition2host1(config-router)#exithost1(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.255host1(config)#route-map advertisetoPG1 permit 10host1(config-route-map)#match ip address 77host1(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.255host1(config)#route-map condition1 permit 10host1(config-route-map)#match ip address 70host1(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.255host1(config)#route-map alternatetoPG1 permit 10host1(config-route-map)#match ip address allowhost1(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.255host1(config)#route-map condition2 permit 10host1(config-route-map)#match ip address testhost1(config-route-map)#match as-path 1host1(config-route-map)#exitIn 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.
![]()
The following commands configure router R2:
host1(config)#ip prefix-list default permit 0.0.0.0/0host1(config)#route-map default permit 10host1(config-route-map)#match ip address prefix-list defaulthost1(config-route-map)#exithost1(config)#ip prefix-list test-default permit 172.55.0.0/16host1(config)#route-map test permit 10host1(config-route-map)#match ip address prefix-list test-defaulthost1(config-route-map)#exithost1(config)#route-map outbound deny 10host1(config-route-map)#match ip address prefix-list test-defaulthost1(config-route-map)#exithost1(config)#route-map outbound permit 20host1(config-route-map)#exithost1(config)#router bgp 200host1(config-router)#neighbor 10.12.12.2 remote-as 300host1(config-router)#network 172.55.55.0/24host1(config-router)#aggregate-address 172.55.0.0/16 summary-onlyhost1(config-router)#neighbor 10.12.12.2 advertise-map default exist-map testhost1(config-router)#neighbor 10.12.12.2 default-originatehost1(config-router)#neighbor 10.12.12.2 route-map outbound outhost1(config-router)#exit