Previous Topic

Next Topic

Book Contents

BGP Commands

router bgp

This command enables BGP and identifies the autonomous system (AS) number of the router. Only a single instance of BGP can be run and the router can only belong to a single AS.

no router bgp

If you invoke no router bgp, BGP is disabled and all BGP configuration reverts to default values. Alternatively, you can use "no enable (BGP)" on page 680 in Router BGP Configuration mode to disable BGP globally without clearing the BGP configuration.

aggregate-address

To configure a summary address for BGP, use the aggregate-address command in Router Configuration mode. No aggregate addresses are configured by default. Unless the options are specified, the aggregate is advertised with the ATOMIC_AGGREGATE attribute and an empty AS path, and the more specific routes are advertised along with the aggregate.

To be considered a match for an aggregate address, a prefix must be more specific (i.e. have a longer prefix length) than the aggregate address. A prefix whose prefix length equals the length of the aggregate address is not considered a match.

When BGP originates a summary address, it installs a reject route in the common routing table for the summary prefix. Any received packets that match the summary prefix, but not a more specific route, match the reject route and are dropped. BGP accepts up to 128 summary addresses.

no aggregate-address

Use this command to delete a summary address for BGP. The address mask is a summary prefix and mask.

bgp aggregate-different-meds

Use the bgp aggregate-different meds command in Router BGP Configuration mode to allow the aggregation of routes with different MED attributes. By default, BGP only aggregates routes that have the same MED value, as prescribed by RFC 4271.

When this command is given, the path for an active aggregate address is advertised without a MED attribute. When this command is not given, if multiple routes match an aggregate address, but have different MEDs, the aggregate takes the MED of the first matching route. Any other matching prefix with the same MED is included in the aggregate. Matching prefixes with different MEDs are not considered to be part of the aggregate and continue to be advertised as individual routes.

no bgp aggregate-different-meds

Use the no bgp aggregate-different meds command in Router BGP Configuration mode to return the command to the default.

bgp default local-preference

Use this command to specify the default local preference. Local preference is an attribute sent to internal peers to indicate the degree of preference for a route. A route with a numerically higher local preference value is preferred.

BGP assigns the default local preference to each path received from an external peer. (BGP retains the LOCAL_PREF on paths received from internal peers.) BGP also assigns the default local preference to locally- originated paths. If you change the default local preference, the local preference on paths previously received is not changed; it is only applied to paths received after the change. To apply the new local preference to paths previously received, use the command "clear ip bgp" on page 692 to force a soft inbound reset.

no bgp default local-preference.

This command sets the default value of local preference of the BGP router.

bgp fast-external-failover

Use this command to configure BGP to immediately reset the adjacency with an external peer if the routing interface to the peer goes down. When BGP gets a routing interface down event, BGP drops the adjacency with all external peers whose IPv4 address is in one of the subnets on the failed interface. This behavior can be overridden for specific interfaces using the command "ip bgp fast-external-failover.

no bgp fast-external-failover

Use this command to disable BGP fast-external-failover.

bgp fast-internal-failover

Use this command to configure BGP to immediately reset the adjacency with an internal peer when there is a loss of reachability to an internal peer. BGP tracks the reachability of each internal peer’s IP address. If a peer becomes unreachable (that is, the RIB no longer has a non-default route to the peer’s IP address), then BGP drops the adjacency.

no bgp fast-internal-failover

Use this command to return the "bgp fast-internal-failover" command to the default.

bgp log-neighbor-changes

Use this command to enable logging of adjacency state changes. Both backward and forward adjacency state changes are logged. Forward state changes, except for transitions to the Established state, are logged at the Informational severity level. Backward state changes and forward changes to Established are logged at the Notice severity level.

no bgp log-neighbor-changes

Use this command to return the "bgp log-neighbor-changes" command to the default.

bgp router-id

Use this command to set the BGP router ID. There is no default BGP router ID. The system does not select a router ID automatically. You must configure one manually. The BGP router ID must be a valid IPv4 unicast address, but is not required to be an address assigned to the router. The router ID is specified in the dotted notation of an IP address. Setting the router ID to 0.0.0.0 disables BGP. Changing the router ID disables and re-enables BGP, causing all adjacencies to be re-established.

no bgp router-id

Use this command to reset the BGP router ID, disabling BGP.

default-information originate (BGP)

Use this command to allow BGP to originate a default route. By default, BGP does not originate a default route. If a default route is redistributed into BGP, BGP does not advertise the default route unless the default-information originate command has been given. The always option is disabled by default.

no default-information originate

Use this command to disable BGP from originating a default route.

default metric (BGP)

Use this command to set the value of the Multi Exit Discriminator (MED) attribute on routes redistributed into BGP when no metric has been specified in the command "redistribute (BGP)" on page 691.

no default metric (BGP)

Use this command to delete the default for the metric of redistributed routes.

distance (BGP)

Use this command to set the preference (also known as administrative distance) of BGP routes to specific destinations. You may enter up to 128 instances of this command. Two instances of this command may not have the same prefix and wildcard mask. If a distance command is configured that matches an existing distance command’s prefix and wildcard mask, the new command replaces the existing command. There can be overlap between the prefix and mask configured for different commands. When there is overlap, the command whose prefix and wildcard mask are the longest match for a neighbor’s address is applied to routes from that neighbor.

An ECMP route’s distance is determined by applying distance commands to the neighbor that provided the best path. The distance command is not applied to existing routes. To apply configuration changes to the distance command itself or the prefix list to which a distance command applies, you must force a hard reset of affected neighbors.

no distance (BGP)

Use this command to set the preference of BGP routes to the default.

distance BGP

Use this command to set the preference, (also known as administrative distance), of BGP routes. Different distance values can be configured for routes learned from external peers, routes learned from internal peers, and BGP routes locally originated. A route with a lower preference value is preferred to a route with a higher preference value to the same destination. Routes with a preference of 255 may not be selected as best routes and used for forwarding.

The change to the default BGP distances does not affect existing routes. To apply a distance change to existing routes, you must force the routes to be deleted from the RIB and relearned, either by resetting the peers from which the routes are learned or by disabling and re-enabling BGP.

no distance BGP

Use this command to set the default route preference value of BGP routes in the router.

distribute-list in

Use this command to configure a filter that restricts the routes that BGP accepts from all neighbors based on destination prefix. The distribute list is applied to all routes received from all neighbors. Only routes permitted by the prefix list are accepted. If the command refers to a prefix list that does not exist, the command is accepted and all routes are permitted.

no distribute-list in

Use this command to disable a filter that restricts the routes that BGP accepts from all neighbors based on destination prefix.

distribute-list out (BGP)

Use this command to configure a filter that restricts the advertisement of routes based on destination prefix. Only one instance of this command may be defined for each route source (RIP, OSPF, static, connected). One instance of this command may also be configured as a global filter for outbound prefixes. If the command refers to a prefix list that does not exist, the command is accepted and all routes are permitted.

When a distribute list is added, changed, or deleted for route redistribution, BGP automatically reconsiders all best routes.

no distribute-list out (BGP)

Use this command to reset the distribute-list out (BGP) command to the default.

enable (BGP)

This command globally enables BGP, while retaining the configuration. BGP is enabled by default once you specify the local AS number with the "router bgp" command and configure a router ID with the "bgp router-id" command. When you disable BGP, BGP retains its configuration. If you invoke the "no router bgp" command, all BGP configuration is reset to the default values.

When BGP is administratively disabled, BGP sends a Notification message to each peer with a Cease error code.

no enable (BGP)

This command globally disables the administrative mode of BGP on the system, while retaining the configuration.

ip bgp fast-external-failover

This command configures fast external failover behavior for a specific routing interface. This command overrides for a specific routing interface the fast external failover behavior configured globally. If permit is specified, the feature is enabled on the interface, regardless of the global configuration. If deny is specified, the feature is disabled on the interface, regardless of the global configuration.

no ip bgp fast-external-failover

This command unconfigures the feature on the interface, and the interface uses the global setting.

maximum-paths (BGP)

Use this command to specify the maximum number of next hops BGP may include in an Equal Cost Multipath (ECMP) route derived from paths received from neighbors outside the local autonomous system. Paths are considered for ECMP when their attributes are the same (local preference, AS path, origin, MED, and distance) and the paths are received from different routers. When BGP uses multiple paths in an ECMP route, BGP still selects one path as the best path and advertises only that path to its peers.

no maximum-paths (BGP)

This command resets back to the default the number of next hops BGP may include in an ECMP route.

maximum-paths igbp

Use this command to specify the maximum number of next hops BGP may include in an Equal Cost Multipath (ECMP) route derived from paths received from neighbors within the local autonomous system. Paths are considered for ECMP when their attributes are the same (local preference, AS path, origin, MED, and IGP distance) and the paths are advertised from different routers. When BGP uses multiple paths in an ECMP route, BGP still selects one path as the best path and advertises only that path to its peers.

no maximum-paths igbp

Use this command to reset back to the default the number of next hops BGP may include in an ECMP route derived from paths received from neighbors within the local autonomous system.

neighbor advertisement-interval

Use this command to configure the minimum time that must elapse between advertisements of the same route to a given neighbor. RFC 4271 recommends the interval for internal peers be shorter than the interval for external peers to enable fast convergence within an autonomous system. This value does not limit the rate of route selection, only the rate of route advertisement. If BGP changes the route to a destination multiple times while waiting for the advertisement interval to expire, only the final result is advertised to the neighbor. BGP enforces the advertisement interval by limiting how often phase 3 of the decision process can run for each update group. The interval applies to withdrawals as well as active advertisements.

no neighbor advertisement-interval

Use this command to return to the default the minimum time that must elapse between advertisements of the same route to a given neighbor.

neighbor connect-retry-interval

This command configures the initial connection retry time for a specific neighbor. If a neighbor does not respond to an initial TCP connection attempt, the software retries three times. The first retry is after the retry interval configured with neighbor connect-retry-interval. Each subsequent retry doubles the previous retry interval. So by default, the TCP connection is retried after 2, 4, and 8 seconds. If none of the retries is successful, the adjacency is reset to the IDLE state and the IDLE hold timer is started. BGP skips the retries and transitions to IDLE state if TCP returns an error, such a destination unreachable, on a connection attempt.

no neighbor connect-retry-interval

This command resets to the default the initial connection retry time for a specific neighbor.

neighbor default-originate

To configure BGP to originate a default route to a specific neighbor, use the neighbor default-originate command in BGP router configuration mode. A neighbor-specific default has no MED and the Origin is IGP. A neighbor-specific default is only advertised if the Adj-RIB-Out does not include a default learned by other means, either from the "default-information originate (BGP)" command or a default learned from a peer. This type of default origination is not conditioned on the presence of a default route in the routing table. This form of default origination does not install a default route in the BGP routing table (it will not appear in the "show ip bgp"command), nor does it install a default route in the Adj-RIB-Out for the update group of peers so configured (it will not appear in the "show ip bgp neighbors advertised-routes" command).

Origination of the default route is not subject to a prefix filter configured with the command "distribute-list out (BGP)".

no neighbor default-originate

Use this command to prevent BGP from originating a default route to a specific neighbor.

neighbor description

Use this command to record a text description of a neighbor. The description is informational and has no functional impact.

no neighbor description

Use this command to delete the text description of a neighbor.

neighbor filter-list

This command filters advertisements to or from a specific neighbor according to the advertisement’s AS Path. Only a single AS path list can be configured in each direction for each neighbor. If you invoke the command a second time for a given neighbor, the new AS path list number replaces the previous AS path list number. If you assign a neighbor filter list to a non-existent AS path access list, all routes are filtered.

no neighbor filter-list

Use this command to unconfigure neighbor filter lists.

neighbor maximum-prefix

This command configures the maximum number of prefixes that BGP will accept from a specified neighbor. If the peering session is shut down, the adjacency stays down until the "clear ip bgp" command is issued for the neighbor.

no neighbor maximum-prefix

This command reverts to the default value for the maximum the number of prefixes that BGP will accept from a specified neighbor.

neighbor next-hop-self

This command configures BGP to set the next hop attribute to a local IP address when advertising a route to an internal peer. Normally, BGP would retain the next hop attribute received from the external peer. When the next hop attribute in routes from external peers is retained, internal peers must have a route to the external peer’s IP address. This is commonly done by configuring the IGP on the border router to advertise the external (or DMZ) subnet. The next-hop-self option eliminates the need to advertise the external subnet in the IGP.

no neighbor next-hop-self

This command disables the peer as the next hop for the locally originated paths. After executing this command, the BGP peer must be reset before the changes take effect.

neighbor password

This command enables MD5 authentication of TCP segments sent to and received from a neighbor, and configures an authentication key. MD5 must either be enabled or disabled on both peers. The same password must be configured on both peers. After a TCP connection is established, if the password on one end is changed, then the password on the other end must be changed to match before the hold time expires. With default hold times, both passwords must be changed within 120 seconds to guarantee the connection is not dropped

no neighbor password

This command disables MD5 authentication of TCP segments sent to and received from a neighbor.

neighbor prefix-list

This command filters advertisements sent to a specific neighbor based on the destination prefix of each route. Only one prefix list may be defined for each neighbor in each direction. If you assign a prefix list that does not exist, all prefixes are permitted.

no neighbor prefix-list

This command disables filtering advertisements sent to a specific neighbor based on the destination prefix of each route.

neighbor remote-as

This command configures a neighbor and identifies the neighbor’s autonomous system. Up to 100 neighbors may be configured.

no neighbor remote-as

This command un-configures neighbors.

neighbor shutdown

This command brings down an the adjacency with a specific neighbor. If the adjacency is up when the command is given, the peering session is dropped and all route information learned from the neighbor is purged.

When a neighbor is shut down, BGP first sends a NOTIFICATION message with a Cease error code. When an adjacency is administratively shut down, the adjacency stays down until administratively re-enabled (using the command "no neighbor shutdown" below).

no neighbor shutdown

This command administratively enables a BGP peer.

neighbor timers

This command overrides the global timer values and sets the keepalive and hold timers for a specific neighbor. The new values are not applied to adjacencies already in the ESTABLISHED state. A new keepalive or hold time is applied the next time an adjacency is formed.

no neighbor timers

This command reverts the keep alive and hold time for a peer to their defaults. After executing this command, the BGP peer must be reset before the changes will take effect.

neighbor update-source

This command configures BGP to use a specific IP address as the source address for the TCP connection with a neighbor. This IP address must be the IP address configured on the peer as its neighbor address for this router. The IP address used as the source address in IP packets sent to a neighbor must be the same address used to configure the local system as a neighbor of the neighbor router. In other words, if the update source is configured, it must be the same IP address used in the neighbor remote-as command on the peer. It is common to use an IP address on a loopback interface because a loopback interface is always reachable, as long as any routing interface is up. The peering session can stay up as long as the loopback interface remains reachable. If you use an IP address on a routing interface, then the peering session will go down if that routing interface goes down.

no neighbor update-source

This command configures BGP to use the primary IPv4 address on the outgoing interface to the neighbor for the TCP connection.

network (BGP)

This command configures BGP to advertise an address prefix.The prefix is only advertised if the common routing table includes a non-BGP route with the same prefix. The route may be a connected route, a static route, or a dynamic route from another routing protocol. BGP accepts up to 64 networks. The network command may specify a default route (network 0.0.0.0 mask 0.0.0.0).

no network (BGP)

This command disables BGP from advertising an address prefix.

redistribute (BGP)

This command configures BGP to advertise routes learned by means outside of BGP. BGP can redistribute local (connected), static, OSPF, and RIP routes. The distribute-list out command can also be used to filter redistributed routes by prefix. Either a redistribute route map or a distribute list may be configured, but not both. A default route cannot be redistributed unless the "default-information originate (BGP)" command is given.

no redistribute (BGP)

This command removes the configuration for the redistribution for BGP protocol from the specified source protocol/routers. The command no redistribute opsf match external 1 will withdraw only OSPF external type 1 routes, ospf inter routes will still be redistributing.

timers bgp

This command configures the keepalive and hold times that BGP uses for all of its neighbors.

When BGP establishes an adjacency, the neighbors agree to use the minimum hold time configured on either neighbor. BGP sends KEEPALIVE messages at either 1/3 of the negotiated hold time or the configured keepalive interval, whichever is more frequent. The new values are not applied to adjacencies already in the ESTABLISHED state. A new keepalive or hold time is applied the next time an adjacency is formed.

no timers bgp

This command sets to the default the keepalive and hold times that BGP uses for all of its neighbors.

clear ip bgp

This command resets peering sessions with all or a subnet of BGP peers. The command arguments specify which peering sessions are reset and the type of reset performed. Soft inbound reset causes BGP to send a Route Refresh request to each neighbor being reset. If a neighbor does not support the Route Refresh capability, then updated policy is applied to routes previously received from the neighbor. When a change is made to an outbound policy, BGP schedules an outbound soft reset to update neighbors according to the new policy.

clear ip bgp counters

This command resets all BGP counters to 0. These counters include send and receive packet and prefix counters for all neighbors.

show ip bgp

To view routes in the BGP routing table, use the show ip bgp command in Privileged EXEC mode. The output lists both best and non-best paths to each destination.

show ip bgp aggregate-address

This command lists aggregate addresses that have been configured and indicates whether each is currently active.

show ip bgp neighbors

This command shows details about BGP neighbor configuration and status.

The command output displays the following information.

If the router receives an UPDATE message with an invalid path attribute, the router will in most cases send a NOTIFICATION message and reset the adjacency. BGP maintains a per-neighbor counter for each type of path attribute error. This show command lists each non-zero counter, just after the LastSubError. The counters that may be listed are as follows:

show ip bgp neighbors advertised-routes

This command displays the list of routes advertised to a specific neighbor. These are the routes in the adjacent RIB out for the neighbor’s outbound update group.

The command output displays the following information.

NOTE: This output differs slightly from the output in show ip bgp. Suppressed routes and non-best routes are not advertised, so these status codes are not relevant here. Advertised routes always have a single next hop, the BGP NEXT HOP advertised to the peer. Local preference is never sent to external peers.

The output indicates whether BGP is configured to originate a default route to this peer (neighbor default-originate).

show ip bgp neighbors received-routes

This command displays the list of routes received from a specific neighbor. The list includes both accepted and rejected routes.

The command output displays the following information.

show ip bgp statistics

This command displays recent decision process history. Phase 1 of the decision process reacts to UPDATE messages received from peers, determining what new routes are accepted and deleting withdrawn routes from the Adj-RIB-In. Phase 2 determines the best path for each destination, updates the BGP route table, and updates the common RIB. Phase 3 is run independently for each outbound update group and determines which routes should be advertised to neighbors in each group. Each entry in the table shows statistics for one phase of the decision process. The table shows the 20 most recent decision process runs, with the most recent information at the end of the table.

The command displays the following information.

show ip bgp summary

This command displays a summary of BGP configuration and status.

The command displays the following information.

show ip bgp update-group

This command reports the status of outbound update groups and their members.

The command displays the following information.

The update send history table show statistics on as many as the ten most recent executions of the update send process for the update group. Items in the history table are as follows:

debug ip bgp

To enable debug tracing of BGP events, use the debug ip bgp command in privileged EXEC mode. Debug messages are sent to the system log at the DEBUG severity level. To print them on the console, enable console logging at the DEBUG level (logging console debug command) - see "logging console" on page 192. The debug options enabled for a specific peer are the union of the options enabled globally and the options enabled specifically for the peer.

Enabling one of the packet type options enables packet tracing in both the inbound and outbound directions.

snapshot bgp

Use the snapshot bgp command in Support mode to dump a set of BGP debug information to capture the current state of BGP.

See also

Border Gateway Protocol Commands