The documentation set for this product strives to use bias-free language. For the purposes of this documentation set, bias-free is defined as language that does not imply discrimination based on age, disability, gender, racial identity, ethnic identity, sexual orientation, socioeconomic status, and intersectionality. Exceptions may be present in the documentation due to language that is hardcoded in the user interfaces of the product software, language used based on RFP documentation, or language that is used by a referenced third-party product. Learn more about how Cisco is using Inclusive Language.
The BGP hold time must always be configured higher than the Graceful Restart hold time on a device, even with Graceful Restart
disabled. A peer device with an unsupported hold time can establish a session with a device through an open message, but once
Graceful Restart is enabled the session will flap.
Information About BGP
The Border Gateway Protocol (BGP) is an exterior gateway protocol used to set up an interdomain routing system that guarantees
the loop-free exchange of routing information between autonomous systems. Autonomous systems are made up of routers that operate
under the same administration and that run Interior Gateway Protocols (IGPs), such as RIP or OSPF, within their boundaries
and that interconnect by using an Exterior Gateway Protocol (EGP). BGP Version 4 is the standard EGP for interdomain routing
in the Internet. The protocol is defined in RFCs 1163, 1267, and 1771.
BGP Network Topology
Routers that belong to the same autonomous system
(AS) and that exchange BGP updates run internal BGP (IBGP), and routers that
belong to different autonomous systems and that exchange BGP updates run
external BGP (EBGP). Most configuration commands are the same for configuring
EBGP and IBGP. The difference is that the routing updates are exchanged either
between autonomous systems (EBGP) or within an AS (IBGP). The figure given
below shows a network that is running both EBGP and IBGP.
Before exchanging information
with an external AS, BGP ensures that networks within the AS can be reached by
defining internal BGP peering among routers within the AS and by redistributing
BGP routing information to IGPs that run within the AS, such as IGRP and OSPF.
Routers that run a BGP
routing process are often referred to as BGP speakers. BGP uses the
Transmission Control Protocol (TCP) as its transport protocol (specifically
port 179). Two BGP speakers that have a TCP connection to each other for
exchanging routing information are known as peers or neighbors. In the above
figure, Routers A and B are BGP peers, as are Routers B and C and Routers C and
D. The routing information is a series of AS numbers that describe the full
path to the destination network. BGP uses this information to construct a
loop-free map of autonomous systems.
The network has these
characteristics:
Routers A and B are running
EBGP, and Routers B and C are running IBGP. Note that the EBGP peers are
directly connected and that the IBGP peers are not. As long as there is an IGP
running that allows the two neighbors to reach one another, IBGP peers do not
have to be directly connected.
All BGP speakers within an AS
must establish a peer relationship with each other. That is, the BGP speakers
within an AS must be fully meshed logically. BGP4 provides two techniques that
reduce the requirement for a logical full mesh: confederations and route
reflectors.
AS 200 is a transit AS for AS
100 and AS 300—that is, AS 200 is used to transfer packets between AS 100 and
AS 300.
BGP peers initially exchange
their full BGP routing tables and then send only incremental updates. BGP peers
also exchange keepalive messages (to ensure that the connection is up) and
notification messages (in response to errors or special conditions).
In BGP, each route consists of
a network number, a list of autonomous systems that information has passed
through (the autonomous system path), and a list of other path attributes. The
primary function of a BGP system is to exchange network reachability
information, including information about the list of AS paths, with other BGP
systems. This information can be used to determine AS connectivity, to prune
routing loops, and to enforce AS-level policy decisions.
A router or
Device
running Cisco IOS does not select or use an IBGP route unless it has a route
available to the next-hop router and it has received synchronization from an
IGP (unless IGP synchronization is disabled). When multiple routes are
available, BGP bases its path selection on attribute values. See the
“Configuring BGP Decision Attributes” section for information about BGP
attributes.
BGP Version 4 supports classless interdomain routing
(CIDR) so you can reduce the size of your routing tables by creating aggregate
routes, resulting in supernets. CIDR eliminates the concept of network classes
within BGP and supports the advertising of IP prefixes.
Nonstop Forwarding Awareness
The BGP NSF Awareness feature is supported for IPv4 in the
. To enable this feature with BGP routing, you need to enable Graceful Restart. When the neighboring router is NSF-capable,
and this feature is enabled, the Layer 3 Device continues to forward packets from the neighboring router during the interval between the primary Route Processor (RP) in
a router failing and the backup RP taking over, or while the primary RP is manually reloaded for a nondisruptive software
upgrade.
Information About BGP Routing
To enable BGP routing, you establish a BGP routing process and define the local network. Because BGP must completely recognize
the relationships with its neighbors, you must also specify a BGP neighbor.
BGP supports two kinds of neighbors: internal and external. Internal neighbors are in the same AS; external neighbors are
in different autonomous systems. External neighbors are usually adjacent to each other and share a subnet, but internal neighbors
can be anywhere in the same AS.
The switch supports the use of private AS numbers, usually assigned by service providers and given to systems whose routes
are not advertised to external neighbors. The private AS numbers are from 64512 to 65535. You can configure external neighbors
to remove private AS numbers from the AS path by using the neighbor remove-private-as router configuration command. Then when an update is passed to an external neighbor, if the AS path includes private AS numbers,
these numbers are dropped.
If your AS will be passing traffic through it from another AS to a third AS, it is important to be consistent about the routes
it advertises. If BGP advertised a route before all routers in the network had learned about the route through the IGP, the
AS might receive traffic that some routers could not yet route. To prevent this from happening, BGP must wait until the IGP
has propagated information across the AS so that BGP is synchronized with the IGP. Synchronization is enabled by default.
If your AS does not pass traffic from one AS to another AS, or if all routers in your autonomous systems are running BGP,
you can disable synchronization, which allows your network to carry fewer routes in the IGP and allows BGP to converge more
quickly.
Routing Policy Changes
Routing policies for a peer
include all the configurations that might affect inbound or outbound routing
table updates. When you have defined two routers as BGP neighbors, they form a
BGP connection and exchange routing information. If you later change a BGP
filter, weight, distance, version, or timer, or make a similar configuration
change, you must reset the BGP sessions so that the configuration changes take
effect.
There are two types of reset, hard
reset and soft reset. Cisco IOS Releases 12.1 and later support a soft reset
without any prior configuration. To use a 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. A
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.
When soft reset generates
inbound updates from a neighbor, it is called dynamic inbound soft reset.
When soft reset sends a set
of updates to a neighbor, it is called outbound soft reset.
A soft inbound reset causes
the new inbound policy to take effect. A soft outbound reset causes the new
local outbound policy to take effect without resetting the BGP session. As a
new set of updates is sent during outbound policy reset, a new inbound policy
can also take effect.
The table given below lists
the advantages and disadvantages hard reset and soft reset.
Table 1. Advantages and Disadvantages
of Hard and Soft Resets
Type of Reset
Advantages
Disadvantages
Hard reset
No memory overhead
The prefixes in the BGP, IP,
and FIB tables provided by the neighbor are lost. Not recommended.
Outbound soft reset
No configuration, no storing
of routing table updates
Does not reset inbound
routing table updates.
Dynamic inbound soft reset
Does not clear the BGP
session and cache
Does not require storing of
routing table updates and has no memory overhead
Both BGP routers must support
the route refresh capability (in Cisco IOS Release 12.1 and later).
BGP Decision Attributes
When a BGP speaker receives
updates from multiple autonomous systems that describe different paths to the
same destination, it must choose the single best path for reaching that
destination. When chosen, the selected path is entered into the BGP routing
table and propagated to its neighbors. The decision is based on the value of
attributes that the update contains and other BGP-configurable factors.
When a BGP peer learns two EBGP paths for a
prefix from a neighboring AS, it chooses the best path and inserts that path in
the IP routing table. If BGP multipath support is enabled and the EBGP paths
are learned from the same neighboring autonomous systems, instead of a single
best path, multiple paths are installed in the IP routing table. Then, during
packet switching, per-packet or per-destination load-balancing is performed
among the multiple paths. The
maximum-paths router configuration command
controls the number of paths allowed.
These factors summarize the
order in which BGP evaluates the attributes for choosing the best path:
If the path specifies a
next hop that is inaccessible, drop the update. The BGP next-hop attribute,
automatically determined by the software, is the IP address of the next hop
that is going to be used to reach a destination. For EBGP, this is usually the
IP address of the neighbor specified by the
neighbor
remote-as router configuration command. You can disable next-hop
processing by using route maps or the
neighbor
next-hop-self router configuration command.
Prefer the path with the largest
weight (a Cisco proprietary parameter). The weight attribute is local to the
router and not propagated in routing updates. By default, the weight attribute
is 32768 for paths that the router originates and zero for other paths. Routes
with the largest weight are preferred. You can use access lists, route maps, or
the
neighbor
weight router configuration command to set weights.
Prefer the route with the
highest local preference. Local preference is part of the routing update and
exchanged among routers in the same AS. The default value of the local
preference attribute is 100. You can set local preference by using the
bgp default local-preference router configuration
command or by using a route map.
Prefer the route that was
originated by BGP running on the local router.
Prefer the route with the
shortest AS path.
Prefer the route with the
lowest origin type. An interior route or IGP is lower than a route learned by
EGP, and an EGP-learned route is lower than one of unknown origin or learned in
another way.
Prefer the route with the lowest multi -exit discriminator (MED)
metric attribute if the neighboring AS is the same for all routes considered.
You can configure the MED by using route maps or by using the
default-metric router configuration command. When
an update is sent to an IBGP peer, the MED is included.
Prefer the external (EBGP)
path over the internal (IBGP) path.
Prefer the route that can be
reached through the closest IGP neighbor (the lowest IGP metric). This means
that the router will prefer the shortest internal path within the AS to reach
the destination (the shortest path to the BGP next-hop).
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.
Maximum-paths is enabled.
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 implementation-specific.
Route Maps
Within BGP, route maps can be used to control and to modify routing information and to define the conditions by which routes
are redistributed between routing domains. Each route map has a name that identifies the route map (map tag) and an optional sequence number.
BGP Filtering
You can filter BGP advertisements by using AS-path filters, such
as the
as-path access-list global configuration command
and the
neighbor filter-list router configuration command.
You can also use access lists with the
neighbor distribute-list router configuration
command. Distribute-list filters are applied to network numbers. See the
“Controlling Advertising and Processing in Routing Updates” section for
information about the
distribute-list command.
You can use route maps on a
per-neighbor basis to filter updates and to modify various attributes. A route
map can be applied to either inbound or outbound updates. Only the routes that
pass the route map are sent or accepted in updates. On both inbound and
outbound updates, matching is supported based on AS path, community, and
network numbers. Autonomous system path matching requires the
match as-path access-list route-map command,
community based matching requires the
match community-list route-map command, and
network-based matching requires the
ip access-list global configuration command.
Prefix List for BGP Filtering
You can use prefix lists as an alternative to access lists in many BGP route filtering commands, including the neighbor distribute-list router configuration command. The advantages of using prefix lists include performance improvements in loading and lookup
of large lists, incremental update support, easier CLI configuration, and greater flexibility.
Filtering by a prefix list involves matching the prefixes of routes with those listed in the prefix list, as when matching
access lists. When there is a match, the route is used. Whether a prefix is permitted or denied is based upon these rules:
An empty prefix list permits all prefixes.
An implicit deny is assumed if a given prefix does not match any entries in a prefix list.
When multiple entries of a prefix list match a given prefix, the sequence number of a prefix list entry identifies the entry
with the lowest sequence number.
By default, sequence numbers are generated automatically and incremented in units of five. If you disable the automatic generation
of sequence numbers, you must specify the sequence number for each entry. You can specify sequence values in any increment.
If you specify increments of one, you cannot insert additional entries into the list; if you choose very large increments,
you might run out of values.
BGP Community Filtering
One way that BGP controls the distribution of routing information based on the value of the COMMUNITIES attribute. The attribute
is a way to groups destinations into communities and to apply routing decisions based on the communities. This method simplifies
configuration of a BGP speaker to control distribution of routing information.
A community is a group of destinations that share some common attribute. Each destination can belong to multiple communities.
AS administrators can define to which communities a destination belongs. By default, all destinations belong to the general
Internet community. The community is identified by the COMMUNITIES attribute, an optional, transitive, global attribute in
the numerical range from 1 to 4294967200. These are some predefined, well-known communities:
internet—Advertise this route to the Internet community. All routers belong to it.
no-export—Do not advertise this route to EBGP peers.
no-advertise—Do not advertise this route to any peer (internal or external).
local-as—Do not advertise this route to peers outside the local autonomous system.
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 learning, advertising, or redistributing 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. As with 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.
BGP Neighbors and Peer Groups
Often many BGP 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 to make updating more efficient. When you have configured many peers, we recommend this approach.
To configure a BGP peer group, you create the peer group, assign options to the peer group, and add neighbors as peer group
members. You configure the peer group by using the neighbor router configuration commands. By default, peer group members inherit all the configuration options of the peer group, including
the remote-as (if configured), version, update-source, out-route-map, out-filter-list, out-dist-list, minimum-advertisement-interval,
and next-hop-self. All peer group members also inherit changes made to the peer group. Members can also be configured to override
the options that do not affect outbound updates.
Aggregate Routes
Classless interdomain routing (CIDR) enables you to create aggregate routes (or supernets) to minimize the size of routing
tables. You can configure aggregate routes in BGP either by redistributing an aggregate route into BGP or by creating an aggregate
entry in the BGP routing table. An aggregate address is added to the BGP table when there is at least one more specific entry
in the BGP table.
Routing Domain Confederations
One way to reduce the IBGP mesh is to divide an autonomous system into multiple subautonomous systems and to group them into
a single confederation that appears as a single autonomous system. Each autonomous system is fully meshed within itself and
has a few connections to other autonomous systems in the same confederation. Even though the peers in different autonomous
systems have EBGP sessions, they exchange routing information as if they were IBGP peers. Specifically, the next hop, MED,
and local preference information is preserved. You can then use a single IGP for all of the autonomous systems.
BGP Route Reflectors
BGP requires that all of the IBGP speakers be fully meshed. When a router receives a route from an external neighbor, it must
advertise it to all internal neighbors. To prevent a routing information loop, all IBPG speakers must be connected. The internal
neighbors do not send routes learned from internal neighbors to other internal neighbors.
With route reflectors, all IBGP speakers need not be fully meshed because another method is used to pass learned routes to
neighbors. When you configure an internal BGP peer to be a route reflector, it is responsible for passing IBGP learned routes
to a set of IBGP neighbors. The internal peers of the route reflector are divided into two groups: client peers and nonclient
peers (all the other routers in the autonomous system). 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.
When the route reflector receives an advertised route, it takes one of these actions, depending on the neighbor:
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.
Usually a cluster of clients have a single route reflector, and the cluster is identified by the route reflector router ID.
To increase redundancy and to 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 same 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 should have identical sets of client and nonclient peers.
Route Dampening
Route flap dampening is a BGP feature designed to minimize the propagation of flapping routes across an internetwork. A route
is considered to be flapping when it is repeatedly available, then unavailable, then available, then unavailable, and so on.
When route dampening is enabled, a numeric penalty value is assigned to a route when it flaps. When a route’s accumulated
penalties reach a configurable limit, BGP suppresses advertisements of the route, even if the route is running. The reuse
limit is a configurable value that is compared with the penalty. If the penalty is less than the reuse limit, a suppressed
route that is up is advertised again.
Dampening is not applied to routes that are learned by IBGP. This policy prevents the IBGP peers from having a higher penalty
for routes external to the AS.
More BGP Information
For detailed descriptions of
BGP configuration, see the “Configuring BGP” chapter in the “IP Routing
Protocols” part of the
Cisco IOS IP Configuration
Guide, Release 12.4. For details about specific commands, see the
Cisco IOS IP Command
Reference, Volume 2 of 3: Routing Protocols, Release 12.4.
How to Configure BGP
Default BGP Configuration
The table given below shows the basic default BGP configuration.
Table 2. Default BGP
Configuration
Feature
Default Setting
Aggregate address
Disabled: None defined.
AS path access list
None defined.
Auto summary
Disabled.
Best path
The router considers
as-path in choosing a route and does not compare
similar routes from external BGP peers.
Compare router ID: Disabled.
BGP community list
Number: None defined. When
you permit a value for the community number, the list defaults to an implicit
deny for everything else that has not been permitted.
Format: Cisco default format
(32-bit number).
BGP confederation
identifier/peers
Identifier: None configured.
Peers: None identified.
BGP Fast external fallover
Enabled.
BGP local preference
100. The range is 0 to
4294967295 with the higher value preferred.
BGP network
None specified; no backdoor
route advertised.
BGP route dampening
Disabled by default. When
enabled:
Half-life is 15 minutes.
Re-use is 750 (10-second
increments).
Suppress is 2000 (10-second
increments).
Max-suppress-time is 4 times
half-life; 60 minutes.
BGP router ID
The IP address of a loopback
interface if one is configured or the highest IP address configured for a
physical interface on the router.
Default information originate
(protocol or network redistribution)
Disabled.
Default metric
Built-in, automatic metric
translations.
Distance
External route administrative
distance: 20 (acceptable values are from 1 to 255).
Internal route administrative
distance: 200 (acceptable values are from 1 to 255).
Local route administrative
distance: 200 (acceptable values are from 1 to 255).
Distribute list
In (filter networks received
in updates): Disabled.
Out (suppress networks from
being advertised in updates): Disabled.
Internal route redistribution
Disabled.
IP prefix list
None defined.
Multi exit discriminator
(MED)
Always compare: Disabled.
Does not compare MEDs for paths from neighbors in different autonomous systems.
Best path compare: Disabled.
MED missing as worst path:
Disabled.
Deterministic MED comparison
is disabled.
Neighbor
Advertisement interval: 30
seconds for external peers; 5 seconds for internal peers.
Change logging: Enabled.
Conditional advertisement:
Disabled.
Default originate: No default
route is sent to the neighbor.
Description: None.
Distribute list: None
defined.
External BGP multihop: Only
directly connected neighbors are allowed.
Filter list: None used.
Maximum number of prefixes
received: No limit.
Next hop (router as next hop
for BGP neighbor): Disabled.
Password: Disabled.
Peer group: None defined;
no members assigned.
Prefix list: None
specified.
Remote AS (add entry to
neighbor BGP table): No peers defined.
Private AS number removal:
Disabled.
Route maps: None applied to
a peer.
Send community attributes:
None sent to neighbors.
Disabled2. If enabled, allows Layer 3 switches to continue forwarding packets from a neighboring NSF-capable router during hardware
or software changes.
Route reflector
None configured.
Synchronization (BGP and
IGP)
Disabled.
Table map update
Disabled.
Timers
Keepalive: 60 seconds;
holdtime: 180 seconds.
1 Nonstop Forwarding
2 NSF Awareness can be enabled for IPv4 on switches with the license by enabling Graceful Restart.
Enabling BGP Routing
Before you begin
Note
To enable BGP, the switch or active switch must be running the
Procedure
Command or Action
Purpose
Step 1
configureterminal
Example:
Device# configure terminal
Enters the global
configuration mode.
Step 2
ip
routing
Example:
Device(config)# ip routing
Enables IP
routing.
Step 3
router bgpautonomous-system
Example:
Device(config)# router bgp 45000
Enables a BGP
routing process, assign it an AS number, and enter router configuration mode.
The AS number can be from 1 to 65535, with 64512 to 65535 designated as private
autonomous numbers.
(Optional)
Removes private AS numbers from the AS-path in outbound routing updates.
Step 7
synchronization
Example:
Device(config-router)# synchronization
(Optional)
Enables synchronization between BGP and an IGP.
Step 8
auto-summary
Example:
Device(config-router)# auto-summary
(Optional)
Enables automatic network summarization. When a subnet is redistributed from an
IGP into BGP, only the network route is inserted into the BGP table.
Step 9
bgp
graceful-restart
Example:
Device(config-router)# bgp graceful-start
(Optional)
Enables NSF awareness on switch. By default, NSF awareness is disabled.
Step 10
end
Example:
Device(config-router)#end
Returns to privileged EXEC mode.
Step 11
show ip bgp
networknetwork-number
Example:
Device# show ip bgp network 10.108.0.0
Verifies the
configuration.
Step 12
show ip bgp
neighbor
Example:
Device# show ip bgp neighbor
Verifies that
NSF awareness (Graceful Restart) is enabled on the neighbor.
If NSF
awareness is enabled on the switch and the neighbor, this message appears:
Graceful
Restart Capability: advertised and received
If NSF
awareness is enabled on the switch, but not on the neighbor, this message
appears:
Graceful
Restart Capability: advertised
Step 13
copy running-config
startup-config
Example:
Device# copy running-config startup-config
(Optional) Saves your entries
in the configuration file.
Managing Routing Policy Changes
To learn if a BGP peer
supports the route refresh capability and to reset the BGP session:
Procedure
Command or Action
Purpose
Step 1
show ip bgp
neighbors
Example:
Device# show ip bgp neighbors
Displays whether
a neighbor supports the route refresh capability. When supported, this message
appears for the router:
Received route refresh capability from peer.
Step 2
clear ip bgp {* |
address |
peer-group-name}
Example:
Device# clear ip bgp *
Resets the
routing table on the specified connection.
Enter an asterisk
(*) to specify that all connections be reset.
Enter an IP
address to specify the connection to be reset.
Enter a peer
group name to reset the peer group.
Step 3
clear ip bgp {* |
address |
peer-group-name}
soft out
Example:
Device# clear ip bgp * soft out
(Optional)
Performs an outbound soft reset to reset the inbound routing table on the
specified connection. Use this command if route refresh is supported.
Enter an asterisk
(*) to specify that all connections be reset.
Enter an IP
address to specify the connection to be reset.
Enter a peer
group name to reset the peer group.
Step 4
show ip
bgp
Example:
Device# show ip bgp
Verifies the
reset by checking information about the routing table and about BGP neighbors.
Step 5
show ip bgp
neighbors
Example:
Device# show ip bgp neighbors
Verifies the
reset by checking information about the routing table and about BGP neighbors.
Configuring BGP Decision Attributes
Before you begin
On the Cisco Catalyst 9400 Series Switches, the hardware-supported maximum-path is 8.
Procedure
Command or Action
Purpose
Step 1
configureterminal
Example:
Device# configure terminal
Enters the global
configuration mode.
Step 2
router bgpautonomous-system
Example:
Device(config)# router bgp 4500
Enables a BGP
routing process, assign it an AS number, and enter router configuration mode.
(Optional) Assign
a weight to a neighbor connection. Acceptable values are from 0 to 65535; the
largest weight is the preferred route. Routes learned through another BGP peer
have a default weight of 0; routes sourced by the local router have a default
weight of 32768.
Step 6
default-metricnumber
Example:
Device(config-router)# default-metric 300
(Optional) Sets a
MED metric to set preferred paths to external neighbors. All routes without a
MED will also be set to this value. The range is 1 to 4294967295. The lowest
value is the most desirable.
Step 7
bgp bestpath med
missing-as-worst
Example:
Device(config-router)# bgp bestpath med missing-as-worst
(Optional)
Configures the switch to consider a missing MED as having a value of infinity,
making the path without a MED value the least desirable path.
Step 8
bgp
always-compare med
Example:
Device(config-router)# bgp always-compare-med
(Optional)
Configures the switch to compare MEDs for paths from neighbors in different
autonomous systems. By default, MED comparison is only done among paths in the
same AS.
Step 9
bgp bestpath med
confed
Example:
Device(config-router)# bgp bestpath med confed
(Optional)
Configures the switch to consider the MED in choosing a path from among those
advertised by different subautonomous systems within a confederation.
Step 10
bgp deterministic
med
Example:
Device(config-router)# bgp deterministic med
(Optional)
Configures the switch to consider the MED variable when choosing among routes
advertised by different peers in the same AS.
(Optional) Change
the default local preference value. The range is 0 to 4294967295; the default
value is 100. The highest local preference value is preferred.
Step 12
maximum-pathsnumber
Example:
Device(config-router)# maximum-paths 8
(Optional) Configures the number of paths to be added to the IP routing table. The default is to only enter the best path
in the routing table. The range is from 1 to 16. Having multiple paths allows load-balancing among the paths.
Note
Although the switch software allows a maximum of 32 equal-cost routes, the switch hardware will never use more than 16 paths
per route.)
Note
Although the switch software allows a maximum of 32 equal-cost routes, the actual number of paths per route is dependent on
the switch hardware.
Step 13
end
Example:
Device(config)# end
Returns to
privileged EXEC mode.
Step 14
show ip
bgp
Example:
Device# show ip bgp
Verifies the
reset by checking information about the routing table and about BGP neighbors.
Step 15
show ip bgp
neighbors
Example:
Device# show ip bgp neighbors
Verifies the
reset by checking information about the routing table and about BGP neighbors.
Step 16
copy running-config
startup-config
Example:
Device# copy running-config startup-config
(Optional) Saves your entries
in the configuration file.
Device(config-router)# neighbor 172.16.4.1 distribute-list 39 in
(Optional)
Filters BGP routing updates to or from neighbors as specified in an access
list.
Note
You can also use
the
neighbor prefix-list router configuration command
to filter updates, but you cannot use both commands to configure the same BGP
peer.
Device(config-router)# neighbor 172.16.70.24 route-map internal-map in
(Optional)
Applies a route map to filter an incoming or outgoing route.
Step 5
end
Example:
Device(config)# end
Returns to
privileged EXEC mode.
Step 6
show ip bgp
neighbors
Example:
Device# show ip bgp neighbors
Verifies the
configuration.
Step 7
copy running-config
startup-config
Example:
Device# copy running-config startup-config
(Optional) Saves your entries
in the configuration file.
Configuring BGP Filtering by Access Lists and Neighbors
Another method of filtering is to specify an access list filter on both incoming and outbound updates, based on the BGP autonomous
system paths. Each filter is an access list based on regular expressions. To use this method, define an autonomous system
path access list, and apply it to updates to and from particular neighbors.
Procedure
Command or Action
Purpose
Step 1
configureterminal
Example:
Device# configure terminal
Enters the global
configuration mode.
Step 2
ip as-path access-listaccess-list-number
{permit |
deny}
as-regular-expressions
Example:
Device(config)# ip as-path access-list 1 deny _65535_
Device(config-router)# neighbor 172.16.1.1 filter-list 1 out
Establishes a BGP
filter based on an access list.
Step 5
end
Example:
Device(config)# end
Returns to
privileged EXEC mode.
Step 6
show ip bgp neighbors [pathsregular-expression]
Example:
Device# show ip bgp neighbors
Verifies the
configuration.
Step 7
copy running-config
startup-config
Example:
Device# copy running-config startup-config
(Optional) Saves your entries
in the configuration file.
Configuring Prefix Lists for BGP Filtering
You do not need to specify a
sequence number when removing a configuration entry.
Show commands include the sequence numbers in
their output.
Before using a prefix list in
a command, you must set up the prefix list.
Procedure
Command or Action
Purpose
Step 1
configureterminal
Example:
Device# configure terminal
Enters the global
configuration mode.
Step 2
ip prefix-listlist-name [seqseq-value]
deny |
permitnetwork/len [gege-value] [lele-value]
Example:
Device(config)# ip prefix-list BLUE permit 172.16.1.0/24
Creates a prefix
list with an optional sequence number to
deny or
permit access for matching conditions. You must
enter at least one
permit or
deny clause.
network/len is the network number and length (in
bits) of the network mask.
(Optional)
ge and
le values specify the range of the prefix length
to be matched.The specified
ge-value and
le-value
must satisfy this condition:
len <
ge-value <
le-value
< 32
Step 3
ip prefix-listlist-nameseqseq-valuedeny |
permitnetwork/len [gege-value] [lele-value]
Example:
Device(config)# ip prefix-list BLUE seq 10 permit 172.24.1.0/24
(Optional) Adds
an entry to a prefix list, and assign a sequence number to the entry.
Step 4
end
Example:
Device(config)# end
Returns to
privileged EXEC mode.
Step 5
show ip prefix list [detail |
summary]
name [network/len] [seqseq-num] [longer] [first-match]
Example:
Device# show ip prefix list summary test
Verifies the
configuration by displaying information about a prefix list or prefix list
entries.
Step 6
copy running-config
startup-config
Example:
Device# copy running-config startup-config
(Optional) Saves your entries
in the configuration file.
Configuring BGP Community Filtering
By default, no COMMUNITIES
attribute is sent to a neighbor. You can specify that the COMMUNITIES attribute
be sent to the neighbor at an IP address by using the
neighbor send-community router configuration
command.
SUMMARY STEPS
configureterminal
ip community-listcommunity-list-number
{permit |
deny}
community-number
Specifies that
the COMMUNITIES attribute be sent to the neighbor at this IP address.
Step 5
set
comm-listlist-numdelete
Example:
Device(config-router)# set comm-list 500 delete
(Optional)
Removes communities from the community attribute of an inbound or outbound
update that match a standard or extended community list specified by a route
map.
Step 6
exit
Example:
Device(config-router)# end
Returns to global
configuration mode.
Step 7
ip bgp-community
new-format
Example:
Device(config)# ip bgp-community new format
(Optional)
Displays and parses BGP communities in the format AA:NN.
A BGP community
is displayed in a two-part format 2 bytes long. The Cisco default community
format is in the format NNAA. In the most recent RFC for BGP, a community takes
the form AA:NN, where the first part is the AS number and the second part is a
2-byte number.
Step 8
end
Example:
Device(config)# end
Returns to
privileged EXEC mode.
Step 9
show ip bgp
community
Example:
Device# show ip bgp community
Verifies the
configuration.
Step 10
copy running-config
startup-config
Example:
Device# copy running-config startup-config
(Optional) Saves your entries
in the configuration file.
Configuring BGP Neighbors and Peer Groups
To assign configuration
options to an individual neighbor, specify any of these router configuration
commands by using the neighbor IP address. To assign the options to a peer
group, specify any of the commands by using the peer group name. You can
disable a BGP peer or peer group without removing all the configuration
information by using the
neighbor shutdown router configuration command.
Specifies a BGP
neighbor. If a peer group is not configured with a
remote-asnumber, use
this command to create peer groups containing EBGP neighbors. The range is 1 to
65535.
(Optional) 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 multihop
peer’s address is the default route (0.0.0.0).
(Optional)
Controls how many prefixes can be received from a neighbor. The range is 1 to
4294967295. The
threshold (optional) is the percentage of maximum
at which a warning message is generated. The default is 75 percent.
(Optional) Sets
MD5 authentication on a TCP connection to a BGP peer. The same password must be
configured on both BGP peers, or the connection between them is not made.
(Optional) Sets
timers for the neighbor or peer group.
The
keepalive
interval is the time within which keepalive messages are sent to peers. The
range is 1 to 4294967295 seconds; the default is 60.
The
holdtime
is the interval after which a peer is declared
inactive after not receiving a keepalive message from it. The range is 1 to
4294967295 seconds; the default is 180.
Creates an
aggregate entry in the BGP routing table. The aggregate route is advertised as
coming from the AS, and the atomic aggregate attribute is set to indicate that
information might be missing.
(Optional)
Generates AS set path information. This command creates an aggregate entry
following the same rules as the previous command, but the advertised path will
be an AS_SET consisting of all elements contained in all paths. Do not use this
keyword when aggregating many paths because this route must be continually
withdrawn and updated.
Configures the
local router as a BGP route reflector and the specified neighbor as a client.
Step 4
bgp
cluster-idcluster-id
Example:
Device(config-router)# bgp cluster-id 10.0.1.2
(Optional)
Configures the cluster ID if the cluster has more than one route reflector.
Step 5
no bgp
client-to-client reflection
Example:
Device(config-router)# no bgp client-to-client reflection
(Optional)
Disables client-to-client route reflection. By default, the routes from a route
reflector client are reflected to other clients. However, if the clients are
fully meshed, the route reflector does not need to reflect routes to clients.
Step 6
end
Example:
Device(config)# end
Returns to
privileged EXEC mode.
Step 7
show ip
bgp
Example:
Device# show ip bgp
Verifies the
configuration. Displays the originator ID and the cluster-list attributes.
Step 8
copy running-config
startup-config
Example:
Device# copy running-config startup-config
(Optional) Saves your entries
in the configuration file.
(Optional) Clears
BGP flap statistics to make it less likely that a route will be dampened.
Step 9
clear ip bgp
dampening
Example:
Device# clear ip bgp dampening
(Optional) Clears
route dampening information, and unsuppress the suppressed routes.
Step 10
copy running-config
startup-config
Example:
Device# copy running-config startup-config
(Optional) Saves your entries
in the configuration file.
Monitoring and Maintaining BGP
You can remove all contents
of a particular cache, table, or database. This might be necessary when the
contents of the particular structure have become or are suspected to be
invalid.
You can display specific
statistics, such as the contents of BGP routing tables, caches, and databases.
You can use the information to get resource utilization and solve network
problems. You can also display information about node reachability and discover
the routing path your device’s packets are taking through the network.
The table given below lists the privileged EXEC commands for clearing and displaying BGP.
Table 3. IP BGP Clear and Show
Commands
clear ip
bgpaddress
Resets a particular BGP
connection.
clear ip bgp
*
Resets all BGP connections.
clear ip bgp
peer-grouptag
Removes all members of a BGP
peer group.
show ip bgpprefix
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.
show ip bgp
cidr-only
Displays all BGP routes that
contain subnet and supernet network masks.
show ip bgp community
[community-number] [exact]
Displays routes that belong
to the specified communities.
show ip bgp
community-listcommunity-list-number
[exact-match]
Displays routes that are
permitted by the community list.
show ip bgp
filter-listaccess-list-number
Displays routes that are
matched by the specified AS path access list.
show ip bgp
inconsistent-as
Displays the routes with
inconsistent originating autonomous systems.
show ip bgp
regexpregular-expression
Displays the routes that have
an AS path that matches the specified regular expression entered on the command
line.
show ip
bgp
Displays the contents of the
BGP routing table.
show ip bgp neighbors
[address]
Displays detailed information
on the BGP and TCP connections to individual neighbors.
show ip bgp neighbors
[address] [advertised-routes |
dampened-routes |
flap-statistics |
pathsregular-expression |
received-routes |
routes]
Displays routes learned from
a particular BGP neighbor.
show ip bgp
paths
Displays all BGP paths in the
database.
show ip bgp peer-group
[tag] [summary]
Displays information about
BGP peer groups.
show ip bgp
summary
Displays the status of all
BGP connections.
The
bgp log-neighbor changes command is enabled by
default. It allows to log messages that are generated when a BGP neighbor
resets, comes up, or goes down.