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. Refer to Understanding the Origin Attribute (p 1-99) for more information on origins. Figure 1-10 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.
- Specify a network-number and an optional network-mask.
- 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 (p 1-118) 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.
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. Once redistributed, BGP advertises the routes. When you redistribute routes, BGP sets the origin attribute for the route to Incomplete. Refer to Understanding the Origin Attribute (p 1-99) for more information on 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 1-11:
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 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.
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.
- Example
host1(config-router)#disable-dynamic-redistributeredistribute
- 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.
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-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 1-12, 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-originate![]()
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
host1(config)#router bgp 100host1(config-router)#default-information originate
- This command takes effect immediately.
- Use 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 1-13, 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 allow 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.
- Outbound route maps are not applied to this 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.
- 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 Sending 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 2.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. Figure 1-14 illustrates a network structure where you might use aggregation.
The following commands configure router LA and router SanJose so that router SanJose advertises an 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 should 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 1-14 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 1-14, 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 would not be 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.
- You must specify an aggregate IP address (address) and aggregate IP mask (mask).
- 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.
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-inactiveTo 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 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-asTo apply the new behavior to routes that are already present in the BGP RIB, you must use the clear ip bgp command to perform a soft clear or hard clear of the current BGP session.