BGP Configuration Steps PDF
BGP Configuration Steps PDF
BGP Configuration Steps PDF
Configuring BGP
Cisco IOS IP Configuration Guide, Release 12.2 About Cisco IOS Software Documentation Using Cisco IOS Software IP Overview Part 1: IP Addressing Services Part 2: IP Routing Protocols Configuring On-Demand Routing Configuring Routing Information Protocol Configuring IGRP Configuring EIGRP Configuring BGP Configuring Multiprotocol BGP Extensions for IP Multicast Configuring IP Routing Protocol-Independent Features Part 3: IP Multicast
Table Of Contents
Configuring BGP The Cisco BGP Implementation How BGP Selects Paths BGP Multipath Support Basic BGP Configuration Task List Advanced BGP Configuration Task List Configuring Basic BGP Features Enabling BGP Routing Configuring BGP Neighbors Managing Routing Policy Changes Resetting a Router Using BGP Dynamic Inbound Soft Reset Resetting a Router Using BGP Outbound Soft Reset Configuring BGP Soft Reset Using Stored Routing Policy Information Verifying BGP Soft Reset Configuring BGP Interactions with IGPs Configuring BGP Weights Disabling Autonomous System Path Comparison Configuring BGP Route Filtering by Neighbor Configuring BGP Filtering Using Prefix Lists How the System Filters Traffic by Prefix List Creating a Prefix List Configuring a Prefix List Entry Configuring How Sequence Numbers of Prefix List Entries Are Specified Deleting a Prefix List or Prefix List Entries Displaying Prefix Entries Clearing the Hit Count Table of Prefix List Entries Configuring BGP Path Filtering by Neighbor Disabling Next Hop Processing on BGP Updates Disabling Next Hop Processing Using a Specific Address Disabling Next Hop Processing Using a Route Map Configuring BGP Next Hop Propagation Configuring the BGP Version Configuring the MED Metric Configuring Advanced BGP Features Using Route Maps to Modify Updates Resetting eBGP Connections Immediately upon Link Failure Configuring Aggregate Addresses Disabling Automatic Summarization of Network Numbers Configuring BGP Community Filtering Specifying the Format for the Community Configuring BGP Conditional Advertisement BGP Conditional Advertisement Configuration Task List Conditional Advertisement of a Set of Routes Verifying BGP Conditional Advertisement BGP Conditional Advertisement Troubleshooting Tips Configuring a Routing Domain Confederation Configuring a Route Reflector Configuring BGP Peer Groups Creating the Peer Group Assigning Options to the Peer Group Making Neighbors Members of the Peer Group Disabling a Peer or Peer Group Indicating Backdoor Routes Modifying Parameters While Updating the IP Routing Table Setting Administrative Distance Adjusting BGP Timers Changing the Default Local Preference Value Redistributing Network 0.0.0.0 Configuring the Router to Consider a Missing MED as Worst Path Selecting Path Based on MEDs from Other Autonomous Systems Configuring the Router to Use the MED to Choose a Path from Subautonomous System Paths Configuring the Router to Use the MED to Choose a Path in a Confederation Configuring Route Dampening Minimizing Flapping Understanding Route Dampening Terms Enabling Route Dampening Monitoring and Maintaining BGP Route Dampening Monitoring and Maintaining BGP Clearing Caches, Tables, and Databases Displaying System and Network Statistics Logging Changes in Neighbor Status BGP Configuration Examples BGP Route Map Examples BGP Neighbor Configuration Examples BGP Prefix List Filtering Examples Route Filtering Configuration Example Using a Single Prefix List Route Filtering Configuration Example Specifying a Group of Prefixes Added or Deleted Prefix List Entries Examples BGP Soft Reset Examples Dynamic Inbound Soft Reset Example Inbound Soft Reset Using Stored Information Example BGP Synchronization Examples BGP Path Filtering by Neighbor Examples BGP Aggregate Route Examples BGP Community with Route Maps Examples BGP Conditional Advertisement Configuration Examples BGP Confederation Examples BGP Peer Group Examples
Download this chapter Configuring BGP Download the complete book Book-level PDF: Cisco IOS IP Configuration Guide, Release 12.2 (PDF - 6 MB) Feedback
1 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
iBGP Peer Group Example eBGP Peer Group Example TCP MD5 Authentication for BGP Examples
Configuring BGP
This chapter describes how to configure Border Gateway Protocol (BGP). For a complete description of the BGP commands in this chapter, refer to the "BGP Commands" chapter of the Cisco IOS IP Command Reference, Volume 2 of 3: Routing Protocols. To locate documentation of other commands that appear in this chapter, use the command reference master index, or search online. For multiprotocol BGP configuration information and examples, refer to the "Configuring Multiprotocol BGP Extensions for IP Multicast" chapter of the Cisco IOS IP Configuration Guide. For multiprotocol BGP command descriptions, refer to the "Multiprotocol BGP Extensions for IP Multicast Commands" chapter of the Cisco IOS IP Command Reference. BGP, as defined in RFCs 1163 and 1267, is an Exterior Gateway Protocol (EGP). It allows you to set up an interdomain routing system that automatically guarantees the loop-free exchange of routing information between autonomous systems. For protocol-independent features, see the chapter "Configuring IP Routing Protocol-Independent Features" in this book. To identify the hardware platform or software image information associated with a feature, use the Feature Navigator on Cisco.com to search for information about the feature or refer to the software release notes for a specific release. For more information, see the "Identifying Supported Platforms" section in the "Using Cisco IOS Software" chapter in this book.
BGP bases its decision process on the attribute values. When faced with multiple routes to the same destination, BGP chooses the best route for routing traffic toward the destination. The following process summarizes how BGP chooses the best route. 1. If the next hop is inaccessible, do not consider it. This decision is why it is important to have an IGP route to the next hop. 2. 3. 4. 5. If the path is internal, synchronization is enabled, and the route is not in the IGP, do not consider the route. Prefer the path with the largest weight (weight is a Cisco proprietary parameter). If the routes have the same weight, prefer the route with the largest local preference. If the routes have the same local preference, prefer the route that was originated by the local router. For example, a route might be originated by the local router using the network bgp router configuration command, or through redistribution from an IGP. 6. 7. 8. If the local preference is the same, or if no route was originated by the local router, prefer the route with the shortest autonomous system path. If the autonomous system path length is the same, prefer the route with the lowest origin code (IGP < EGP < INCOMPLETE). If the origin codes are the same, prefer the route with the lowest MED metric attribute. This comparison is only made if the neighboring autonomous system is the same for all routes considered, unless the bgp always-compare-med router configuration command is enabled.
Note The most recent Internet Engineering Task Force (IETF) decision regarding BGP MED assigns a value of infinity to the missing MED, making the route lacking the MED variable the least preferred. The default behavior of BGP routers running Cisco IOS software is to treat routes without the MED attribute as having a MED of 0, making the route lacking the MED variable the most preferred. To configure the router to conform to the IETF standard, use the bgp bestpath med missing-as-worst router configuration command. 9. Prefer the external BGP (eBGP) path over the iBGP path. All confederation paths are considered internal paths. 10. Prefer the route that can be reached through the closest IGP neighbor (the lowest IGP metric). The router will prefer the shortest internal path within the autonomous system to reach the destination (the shortest path to the BGP next hop). 11. If the following conditions are all true, insert the route for this path into the IP routing table: Both the best route and this route are external. Both the best route and this route are from the same neighboring autonomous system. The maximum-paths router configuration command is enabled.
Note eBGP load sharing can occur at this point, which means that multiple paths can be installed in the forwarding table.
2 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
12.
If multipath is not enabled, prefer the route with the lowest IP address value for the BGP router ID. The router ID is usually the highest IP address on the router or the loopback (virtual) address, but might be implementationspecific.
For information on configuring features that apply to multiple IP routing protocols (such as redistributing routing information), see the chapter "Configuring IP Routing Protocol-Independent Features."
Command
Step 1 Router(config)# router bgp as-number
Purpose
Enables a BGP routing process, which places the router in router configuration mode. Flags a network as local to this autonomous system and enters it to the BGP table.
3 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
Note For exterior protocols, a reference to an IP network from the network router configuration command controls only which networks are advertised. This behavior is in contrast to IGP, such as IGRP, which also use the network command to determine where to send updates.
Note The network command is used to inject IGP routes into the BGP table. The network-mask portion of the command allows supernetting and subnetting. The resources of the router, such as configured NVRAM or RAM, determine the upper limit of the number of network commands you can use. Alternatively, you could use the redistribute router configuration command to achieve the same result.
Command
Router(config-router)# neighbor {ip-address | peer-group-name} remote-as as-number
Purpose
Specifies a BGP neighbor.
See the "BGP Neighbor Configuration Examples" section at the end of this chapter for an example of configuring BGP neighbors.
Type of Reset
Hard reset
Advantages
No memory overhead.
Disadvantages
The prefixes in the BGP, IP, and Forwarding Information Base (FIB) tables provided by the neighbor are lost. Not recommended. Does not reset inbound routing table updates.
No configuration, no storing of routing table updates. The procedure for an outbound reset is described in the section "Configuring BGP Soft Reset Using Stored Routing Policy Information."
Does not clear the BGP session Both BGP routers must support the and cache. route refresh capability (in Cisco IOS Release 12.1 and later Does not require storing of releases). routing table updates, and has no memory overhead. Can be used when both BGP routers do not support the automatic route refresh capability. Requires preconfiguration. Stores all received (inbound) routing policy updates without modification; is memory-intensive. Recommended only when absolutely necessary, such as when both BGP routers do not support the automatic route refresh capability.
Configured inbound soft reset (uses the neighbor soft-reconfiguration router configuration command)
Once you have defined two routers to be BGP neighbors, they will form a BGP connection and exchange routing information. If you subsequently change a BGP filter, weight, distance, version, or timer, or make a similar configuration change, you must reset BGP connections for the configuration change to take effect. A soft reset updates the routing table for inbound and outbound routing updates. Cisco IOS software Release 12.1 and later releases support soft reset without any prior configuration. This soft reset allows the dynamic exchange of route refresh requests and routing information between BGP routers, and the subsequent re-advertisement of the respective outbound routing table. There are two types of soft reset: When soft reset is used to generate inbound updates from a neighbor, it is called dynamic inbound soft reset. When soft reset is used to send a new set of updates to a neighbor, it is called outbound soft reset.
To use soft reset without preconfiguration, both BGP peers must support the soft route refresh capability, which is advertised in the OPEN message sent when the peers establish a TCP session. Routers running Cisco IOS software releases prior to Release 12.1 do not support the route refresh capability and must clear the BGP session using the neighbor soft-reconfiguration router configuration command, described in "Configuring BGP Soft Reset Using Stored Routing Policy Information." Clearing the BGP session in this way will have a negative impact upon network operations and should only be used as a last resort.
4 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
Does not require additional memory for storing routing update information
To determine whether a router supports the route refresh capability, use the show ip bgp neighbors command in EXEC mode:
Command
Router# show ip bgp neighbors ip-address
Purpose
Displays whether a neighbor supports the route refresh capability. If the specified router supports the route refresh capability, the following message is displayed: Received route refresh capability from peer.
If all the BGP routers support the route refresh capability, you can use the dynamic soft reset method for resetting the inbound routing table. To perform a dynamic soft reset of the inbound routing table, use the following command in EXEC mode:
Command
Router# clear ip bgp {* | neighboraddress | peer-group-name} soft in
Purpose
Performs a dynamic soft reset on the connection specified in the command. The neighbor-address argument specifies the connection to be reset. Use the * keyword to specify that all connections be reset.
See the "BGP Soft Reset Examples" section at the end of this chapter for examples of both types of BGP soft resets.
Command
Router# clear ip bgp {* | neighboraddress | peer-group-name} soft out
Purpose
Performs a soft reset on the connection specified in the command. The neighbor-address argument specifies the connection to be reset. Use the * keyword to specify that all connections be reset.
Command
Purpose
Step 1 Router(config-router)# neighbor Resets the BGP session and initiates storage of {ip-address | peer-group-name} inbound routing table updates from the specified soft-reconfiguration inbound neighbor or peer group. From that point forward, a copy of the BGP routing table for the specified neighbor or peer group is maintained on the router. The Cisco implementation of BGP supports BGP Versions 2, 3, and 4. If the neighbor does not accept default Version 4, dynamic version negotiation is implemented to negotiate down to Version 2. If you specify a BGP peer group by using the peer-group-name argument, all members of the peer group will inherit the characteristic configured with this command. Step 2 Router# clear ip bgp {* |
neighbor-address | peer-group-name} soft in
Performs a soft reset on the connection specified in the command, using the stored routing table information for that connection.
See the "BGP Path Filtering by Neighbor Examples" section at the end of this chapter for an example of BGP path filtering by neighbor.
5 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
Step 2 Enter the show ip bgp neighbors EXEC command to display information about the BGP and TCP connections to neighbors:
Router# show ip bgp neighbors 171.69.232.178 BGP neighbor is 172.16.232.178, remote AS 35, external link BGP version 4, remote router ID 192.168.3.3 BGP state = Established, up for 1w1d Last read 00:00:53, hold time is 180, keepalive interval is 60 seconds Neighbor capabilities: Route refresh: advertised and received Address family IPv4 Unicast: advertised and received Address family IPv4 Multicast: advertised and received Received 12519 messages, 0 notifications, 0 in queue Sent 12523 messages, 0 notifications, 0 in queue Route refresh request: received 0, sent 0 Minimum time between advertisement runs is 30 seconds
For address family: IPv4 Unicast BGP table version 5, neighbor version 5 Index 1, Offset 0, Mask 0x2 Community attribute sent to this neighbor Inbound path policy configured Outbound path policy configured Route map for incoming advertisements is uni-in Route map for outgoing advertisements is uni-out 3 accepted prefixes consume 108 bytes Prefix advertised 6, suppressed 0, withdrawn 0
For address family: IPv4 Multicast BGP table version 5, neighbor version 5 Index 1, Offset 0, Mask 0x2 Inbound path policy configured Outbound path policy configured Route map for incoming advertisements is mul-in Route map for outgoing advertisements is mul-out 3 accepted prefixes consume 108 bytes Prefix advertised 6, suppressed 0, withdrawn 0
Connections established 2; dropped 1 Last reset 1w1d, due to Peer closed the session Connection state is ESTAB, I/O status: 1, unread input bytes: 0 Local host: 172.16.232.178, Local port: 179 Foreign host: 172.16.232.179, Foreign port: 11002
mis-ordered: 0 (0 bytes)
Event Timers (current time is 0x2CF49CF8): Timer Retrans TimeWait AckHold SendWnd KeepAlive GiveUp PmtuAger DeadWait Starts 12518 0 12514 0 0 0 0 0 Wakeups 0 0 12281 0 0 0 0 0 Next 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
iss: irs:
273358651 190480283
snduna: rcvnxt:
273596614 190718186
sndnxt: rcvwnd:
273596614 15491
sndwnd: delrcvwnd:
15434 893
SRTT: 300 ms, RTTO: 607 ms, RTV: 3 ms, KRTT: 0 ms minRTT: 0 ms, maxRTT: 300 ms, ACK hold: 200 ms Flags: passive open, nagle, gen tcbs
Datagrams (max data segment is 1460 bytes): Rcvd: 24889 (out of order: 0), with data: 12515, total data bytes: 237921 Sent: 24963 (retransmit: 0), with data: 12518, total data bytes: 237981
6 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
Command
Purpose
See the "BGP Path Filtering by Neighbor Examples" section at the end of this chapter for an example of BGP synchronization. In general, you will not want to redistribute most BGP routes into your IGP. A common design is to redistribute one or two routes and to make them exterior routes in IGRP, or have your BGP speaker generate a default route for your autonomous system. When redistributing from BGP into IGP, only the routes learned using eBGP get redistributed. In most circumstances, you also will not want to redistribute your IGP into BGP. List the networks in your autonomous system with network router configuration commands and your networks will be advertised. Networks that are listed this way are referred to as local networks and have a BGP origin attribute of "IGP." They must appear in the main IP routing table and can have any source; for example, they can be directly connected or learned via an IGP. The BGP routing process periodically scans the main IP routing table to detect the presence or absence of local networks, updating the BGP routing table as appropriate. If you do perform redistribution into BGP, you must be very careful about the routes that can be in your IGP, especially if the routes were redistributed from BGP into the IGP elsewhere. Redistributing routes from BGP into the IGP elsewhere creates a situation where BGP is potentially injecting information into the IGP and then sending such information back into BGP, and vice versa. Incorrectly redistributing routes into BGP can result in the loss of critical information, such as the autonomous system path, that is required for BGP to function properly. Networks that are redistributed into BGP from the EGP protocol will be given the BGP origin attribute "EGP." Other networks that are redistributed into BGP will have the BGP origin attribute of "incomplete." The origin attribute in the Cisco implementation is only used in the path selection process.
Command
Router(config-router)# bgp bestpath as-path ignore
Purpose
Configures the router to ignore autonomous system path length in selecting a route.
Filtering using prefix lists is described in the "Configuring BGP Filtering Using Prefix Lists" section. If you want to restrict the routing information that the Cisco IOS software learns or advertises, you can filter BGP routing updates to and from particular neighbors. You can either define an access list or a prefix list and apply it to the updates.
Note Distribute-list filters are applied to network numbers and not autonomous system paths. To filter BGP routing updates, use the following command in router configuration mode:
Command
Purpose
Router(configFilters BGP routing updates to and from neighbors as specified in router)# neighbor {ip-address an access list. | peer-group-name} distribute-list {accessNote The neighbor prefix-list router configuration command can list-number | accessbe used as an alternative to the neighbor distribute-list list-name} {in | out}
router configuration command, but you cannot use both commands to configure the same BGP peer in any specific direction. These two commands are mutually exclusive, and only one command (neighbor prefix-list or neighbor distribute-list) an be applied for each inbound or outbound direction.
Note Although the neighbor prefix-list router configuration command can be used as an alternative to the neighbor distribute-list command, do not use attempt to apply both the neighbor prefix-list and neighbor distribute-list command filtering to the same neighbor in any given direction. These two commands are mutually exclusive, and only one command (neighbor prefix-list or neighbor distribute-list) can be applied for each inbound or outbound direction.
7 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
Before using a prefix list in a command, you must set up a prefix list, and you may want to assign sequence numbers to the entries in the prefix list.
Command
Router(config-router)# ip prefix-list list-name [seq sequence-value] {deny | permit network/length} [ge ge-value] [le le-value]
Purpose
Creates a prefix list with the name specified for the list-name argument.
Note To create a prefix list you must enter at least one permit or deny clause. To remove a prefix list and all of its entries, use the following command in router configuration mode:
Command
Router(config-router)# no ip prefix-list list-name [seq sequence-value] {deny | permit network/length} [ge ge-value] [le le-value]
Purpose
Removes a prefix list with the name specified for list-name.
Command
Router(config-router)# ip prefix-list list-name [seq sequence-value] {deny | permit network/length} [ge ge-value] [le le-value]
Purpose
Creates an entry in a prefix list and assigns a sequence number to the entry.
The optional ge and le keywords can be used to specify the range of the prefix length to be matched for prefixes that are more specific than the network/length argument. An exact match is assumed when neither ge nor le is specified. The range is assumed to be from ge-value to 32 if only the ge attribute is specified, and from len to le-value if only the le attribute is specified. A specified ge-value or le-value must satisfy the following condition:
len < ge-value <= le-value <= 32
For example, to deny all prefixes matching /24 in 128.0.0.0/8, use the following command:
ip prefix-list abc deny 128.0.0.0/8 ge 24 le 24
Note You can specify sequence values for prefix list entries in any increments you want (the automatically generated numbers are incremented in units of 5). If you specify the sequence values in increments of 1, you cannot insert additional entries into the prefix list. If you choose very large increments, you could run out of sequence values.
Command
Router(config-router)# no ip prefix-list sequence-number
Purpose
Disables the automatic generation of the sequence numbers for prefix list entries.
To re-enable automatic generation of the sequence numbers of prefix list entries, use the ip prefix-list sequence number command in router configuration mode:
8 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
Command
Router(config-router)# ip prefix-list sequence-number
Purpose
Enables the automatic generation of the sequence numbers of prefix list entries. The default is enable.
If you disable automatic generation of sequence numbers in a prefix list, you must specify the sequence number for each entry using the sequence-value argument of the ip prefix-list global configuration command. Regardless of whether the default sequence numbers are used in configuring a prefix list, a sequence number need not be specified when deconfiguring an entry. show commands include the sequence numbers in their output.
Command
Router(config-router)# no ip prefix-list list-name
Purpose
Deletes a prefix list.
You can delete entries from a prefix list individually. To delete an entry in a prefix list, use the following command in router configuration mode:
Command
Router(config-router)# no ip prefix-list seq sequence-value
Purpose
Deletes an entry in a prefix list.
Note The sequence number of an entry need not be specified when you delete the entry.
Command
Router# show ip prefix-list [detail | summary] Router# show ip prefix-list [detail | summary] prefix-list-name Router# show ip prefix-list prefixlist-name [network/length] Router# show ip prefix-list prefixlist-name [seq sequence-number] Router# show ip prefix-list prefixlist-name [network/length] longer Router# show ip prefix-list prefixlist-name [network/length] first-match
Purpose
Displays information about all prefix lists. Displays a table showing the entries in a prefix list. Displays the policy associated with the node. Displays the prefix list entry with a given sequence number. Displays all entries of a prefix list that are more specific than the given network and length. Displays the entry of a prefix list that matches the given prefix (network and length of prefix).
Command
Router# clear ip prefix-list prefix-list-name [network/length]
Purpose
Clears the hit count table of the prefix list entries.
Command
Step 1 Router# ip as-path access-list access-list-number
{permit | deny} as-regexp
Purpose
Defines a BGP-related access list. Enters router configuration mode. Establishes a BGP filter.
See the "BGP Path Filtering by Neighbor Examples" section at the end of this chapter for an example of BGP path filtering by neighbor.
9 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
You can configure the Cisco IOS software to disable next hop processing for BGP updates to a neighbor. Disabling next hop processing might be useful in nonmeshed networks such as Frame Relay or X.25, where BGP neighbors might not have direct access to all other neighbors on the same IP subnet. There are two ways to disable next hop processing: Provide a specific address to be used instead of the next hop address (manually configuring each address). Use a route map to specify that the address of the remote peer for matching inbound routes, or the local router for matching outbound routes (automatic method).
Command
Router(config-router)# neighbor {ip-address | peer-group-name} next-hop-self
Purpose
Disables next hop processing on BGP updates to a neighbor.
Configuring this command causes the current router to advertise its peering address as the next hop for the specified neighbor. Therefore, other BGP neighbors will forward to it packets for that address. This configuration is useful in a nonmeshed environment because you know that a path exists from the present router to that address. In a fully meshed environment, this configuration is not useful because it will result in unnecessary extra hops and because there might be a direct access through the fully meshed cloud with fewer hops.
Command
Purpose
Router(config-route-map)# set In an inbound route map of a BGP peer, sets the next hop of the ip next-hop ip-address [...ipmatching routes to be the neighbor peering address, overriding address] [peer-address]
any third-party next hops and allowing the same route map to be applied to multiple BGP peers to override third-party next hops. With an outbound route map of a BGP peer, sets the next hop of the received address to the peering address of the local router, disabling the next hop calculation. The next hop must be an adjacent router.
Caution Incorrectly setting BGP attributes for a route reflector can cause inconsistent routing, routing loops, or a loss of connectivity. Setting BGP attributes for a route reflector should be attempted only by an experienced network operator. The configuration of this feature in conjunction with the iBGP Multipath Load Sharing feature allows you to use an outbound route map to include BGP route reflectors in the forwarding path. The BGP Next Hop Propagation feature allows you to perform the following tasks: Bring the route reflector into the forwarding path, which can be used with the iBGP Multipath Load Sharing feature to configure load balancing. Configure interprovider Multiprotocol Label Switching (MPLS) Virtual Private Networks (VPNs) by not modifying the next hop attribute when advertising routes to an eBGP peer. Turn off the next hop calculation for an eBGP peer. This feature is useful for configuring the end-to-end connection of a labelswitched path.
To configure an eBGP multihop peer to propagate the next hop unchanged, use the following command in router configuration mode:
Command
Router(config-router)# neighbor ip-address next-hop-unchanged
Purpose
Configures the router to send BGP updates to BGP peers without modifying the next hop attribute.
Caution This command should be configured only on route-reflector clients and not on a route reflector.
Command
Router(config-router)# neighbor {ip-address | peer-group-name} version number
Purpose
Specifies the BGP version to use when communicating with a neighbor.
10 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
BGP uses the MED metric as a hint to external neighbors about preferred paths. (The name of this metric for BGP Versions 2 and 3 is INTER_AS_METRIC.) To set the MED of the redistributed routes, Use the following command in router configuration mode. All the routes without a MED will also be set to this value.
Command
Router(config-router)# default-metric number
Purpose
Sets an MED.
Alternatively, you can set the MED using the route-map router configuration command. See the "BGP Route Map Examples" section at the end of this chapter for examples of using BGP route maps.
Command
Router(config-router)# neighbor {ip-address | peer-group-name} route-map map-name {in | out}
Purpose
Applies a route map to incoming or outgoing routes.
See the "BGP Route Map Examples" section at the end of this chapter for BGP route map examples.
Command
Router(config-router)# bgp fast-external-fallover
Purpose
Resets eBGP sessions automatically.
Command
Purpose
Router(config-router)# aggregate-address address Creates an aggregate entry in the BGP mask routing table. Router(config-router)# aggregate-address address Generates autonomous system set path mask as-set
information.
Router(config-router)# aggregate-address address Suppresses selected, more specific routes. mask suppress-map map-name Router(config-router)# aggregate-address address Generates an aggregate based on mask advertise-map map-name conditions specified by the route map. Router(config-router)# aggregate-address address Generates an aggregate with attributes mask attribute-map map-name
See the "BGP Aggregate Route Examples" section at the end of this chapter for examples of using BGP aggregate routes.
Command
Router(config-router)# no auto-summary
Purpose
Disables automatic network summarization.
The communities attribute is a way to group destinations into communities and apply routing decisions based on the communities. This method simplifies the configuration of a BGP speaker that controls distribution of routing information.
11 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
A community is a group of destinations that share some common attribute. Each destination can belong to multiple communities. Autonomous system administrators can define to which communities a destination belongs. By default, all destinations belong to the general Internet community. The community is carried as the communities attribute. The communities attribute is an optional, transitive, global attribute in the numerical range from 1 to 4,294,967,200. Along with Internet community, there are a few predefined, well-known communities, as follows: internetAdvertise this route to the Internet community. All routers belong to it. no-exportDo not advertise this route to eBGP peers. no-advertiseDo not advertise this route to any peer (internal or external). local-asDo not advertise this route to peers outside the local autonomous system. This route will not be advertised to other autonomous systems or sub-autonomous systems when confederations are configured.
Based on the community, you can control which routing information to accept, prefer, or distribute to other neighbors. A BGP speaker can set, append, or modify the community of a route when you learn, advertise, or redistribute routes. When routes are aggregated, the resulting aggregate has a communities attribute that contains all communities from all the initial routes. You can use community lists to create groups of communities to use in a match clause of a route map. Just like an access list, a series of community lists can be created. Statements are checked until a match is found. As soon as one statement is satisfied, the test is concluded. To create a community list, use the following command in global configuration mode:
Command
Router(config)# ip community-list community-list-number {permit | deny} community-number
Purpose
Creates a community list.
To set the communities attribute and match clauses based on communities, see the match community-list and set community route map configuration commands in the "Redistribute Routing Information" section in the "Configuring IP Routing ProtocolIndependent Features" chapter. By default, no communities attribute is sent to a neighbor. To specify that the communities attribute to be sent to the neighbor at an IP address, use the following command in router configuration mode:
Command
Router(config-router)# neighbor {ip-address | peer-group-name} send-community [both |standard |extended]
Purpose
Specifies that the communities attribute be sent to the neighbor at this IP address. Both standard and extended communities can be specified with the both keyword. Only standard or only extended can be specified with the standard and extended keywords.
To remove communities from the community attribute of an inbound or outbound update using a route map to filter and determine the communities to be deleted, use the following command in router configuration mode:
Command
Router(config-router)# set comm-list community-list-number delete
Purpose
Removes communities in a community attribute that match a standard or extended community list.
Command
Router(config)# ip bgp-community new-format
Purpose
Displays and parses BGP communities in the format AA:NN.
Note The conditional BGP announcements are sent in addition to the normal announcements that a BGP router sends to its peers.
Note Autonomous system path list information cannot be used for conditional advertisement because the IP routing table does not contain autonomous system path information.
12 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
Command
Step 1 Router(config)# router bgp as-number
Purpose
Configures the router to run a BGP process. Specifies the peer that should receive conditional advertisement for a given set routes. Configures the advertise-map and non-exist map for the BGP Conditional Advertisement feature.
See the "BGP Conditional Advertisement Configuration Examples" section at the end of this chapter for an example configuration of BGP conditional advertisement.
For address family:IPv4 Unicast BGP table version 18, neighbor version 18 Index 2, Offset 0, Mask 0x4 Inbound soft reconfiguration allowed NEXT_HOP is always this router Community attribute sent to this neighbor Condition-map old-route, Advertise-map new-route, status:Uninitialized 2 accepted prefixes consume 72 bytes Prefix advertised 7, suppressed 0, withdrawn 4
Connections established 1; dropped 0 Last reset 01:05:29, due to Soft reconfig change
The same method of troubleshooting is used for both problems: Verify the existence (or not) of the tracked prefix in the BGP table with the show ip bgp EXEC command. Verify the advertisement (or not) of the other prefix using the show ip bgp neighbor advertised-routes EXEC command.
The user needs to ensure that all of the characteristics specified in the route maps match the routes in the BGP table.
Command
Purpose
13 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
In order to treat the neighbors from other autonomous systems within the confederation as special eBGP peers, use the following command in router configuration mode:
Command
Router(config-router)# bgp confederation peers as-number [as-number]
Purpose
Specifies the autonomous systems that belong to the confederation.
See the "BGP Community with Route Maps Examples" section at the end of this chapter for an example configuration of several peers in a confederation. For an alternative way to reduce the iBGP mesh, see the next section, "Configuring a Route Reflector."
With route reflectors, all iBGP speakers need not be fully meshed because there is a method to pass learned routes to neighbors. In this model, an iBGP peer is configured to be a route reflector responsible for passing iBGP learned routes to a set of iBGP neighbors. In Figure 56, Router B is configured as a route reflector. When the route reflector receives routes advertised from Router A, it advertises them to Router C, and vice versa. This scheme eliminates the need for the iBGP session between Routers A and C. Figure 56 Simple BGP Model with a Route Reflector
The internal peers of the route reflector are divided into two groups: client peers and all the other routers in the autonomous system (nonclient peers). A route reflector reflects routes between these two groups. The route reflector and its client peers form a cluster. The nonclient peers must be fully meshed with each other, but the client peers need not be fully meshed. The clients in the cluster do not communicate with iBGP speakers outside their cluster. Figure 57 More Complex BGP Route Reflector Model
14 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
Figure 57 illustrates a more complex route reflector scheme. Router A is the route reflector in a cluster with routers B, C, and D. Routers E, F, and G are fully meshed, nonclient routers. When the route reflector receives an advertised route, depending on the neighbor, it takes the following actions: A route from an external BGP speaker is advertised to all clients and nonclient peers. A route from a nonclient peer is advertised to all clients. A route from a client is advertised to all clients and nonclient peers. Hence, the clients need not be fully meshed.
To configure a route reflector and its clients, use the following command in router configuration mode:
Command
Router(config-router)# neighbor ip-address | peer-group-name route-reflector-client
Purpose
Configures the local router as a BGP route reflector and the specified neighbor as a client.
Along with route reflector-aware BGP speakers, it is possible to have BGP speakers that do not understand the concept of route reflectors. They can be members of either client or nonclient groups allowing a easy and gradual migration from the old BGP model to the route reflector model. Initially, you could create a single cluster with a route reflector and a few clients. All the other iBGP speakers could be nonclient peers to the route reflector and then more clusters could be created gradually. An autonomous system can have multiple route reflectors. A route reflector treats other route reflectors just like other iBGP speakers. A route reflector can be configured to have other route reflectors in a client group or nonclient group. In a simple configuration, the backbone could be divided into many clusters. Each route reflector would be configured with other route reflectors as nonclient peers (thus, all the route reflectors will be fully meshed). The clients are configured to maintain iBGP sessions with only the route reflector in their cluster. Usually a cluster of clients will have a single route reflector. In that case, the cluster is identified by the router ID of the route reflector. To increase redundancy and avoid a single point of failure, a cluster might have more than one route reflector. In this case, all route reflectors in the cluster must be configured with the 4-byte cluster ID so that a route reflector can recognize updates from route reflectors in the same cluster. All the route reflectors serving a cluster should be fully meshed and all of them should have identical sets of client and nonclient peers. If the cluster has more than one route reflector, configure the cluster ID by using the following command in router configuration mode:
Command
Router(config-router)# bgp cluster-id cluster-id
Purpose
Configures the cluster ID.
Use the show ip bgp EXEC command to display the originator ID and the cluster-list attributes. By default, the clients of a route reflector are not required to be fully meshed and the routes from a client are reflected to other clients. However, if the clients are fully meshed, the route reflector need not reflect routes to clients. To disable client-to-client route reflection, use the no bgp client-to-client reflection command in router configuration mode:
Command
Router(config-router)# no bgp client-to-client reflection
Purpose
Disables client-to-client route reflection.
As the iBGP learned routes are reflected, routing information may loop. The route reflector model has the following mechanisms to avoid routing loops: Originator ID is an optional, nontransitive BGP attribute. It is a 4-byte attributed created by a route reflector. The attribute carries the router ID of the originator of the route in the local autonomous system. Therefore, if a misconfiguration causes routing information to come back to the originator, the information is ignored. Cluster-list is an optional, nontransitive BGP attribute. It is a sequence of cluster IDs that the route has passed. When a route reflector reflects a route from its clients to nonclient peers, and vice versa, it appends the local cluster ID to the cluster-list. If the cluster-list is empty, a new cluster-list is created. Using this attribute, a route reflector can identify if routing information is looped back to the same cluster due to misconfiguration. If the local cluster ID is found in the cluster-list, the advertisement is ignored. Use set clauses in outbound route maps to modify attributes, possibly creating routing loops. To avoid this behavior, set clauses of outbound route maps are ignored for routes reflected to iBGP peers.
15 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
Often, in a BGP speaker, many neighbors are configured with the same update policies (that is, the same outbound route maps, distribute lists, filter lists, update source, and so on). Neighbors with the same update policies can be grouped into peer groups to simplify configuration and, more importantly, to make updating more efficient. When you have many peers, this approach is highly recommended. The three steps to configure a BGP peer group, described in the following sections, are as follows: 1. 2. 3. Creating the Peer Group Assigning Options to the Peer Group Making Neighbors Members of the Peer Group
You can disable a BGP peer or peer group without removing all the configuration information using the neighbor shutdown router configuration command.
Command
Router(config-router)# neighbor peer-group-name peer-group
Purpose
Creates a BGP peer group.
Command
Router(configrouter)# neighbor {ip-address | peer-group-name} remote-as as-number Router(configrouter)# neighbor {ip-address | peer-group-name} description text Router(configrouter)# neighbor {ip-address | peer-group-name} defaultoriginate [route-map map-name] Router(configrouter)# neighbor {ip-address | peer-group-name} send-community Router(configrouter)# neighbor {ip-address | peer-group-name} updatesource interface-type Router(configrouter)# neighbor {ip-address | peer-group-name} ebgp-multihop Router(configrouter)# neighbor {ip-address | peer-group-name} advertisement-interval seconds Router(configrouter)# neighbor {ip-address | peer-group-name} maximumprefix maximum [threshold] [warning-only] Router(configrouter)# neighbor {ip-address | peer-group-name} weight weight Router(configrouter)# neighbor {ip-address | peer-group-name} distribute-list {accesslist-number | accesslist-name} {in | out} Router(configrouter)# neighbor {ip-address | peer-group-name} filter-list access-list-number {in | out | weight weight} Router(configrouter)# neighbor {ip-address | peer-group-name} next-hop-self Router(configrouter)# neighbor {ip-address | peer-group-name} version value Router(configrouter)# neighbor {ip-address | peer-group-name} password string
Purpose
Specifies a BGP neighbor.
Allows a BGP speaker (the local router) to send the default route 0.0.0.0 to a neighbor for use as a default route. Specifies that the communities attribute be sent to the neighbor at this IP address. Allows iBGP sessions to use any operational interface for TCP connections. Allows BGP sessions, even when the neighbor is not on a directly connected segment. The multihop session is not established if the only route to the address of the multihop peer is the default route (0.0.0.0). Sets the minimum interval between sending BGP routing updates. Limits the number of prefixes allowed from a neighbor.
Filters BGP routing updates to and from neighbors, as specified in an access list.
Disables next hop processing on the BGP updates to a neighbor. Specifies the BGP version to use when communicating with a neighbor. Invokes MD5 authentication on a TCP connection to a BGP peer. You can enter a case-sensitive password of up to 25 characters. The string can contain any alphanumeric characters, including spaces. A password cannot be configured in the number-space-anything format. The space after the number
16 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
causes problems. You can also use any combination of the following symbolic characters along with alphanumeric characters: `~ ! @ # $ % ^& * ( ) - _ = + | \ } ] { [ "` : ; / > < . , ?
Caution If the authentication string is configured incorrectly, the BGP peering session will not be established. We recommend that you enter the authentication string carefully and verify that the peering session is established after authentication is configured.
Router(configrouter)# neighbor {ip-address | peer-group-name} route-map map-name {in | out} Router(configrouter)# neighbor {ip-address | peer-group-name} soft-reconfiguration inbound
Configures the software to start storing received updates. This command requires at least one keyword. Currently the only keyword available is inbound, so the use of inbound is not optional.
If a peer group is not configured with a remote-as attribute, the members can be configured with the neighbor remote-as router configuration command. This command allows you to create peer groups containing eBGP neighbors. You can customize inbound policies for peer group members (using, for example, a distribute list, route map, or filter list) because one identical copy of an update is sent to every member of a group. Therefore, neighbor options related to outgoing updates cannot be customized for peer group members. External BGP peers normally must reside on a directly connected network. Sometimes it is useful to relax this restriction in order to test BGP; do so by specifying the neighbor ebgp-multihop router configuration command.
Note To avoid the accidental creation of loops through oscillating routes, the multihop session will not be established if the only route to the address of the multihop peer is the default route (0.0.0.0). Members of a peer group can pass routes from one member of the peer group to another. For example, if router B is peering with routers A and C, router B can pass routes from router A to router C. For iBGP, you might want to allow your BGP connections to stay up regardless of which interface is used to reach a neighbor. To enable this configuration, you first configure a loopback interface and assign it an IP address. Next, configure the BGP update source to be the loopback interface. Finally, configure your neighbor to use the address on the loopback interface. Now the iBGP session will be up as long as there is a route, regardless of any interface. You can set the minimum interval of time between BGP routing updates. Configuring MD5 Authentication for BGP Peering Sessions You can configure MD5 authentication between two BGP peers, meaning that each segment sent on the TCP connection between the peers is verified. MD5 authentication must be configured with the same password on both BGP peers; otherwise, the connection between them will not be made. Configuring MD5 authentication causes the Cisco IOS software to generate and check the MD5 digest of every segment sent on the TCP connection. If authentication is invoked and a segment fails authentication, then an error message will be displayed in the console. When configuring MD5 authentication, you can enter a case-sensitive password of up to 25 characters. The string can contain any alphanumeric characters, including spaces. A password cannot be configured in the number-space-anything format. The space after the number can cause authentication to fail. You can also use any combination of the following symbolic characters along with alphanumeric characters: ` ~ ! @ # $ % ^& * ( ) - _ = + | \ } ] { [ " ` : ; / > < . , ?
Caution If the authentication string is configured incorrectly, the BGP peering session will not be established. We recommend that you enter the authentication string carefully and verify that the peering session is established after authentication is configured. Old Behavior In previous versions of Cisco IOS software, configuring MD5 authentication for a BGP peering session was generally considered to be difficult because the initial configuration and any subsequent MD5 configuration changes required the BGP neighbor to be reset. New Behavior This behavior has been changed in current versions of Cisco IOS software. CSCdx23494 introduced a change to MD5 authentication for BGP peering sessions. The BGP peering session does not need to be reset to maintain or establish the peering session for initial configuration or after the MD5 configuration has been changed. However, the configuration must be completed on both the local and remote BGP peer before the BGP hold timer expires. If the hold down timer expires before the MD5 configuration has been completed on both BGP peers, the BGP session will time out. When the password has been configured, the MD5 key is applied to the TCP session immediately. If one peer is configured before the other, the TCP segments will be discarded on both the local and remote peers due to an authentication failure. The peer that is configured with the password will print an error message in the console similar to the following:
00:03:07: %TCP-6-BADAUTH: No MD5 digest from 10.0.0.2(179) to 10.0.0.1(11000)
The time period in which the password must changed is typically the life time of a stale BGP session. When the password or MD5 key is configured, incoming tcp segments will only be accepted if the key is known. If the key is unknown on both the remote and local peer, the TCP segments will be dropped, and the BGP session will time out when the holddown timer expires. If the BGP session has been preconfigured with a hold time of 0 seconds, no keepalive messages will be sent. The BGP session will stay up until one of the peers, on either side, tries to transmit a message (For example, a prefix update).
Note Configuring a new timer value for the holddown timer will only take effect after the session has been reset. So, it is not possible to change the configuration of the holddown timer to avoid resetting the BGP session. See the "BGP Peer Group Examples" at the end of this chapter for an example of enabling MD5 authentication. BGP through PIX Firewalls When configuring BGP peers with MD5 authentication that pass through a PIX firewall you must also disable the TCP random
17 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
sequence number feature on the PIX firewall because this feature will prevent the BGP peers from successfully negotiating a connection. The BGP neighbor authentication fails because the PIX firewall changes the TCP sequence number for IP packets before it forwards them. When the BGP peer receiving the authentication request runs the MD5 algorithm it will detect that the TCP sequence number has been changed and reject the authentication request. To prevent the TCP sequence number change, use the nonrandomseq keyword in the PIX configuration for the static route configured to allow the BGP connection through the firewall. The non random sequence feature on the PIX firewall prevents the PIX firewall software from changing the sequence number. Here is an example of the static command configuration on the PIX with the nonrandomseq keyword:
static (inside, outside) 10.0.0.0 10.0.0.0 netmask 255.0.0.0 norandomseq
Command
Router(config-router)# neighbor ip-address peer-group peer-group-name
Purpose
Makes a BGP neighbor a member of the peer group.
See the "BGP Peer Group Examples" section at the end of this chapter for examples of iBGP and eBGP peer groups.
Command
Router(config-router)# neighbor {ip-address | peer-group-name} shutdown
Purpose
Shuts down or disables a BGP neighbor or peer group.
To enable a previously existing neighbor or neighbor peer group that had been disabled using the neighbor shutdown router configuration command, use the following command in router configuration mode:
Command
Router(config-router)# no neighbor {ip-address | peer-group-name} shutdown
Purpose
Enables a BGP neighbor or peer group.
Command
Router(config-router)# network ip-address backdoor
Purpose
Indicates reachable networks through backdoor routes.
Command
Router(config-router)# table-map map-name
Purpose
Applies a route map to routes when updating the IP routing table.
Command
Router(config-router)# distance bgp external-distance internal-distance local-distance
Purpose
Assigns a BGP administrative distance.
Changing the administrative distance of BGP routes is considered dangerous and generally is not recommended. The external distance should be lower than any other dynamic routing protocol, and the internal and local distances should be higher than any other dynamic routing protocol.
18 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
Command
Router(config-router)# timers bgp keepalive holdtime
Purpose
Adjusts BGP timers for all neighbors.
To adjust BTP keepalive and hold-time timers for a specific neighbor, use the following command in router configuration mode:
Command
Router(config-router)# neighbor [ip-address | peer-group-name] timers keepalive holdtime
Purpose
Sets the keepalive and hold-time timers (in seconds) for the specified peer or peer group.
Note The timers configured for a specific neighbor or peer group override the timers configured for all BGP neighbors using the timers bgp router configuration command. To clear the timers for a BGP neighbor or peer group, use the no form of the neighbor timers command.
Command
Purpose
Router(config-router)# bgp default local-preference Changes the default local preference value value.
You can use route maps to change the default local preference of specific paths. See the "BGP Route Map Examples" section at the end of this chapter for examples when used with BGP route maps.
Command
Router(config-router)# default-information originate
Purpose
Allows the redistribution of network 0.0.0.0 into BGP.
Command
Router(config-router)# bgp bestpath med missing-as-worst
Purpose
Configures the router to consider a missing MED as having a value of infinity, making the path without a MED value the least desirable path.
Command
Router(config-router)# bgp always-compare-med
Purpose
Allows the comparison of MEDs for paths from neighbors in different autonomous systems.
Configuring the Router to Use the MED to Choose a Path from Subautonomous System Paths
To configure the router to consider the MED value in choosing a path, use the following command in router configuration mode:
Command
Router(config-router)# bgp bestpath med confed
Purpose
Configures the router to consider the MED in choosing a path from among those advertised by different subautonomous systems within a confederation.
The comparison between MEDs is only made if there are no external autonomous systems in the path (an external autonomous system is an autonomous system that is not within the confederation). If there is an external autonomous system in the path, then the external MED is passed transparently through the confederation, and the comparison is not made. The following example compares route A with these paths:
path= 65000 65004, med=2 path= 65001 65004, med=3 path= 65002 65004, med=4 path= 65003 1, med=1
19 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
In this case, path 1 would be chosen if the bgp bestpath med confed router configuration command is enabled. The fourth path has a lower MED, but it is not involved in the MED comparison because there is an external autonomous system is in this path.
Command
Router(config-router)# bgp deterministic med
Purpose
Configures the router to compare the MED variable when choosing among routes advertised by different peers in the same autonomous system.
Note If the bgp always-compare-med router configuration command is enabled, all paths are fully comparable, including those from other autonomous systems in the confederation, even if the bgp deterministic med command is also enabled.
Note No penalty is applied to a BGP peer reset when route dampening is enabled. Although the reset withdraws the route, no penalty is applied in this instance, even if route flap dampening is enabled.
Minimizing Flapping
The route dampening feature minimizes the flapping problem as follows. Suppose again that the route to network A flaps. The router in autonomous system 2 (where route dampening is enabled) assigns network A a penalty of 1000 and moves it to history state. The router in autonomous system 2 continues to advertise the status of the route to neighbors. The penalties are cumulative. When the route flaps so often that the penalty exceeds a configurable suppress limit, the router stops advertising the route to network A, regardless of how many times it flaps. Thus, the route is dampened. The penalty placed on network A is decayed until the reuse limit is reached, upon which the route is once again advertised. At half of the reuse limit, the dampening information for the route to network A is removed.
The routes external to an autonomous system learned via iBGP are not dampened. This policy prevent the iBGP peers from having a higher penalty for routes external to the autonomous system.
Command
Router(config)# bgp dampening
Purpose
Enables BGP route dampening.
To change the default values of various dampening factors, use the following command in address family or router configuration mode:
Command
Router(config)# bgp dampening half-life reuse suppress max-suppress [route-map map-name]
Purpose
Changes the default values of route dampening factors.
20 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
Command
Router# show ip bgp flap-statistics Router# show ip bgp flap-statistics regexp regexp Router# show ip bgp flap-statistics filter-list access-list Router# show ip bgp flap-statistics ip-address mask Router# show ip bgp flap-statistics ip-address mask longer-prefix
Purpose
Displays BGP flap statistics for all paths. Displays BGP flap statistics for all paths that match the regular expression. Displays BGP flap statistics for all paths that pass the filter. Displays BGP flap statistics for a single entry. Displays BGP flap statistics for more specific entries.
To clear BGP flap statistics (thus making it less likely that the route will be dampened), use the following commands in EXEC mode as needed:
Command
Router# clear ip bgp flap-statistics Router# clear ip bgp flap-statistics regexp regexp Router# clear ip bgp flap-statistics filter-list list Router# clear ip bgp flap-statistics ip-address mask Router# clear ip bgp ip-address flap-statistics
Purpose
Clears BGP flap statistics for all routes. Clears BGP flap statistics for all paths that match the regular expression. Clears BGP flap statistics for all paths that pass the filter. Clears BGP flap statistics for a single entry. Clears BGP flap statistics for all paths from a neighbor.
Note The flap statistics for a route are also cleared when a BGP peer is reset. Although the reset withdraws the route, there is no penalty applied in this instance, even if route flap dampening is enabled. Once a route is dampened, you can display BGP route dampening information, including the time remaining before the dampened routes will be unsuppressed. To display the information, use the following command in EXEC mode:
Command
Router# show ip bgp dampened-paths
Purpose
Displays the dampened routes, including the time remaining before they will be unsuppressed.
You can clear BGP route dampening information and unsuppress any suppressed routes by using the following command in EXEC mode:
Command
Router# clear ip bgp dampening [ip-address network-mask]
Purpose
Clears route dampening information and unsuppresses the suppressed routes.
Command
Router# clear ip bgp neighbor-address Router# clear ip bgp * Router# clear ip bgp peer-group tag
Purpose
Resets a particular BGP connection. Resets all BGP connections. Removes all members of a BGP peer group.
Command
Router# show ip bgp prefix
Purpose
Displays peer groups and peers not in peer groups to which the prefix has been advertised. Also displays prefix attributes such as the next hop and the local prefix.
21 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
Displays all BGP routes that contain subnet and supernet network masks. Displays routes that belong to the specified communities. Displays routes that are permitted by the community list. Displays routes that are matched by the specified autonomous system path access list. Displays the routes with inconsistent originating autonomous systems. Displays the routes that have an autonomous system path that matches the specified regular expression entered on the command line. Displays the contents of the BGP routing table. Displays detailed information on the BGP and TCP connections to individual neighbors. Displays routes learned from a particular BGP neighbor. Displays all BGP paths in the database. Displays information about BGP peer groups. Displays the status of all BGP connections.
Router# show ip bgp community communitynumber [exact] Router# show ip bgp community-list community-list-number [exact] Router# show ip bgp filter-list accesslist-number Router# show ip bgp inconsistent-as
Router# show ip bgp Router# show ip bgp neighbors [neighboraddress] Router# show ip bgp neighbors [address] [received-routes | routes | advertisedroutes | paths regexp | dampened-routes] Router# show ip bgp paths Router# show ip bgp peer-group [tag] [summary] Router# show ip bgp summary
Command
Router(config-router)# bgp log-neighbor-changes
Purpose
Logs messages generated when a BGP neighbor goes up or down, or resets
In the following example, the route map named freddy marks all paths originating from autonomous system 690 with an MED metric attribute of 127. The second permit clause is required so that routes not matching autonomous system path list 1 will still be sent to neighbor 1.1.1.1.
router bgp 100 neighbor 1.1.1.1 route-map freddy out ! ip as-path access-list 1 permit ^690_ ip as-path access-list 2 permit .* ! route-map freddy permit 10
22 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
match as-path 1 set metric 127 ! route-map freddy permit 20 match as-path 2
The following example shows how you can use route maps to modify redistributed information from the IP forwarding table:
router bgp 100 redistribute igrp 109 route-map igrp2bgp ! route-map igrp2bgp match ip address 1 set local-preference 25 set metric 127 set weight 30000 set next-hop 192.92.68.24 set origin igp ! access-list 1 permit 131.108.0.0 0.0.255.255 access-list 1 permit 160.89.0.0 0.0.255.255 access-list 1 permit 198.112.0.0 0.0.127.255
It is proper behavior to not accept any autonomous system path not matching the match clause of the route map. This behavior means that you will not set the metric and the Cisco IOS software will not accept the route. However, you can configure the software to accept autonomous system paths not matched in the match clause of the route-map router configuration command by using multiple maps of the same name, some without accompanying set commands.
route-map fnord permit 10 match as-path 1 set local-preference 5 ! route-map fnord permit 20 match as-path 2
The following example shows how you can use route maps in a reverse operation to set the route tag (as defined by the BGP/OSPF interaction document, RFC 1403) when exporting routes from BGP into the main IP routing table:
router bgp 100 table-map set_ospf_tag ! route-map set_ospf_tag match as-path 1 set automatic-tag ! ip as-path access-list 1 permit .*
The following example shows how the route map named set-as-path is applied to outbound updates to the neighbor 200.69.232.70. The route map will prepend the autonomous system path "100 100" to routes that pass access list 1. The second part of the route map is to permit the advertisement of other routes.
router bgp 100 network 171.60.0.0 network 172.60.0.0 neighbor 200.69.232.70 remote-as 200 neighbor 200.69.232.70 route-map set-as-path out ! route-map set-as-path 10 permit match address 1 set as-path prepend 100 100 ! route-map set-as-path 20 permit match address 2 ! access-list 1 permit 171.60.0.0 0.0.255.255 access-list 1 permit 172.60.0.0 0.0.255.255 ! access-list 2 permit 0.0.0.0 255.255.255.255
Inbound route maps could perform prefix-based matching and set various parameters of the update. Inbound prefix matching is available in addition to autonomous system path and community list matching. The following example shows how the set localpreference route-map configuration command sets the local preference of the inbound prefix 140.10.0.0/16 to 120:
! router bgp 100 network 131.108.0.0 neighbor 131.108.1.1 remote-as 200 neighbor 131.108.1.1 route-map set-local-pref in ! route-map set-local-pref permit 10 match ip address 2 set local preference 120 ! route-map set-local-pref permit 20 ! access-list 2 permit 140.10.0.0 0.0.255.255 access-list 2 deny any
23 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
The following examples show how to ensure that traffic from one router on a shared LAN will always be passed through a second router, rather than being sent directly to a third router on the same LAN. Routers A, B, and C connect to the same LAN. Router A peers with router B, and router B peers with router C. Router B sends traffic over the routes of router A to router C, but wants to make sure that all traffic from router C to router A goes through router B, rather than directly from router C to router A over the shared LAN. This configuration can be useful for traffic accounting purposes or to satisfy the peering agreement between router C and router B. You can achieve this configuration by using the set ip next-hop route-map configuration command as shown in the following two examples. Example one applies an inbound route map on the BGP session of router C with router B. Router A Configuration
router bgp 100 neighbor 1.1.1.2 remote-as 200
Router B Configuration
router bgp 200 neighbor 1.1.1.1 remote-as 100 neighbor 1.1.1.3 remote-as 300
Router C Configuration
router bgp 300 neighbor 1.1.1.2 remote-as 200 neighbor 1.1.1.2 route-map set-peer-address in
The following example applies an outbound route map on the BGP session of router B with router C: Router A Configuration
router bgp 100 neighbor 1.1.1.2 remote-as 200
Router B Configuration
router bgp 200 neighbor 1.1.1.1 remote-as 100 neighbor 1.1.1.3 remote-as 300 neighbor 1.1.1.3 route-map set-peer-address out
Router C Configuration
router bgp 300 neighbor 1.1.1.2 remote-as 200
In Figure 58, Router A is being configured. The iBGP neighbor is not directly linked to Router A. External neighbors (in autonomous system 167 and autonomous system 99) must be linked directly to Router A. Figure 58 Assigning Internal and External BGP Neighbors
24 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
The following example shows how a prefix list permits a route that matches the prefix 35.0.0.0/8:
ip prefix-list abc permit 35.0.0.0/8
The following example shows how to configure the BGP process so that it only accept prefixes with a prefix length of /8 to /24:
router bgp version 2 network 101.20.20.0 distribute-list prefix max24 in ! ip prefix-list max24 seq 5 permit 0.0.0.0/0 ge 8 le 24
The following example configuration shows how to conditionally originate a default route (0.0.0.0/0) in RIP when a prefix 10.1.1.0/24 exists in the routing table:
ip prefix-list cond permit 10.1.1.0/24 ! route-map default-condition permit 10 match ip address prefix-list cond ! router rip default-information originate route-map default-condition
The following example shows how to configure BGP to accept routing updates from 192.1.1.1 only, besides filtering on the prefix length:
router bgp distribute-list prefix max24 gateway allowlist in ! ip prefix-list allowlist seq 5 permit 192.1.1.1/32 !
The following example shows how to direct the BGP process to filter incoming updates to the prefix using name1, and match the gateway (next hop) of the prefix being updated to the prefix list name2, on the Ethernet interface 0:
router bgp 103 distribute-list prefix name1 gateway name2 in ethernet 0.
The following example shows how to configure BGP to deny routes with a prefix length greater than in 25 in 192/8:
ip prefix-list abc deny 192.0.0.0/8 ge 25
The following example shows how to configure BGP to permit routes with a prefix length greater than 8 and less than 24 in all address space:
ip prefix-list abc permit 0.0.0.0/0 ge 8 le 24
The following example shows how to configure BGP to deny routes with a prefix length greater than 25 in all address space:
ip prefix-list abc deny 0.0.0.0/0 ge 25
The following example shows how to configure BGP to deny all routes in 10/8, because any route in the Class A network 10.0.0.0/8 is denied if its mask is less than or equal to 32 bits:
ip prefix-list abc deny 10.0.0.0/8 le 32
The following example shows how to configure BGP to deny routes with a mask greater than 25 in 204.70.1/24:
ip prefix-list abc deny 204.70.1.0/24 ge 25
The following example shows how to configure BGP to permit all routes:
ip prefix-list abc permit 0.0.0.0/0 le 32
The following example shows how to delete an entry from the prefix list so that 204.70.0.0 is not permitted, and add a new entry that permits 198.0.0.0/8:
no ip prefix-list abc permit 204.70.0.0/15 ip prefix-list abc permit 198.0.0.0/8
25 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
The following example clears the session with the neighbor 131.108.1.1.
clear ip bgp 131.108.1.1 soft in
The following configuration shows how to create an aggregate entry in the BGP routing table when at least one specific route falls into the specified range. The aggregate route will be advertised as coming from your autonomous system and has the atomic aggregate attribute set to show that information might be missing. (By default, atomic aggregate is set unless you use the as-set keyword in the aggregate-address router configuration command.)
router bgp 100 aggregate-address 193.0.0.0 255.0.0.0
The following example shows how to create an aggregate entry using the same rules as in the previous example, but the path
26 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
advertised for this route will be an AS_SET consisting of all elements contained in all paths that are being summarized:
router bgp 100 aggregate-address 193.0.0.0 255.0.0.0 as-set
The following example shows how to create the aggregate route for 193.0.0.0 and also suppress advertisements of more specific routes to all neighbors:
router bgp 100 aggregate-address 193.0.0.0 255.0.0.0 summary-only
The second example shows how the route map named set-community is applied to the outbound updates to neighbor 171.69.232.90. All the routes that originate from autonomous system 70 have the community values 200 200 added to their already existing values. All other routes are advertised as normal.
route-map bgp 200 neighbor 171.69.232.90 remote-as 100 neighbor 171.69.232.90 send-community neighbor 171.69.232.90 route-map set-community out ! route-map set-community 10 permit match as-path 1 set community 200 200 additive ! route-map set-community 20 permit ! ip as-path access-list 1 permit 70$ ip as-path access-list 2 permit .*
The third example shows how community-based matching is used to selectively set MED and local preference for routes from neighbor 171.69.232.55. All the routes that match community list 1 get the MED set to 8000, including any routes that have the communities 100 200 300 or 900 901. These routes could have other community values also. All the routes that pass community list 2 get the local preference set to 500. This includes the routes that have community values 88 or 90. If they belong to any other community, they will not be matched by community list 2. All the routes that match community list 3 get the local preference set to 50. Community list 3 will match all the routes because all the routes are members of the Internet community. Thus, all the remaining routes from neighbor 171.69.232.55 get a local preference 50.
router bgp 200 neighbor 171.69.232.55 remote-as 100 neighbor 171.69.232.55 route-map filter-on-community in ! route-map filter-on-community 10 permit match community 1 set metric 8000 ! route-map filter-on-community 20 permit match community 2 exact-match set local-preference 500 ! route-map filter-on-community 30 permit match community 3 set local-preference 50 ! ip community-list 1 permit 100 200 300 ip community-list 1 permit 900 901 ! ip community-list 2 permit 88 ip community-list 2 permit 90 ! ip community-list 3 permit internet
The next two examples show how BGP community attributes are used with BGP confederation configurations to filter routes. The next example shows how the route map named set-community is applied to the outbound updates to neighbor 171.69.232.50 and the local-as community attribute is used to filter the routes. The routes that pass access list 1 have the special community attribute value local-as. The remaining routes are advertised normally. This special community value automatically prevents the advertisement of those routes by the BGP speakers outside autonomous system 200.
router bgp 65000 network 1.0.0.0 route-map set-community bgp confederation identifier 200
27 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
bgp confederation peers 65001 neighbor 171.69.232.50 remote-as 100 neighbor 171.69.233.2 remote-as 65001 ! route-map set-community permit 10 match ip address 1 set community local-as !
The following example shows how to use the local-as community attribute to filter the routes. Confederation 100 contains three autonomous systems: 100, 200, and 300. For network 1.0.0.0, the route map named set-local-as specifies that the advertised routes have the community attribute local-as. These routes are not advertised to any eBGP peer outside the local autonomous system. For network 2.0.0.0, the route map named set-no-export specifies that the routes advertised have the community attribute no-export. A route between router 6500 and router 65001 does not cross the boundary between autonomous systems within the confederation. A route between subautonomous systems for which router 65000 is the controlling router does not cross the boundary between the confederation and an external autonomous system, and also does not cross the boundary between subautonomous systems within the local autonomous system. A route to from router 65000 to router 65001 would not be acceptable for network 1.0.0.0 because it crosses the boundary between subautonomous systems within the confederation.
router bgp 65001 bgp confederation identifier 200 bgp confederation peer 65000 network 2.0.0.0 route-map set-community neighbor 171.69.233.1 remote-as 65000 route-map set-community permit 10 set community no-export
In a BGP speaker in autonomous system 6002, the peers from autonomous systems 6001 and 6003 are configured as special eBGP peers. 170.70.70.1 is a normal iBGP peer and 199.99.99.2 is a normal eBGP peer from autonomous system 700.
router bgp 6002 bgp confederation identifier 60000 bgp confederation peers 6001 6003 neighbor 170.70.70.1 remote-as 6002 neighbor 171.69.232.57 remote-as 6001 neighbor 171.69.232.56 remote-as 6003 neighbor 199.99.99.2 remote-as 700
In a BGP speaker in autonomous system 6003, the peers from autonomous systems 6001 and 6002 are configured as special eBGP peers. 200.200.200.200 is a normal eBGP peer from autonomous system 701.
router bgp 6003 bgp confederation identifier 60000 bgp confederation peers 6001 6002 neighbor 171.69.232.57 remote-as 6001 neighbor 171.69.232.55 remote-as 6002 neighbor 200.200.200.200 remote-as 701
The following is a part of the configuration from the BGP speaker 200.200.200.205 from autonomous system 701 in the same
28 of 29
10/01/2013 17:33
Cisco IOS IP Configuration Guide, Release 12.2 - Configuring BGP [Cisc... http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfbgp...
example. Neighbor 171.69.232.56 is configured as a normal eBGP speaker from autonomous system 60000. The internal division of the autonomous system into multiple autonomous systems is not known to the peers external to the confederation.
router bgp 701 neighbor 171.69.232.56 remote-as 60000 neighbor 200.200.200.205 remote-as 701
For examples of how the BGP set-community route-map configuration command can be used with a confederation configuration, see the last two examples in the section"BGP Community with Route Maps Examples" in this chapter.
29 of 29
10/01/2013 17:33