Basic Configuration
Two tasks are common to every BGP configuration: You must enable the BGP routing process, and you must configure BGP neighbors. All other basic configuration tasks are optional.
You can configure certain BGP attributes globally, for peer groups, or for individual peers. The most specific level of configuration takes precedence. For example, if you configure an attribute both globally and for a peer group, the peer group configuration takes precedence for that peer group, but does not affect other peer groups. If you configure an attribute both for a peer group and for a peer, the peer configuration takes precedence for that peer, but does not affect other members of that peer group.
Enabling BGP Routing
All BGP configurations require that you enable the BGP routing process on one or more routers.
router bgp
- Use to enable the BGP routing protocol and to specify the local AS—the AS to which this BGP speaker belongs.
- All subsequent BGP configuration commands are placed within the context of this router and AS; you can have only a single BGP instance per virtual router.
- Specify only one BGP AS per virtual router.
- This command takes effect immediately.
- Examplehost1(config)#router bgp 100
- Use the no version to remove the BGP process.
- See router bgp.
Understanding BGP Command Scope
BGP commands can be sorted into the following categories, each of which has a different scope; that is, each configures parameters within a different area of applicability. Individual command descriptions in this chapter and in Configuring BGP-MPLS Applications, provide more information about command behavior.
- The commands listed in Table 5 configure
parameters for the BGP process globally, regardless of address family.
Table 5: Commands Affecting BGP Globally
bgp advertise-inactive
bgp graceful-restart path-selection-defer-time
bgp advertise best-external-to-internal
bgp graceful-restart restart-time
bgp always-compare-med
bgp graceful-restart stalepaths-time
bgp bestpath med confed
bgp log-neighbor-changes
bgp bestpath missing-as-worst
bgp maxas-limit
bgp client-to-client reflection
bgp redistribute-internal
bgp cluster-id
bgp router-id
bgp confederation identifier
bgp shutdown
bgp confederation peers
ip bgp-community new-format
bgp default local-preference
overload shutdown
bgp default route-target filter
rib-out disable
bgp enforce-first-as
router bgp
bgp fast-external-fallover
timers bgp
bgp graceful-restart
- The commands listed in Table 6 configure
parameters for all address families within the current VRF context.
Table 6: Commands Affecting All Address Families in a VRF
distance bgp
synchronization
- The commands listed in Table 7 configure
parameters only for the current address family context.
Table 7: Commands Affecting the Current Address Family
address family
disable-dynamic-redistribute
aggregate-address
external-paths
auto-summary
ip route-type
bgp dampening
maximum-paths
bgp wait-on-end-of-rib
network
check-vpn-next-hops
redistribute
default-information originate
table-map
- The commands listed in Table 8 configure
parameters for a peer or peer group, regardless of address family.
If the peer or peer group is activated in more than one address family,
the values are changed in all those address families. These commands
are said to apply on a per-VRF basis. In the following example, EBGP
multihop is configured for the session, but when you configure an
address family, it is not available—that is, EBGP multihop is
not configurable per address family:host1(config-router)#neighbor 10.1.3.4 remote-as 1234 host1(config-router)#neighbor 10.2.3.4 ebgp-multihop 5 host1(config-router)#address-family ipv4 multicast host1(config-router-af)#neighbor 10.2.3.4 ebgp-multihop ?% Invalid input detected at '^' marker.host1(config-router-af)#exit-address-family
Table 8: Commands Affecting All Address Families for the Specified Peer or Peer Group
neighbor advertisement-interval
neighbor maximum-update-size
neighbor allow
neighbor passive
neighbor bfd-liveness-detection
neighbor password
neighbor capability
neighbor peer-type
neighbor description
neighbor remote-as
neighbor ebgp-multihop
neighbor rib-out disable
neighbor graceful-restart
neighbor shutdown
neighbor graceful-restart restart-time
neighbor site-of-origin
neighbor graceful-restart stalepaths-time
neighbor timers
neighbor ibgp-singlehop
neighbor update-source
neighbor lenient
neighbor weight
- The commands listed in Table 9 configure
parameters separately for each address family exchanged over the BGP
session. If you configure these parameters for a peer or peer group
that is activated in more than one address family, the values are
affected only for the current address family. The inbound route map
is such a parameter; the following example demonstrates that a BGP
session can have a different inbound route map for each address family.host1(config-router)#neighbor 1.1.3.4 remote-as 1234 host1(config-router)#neighbor 1.2.3.4 route-map ucast-map in host1(config-router)#address-family ipv4 multicast host1(config-router-af)#neighbor 1.2.3.4 activate host1(config-router-af)#neighbor 1.2.3.4 route-map mcast-map in host1(config-router-af)#exit-address-family
Table 9: Commands Affecting Only the Current Address Family for the Specified Peer or Peer Group
neighbor activate
neighbor peer-group
neighbor advertise-map
neighbor prefix-list
neighbor allowas-in
neighbor prefix-tree
neighbor as-override
neighbor remote-private-as
neighbor default-originate
neighbor route-map
neighbor distribute-list
neighbor route-reflector-client
neighbor filter-list
neighbor send-community
neighbor local-as
neighbor send-label
neighbor maximum-prefix
neighbor soft-reconfiguration inbound
neighbor next-hop-self
neighbor unsuppress-map
neighbor next-hop-unchanged
Inheritance of Configuration Values
Peer groups inherit all configuration values that are globally configured. However, attributes configured for a peer group override inherited global configuration values. Individual peers that are members of peer groups inherit all configuration values from the peer group. However, attributes configured on a peer override values inherited from the peer group of which it is a member.
The neighbor commands enable you to control features or set parameters for individual peers or for peer groups. These commands can be classified into the four categories shown in Table 10, based on whether the command enables a feature or sets parameters, the levels at which it behaves, and how the no version of the command compares with the default version.
Table 10: Behavior of Neighbor Commands
Category A: Enable or disable a feature that can be configured for a peer or for a peer group | Category B: Enable or disable a feature that can be configured for a peer, for a peer group, or globally | Category C: Set parameters for a peer or for a peer group | Category D: Set parameters for a peer, for a peer group, or globally |
|---|---|---|---|
|
|
|
|
Some of the commands in Table 10 inherit global values set by other commands. Table 11 describes the relationship between these commands.
Table 11: Inheritance from Other Commands
Category B Command | Inherits Global Values Set By |
|---|---|
neighbor default-originate | default-information originate |
neighbor graceful-restart | bgp graceful-restart |
neighbor rib-out disable | rib-out disable |
neighbor shutdown | bgp shutdown |
neighbor graceful-restart restart-time | bgp graceful-restart restart-time |
neighbor graceful-restart stalepaths-time | bgp graceful-restart stalepaths-time |
Example 1
For category A and B commands, the behavior of the no version of the command is different from the behavior of the default version of the command. The no version explicitly disables the feature:
- Applied to a peer, the no version disables the feature regardless of whether the feature is enabled for any peer group to which it belongs.
- Applied to a peer group, the no version disables the feature regardless of whether the feature is enabled for BGP globally or by default.
The default version simply unconfigures the feature for the peer or peer group.
- Applied to a peer, the default version causes the peer to inherit the state of the feature (enabled or disabled) from any peer group to which it belongs.
- Applied to a peer group, the default version causes the peer group to inherit the state of the feature (enabled or disabled) from the BGP global configuration.
The following example illustrates this difference and the inheritance concept with the neighbor soft-reconfiguration inbound command.
Inbound soft-reconfiguration is disabled by default, hence it is currently disabled for both the lisbon peer group and peer 10.19.7.8.
Inbound soft-reconfiguration is now enabled for the lisbon peer group. Because the peer inherits values from the peer group, inbound soft-reconfiguration is now also enabled for peer 10.19.7.8.
The no command disables inbound soft-reconfiguration for peer 10.19.7.8, overriding the configuration of the peer group to which the peer 10.19.7.8 belongs. The configuration of an individual peer takes precedence over the configuration of the peer group to which the peer belongs.
The default version returns the peer to inheriting the peer group configuration. Because inbound soft-reconfiguration is still enabled for lisbon, it is now also enabled for peer 10.19.7.8.
Finally, this last command returns the peer group configuration to the default value, disabling inbound soft-reconfiguration. The peer 10.19.7.8 inherits this value.
Example 2
For category C and D commands, the behavior of the no version of the command is the same as the behavior of the default version of the command. The following example illustrates this behavior and the inheritance concept for the neighbor timers command.
By default, the BGP global keepalive timer is 30 seconds and the global hold-time timer is 90 seconds.
Peer group eastcoast and peer 10.10.21.23 both have the default timer values. The peer group inherits the global timer values; the peer is a member of eastcoast and inherits the timer values from the peer group.
Now peer group eastcoast has a keepalive timer of 15 seconds and a hold-time timer of 40 seconds. Peer 10.10.21.23 inherits these values from the peer group.
Now peer 10.10.21.23 has its timers reset to the global values of 30 and 90 seconds. The configuration of an individual peer takes precedence over the configuration of the peer group to which the peer belongs, which in turn takes precedence over the global configuration.
Nothing changes. For commands in categories C and D, the behavior of the default version is the same as the no version. Peer 10.10.21.23 still has the global timer values.
The eastcoast peer group now has timer values of 20 seconds. Peer 10.10.21.23 still has the global timer values.
Limitations on Inheritance
All BGP peers that are members of the same peer group must send essentially the same updates. Accordingly, all members of a peer group must be the same kind of peer; that is, all must be internal peers, all must be external peers, or all must be confederation peers.
Outbound policies configured for peer groups are still inherited by peer group members, but you cannot override this inherited outbound policy by configuring a different outbound policy on individual members of that peer group with the following commands:
Table 12: Commands That Do Not Override Inherited Outbound Policy
neighbor as-override | neighbor next-hop-unchanged | neighbor route-map out |
neighbor default-originate | neighbor prefix-list out | neighbor route-reflector-client |
neighbor distribute-list out | neighbor prefix-tree out | neighbor send-community |
neighbor filter-list out | neighbor remove-private-as | neighbor unsuppress-map |
neighbor next-hop-self |
|
|
![]() | Note: This restriction does not apply to inbound policy, which you can still override per peer. |
The update messages can vary for members of a peer group as follows:
- The next hop can be different for each update sent to peer group members if the members are all external peers.
- The AS path can be different for each update sent to peer group members if the members are all external peers if you have enabled AS override with the neighbor as-override command.
Setting the BGP Identifier
By default, the router ID of the router is used as the BGP identifier. You can use the bgp router-id command to configure an IP address as the BGP identifier.
bgp router-id
- Use to configure an IP address as the BGP identifier.
- Examplehost1(config-router)#bgp router-id 10.25.1.1
- The new BGP identifier is used in open messages sent after you issue the command. To use the new BGP identifier for sessions already in the established state, you must use the clear ip bgp command to perform a hard clear.
- Use the no version to restore the router ID as the BGP identifier.
- See bgp router-id
Configuring Neighbors
Use the neighbor remote-as command to create a BGP peering session with a given BGP peer—identified by its IP address—in a given AS. Note that the neighbor remote-as command must be issued on both routers on either side of a BGP session for the BGP session to become established.
Consider the simple network structure shown in Figure 10. Routers LA and SanJose are IBGP peers within AS 873. Router SanJose has an EBGP peer, router Boston, in AS 17.
Figure 10: Configuring Neighbors

The following commands configure router Boston with router SanJose as a peer:
The following commands configure router SanJose with router LA and router Boston as peers:
The following commands configure router LA with router SanJose as a peer:
neighbor remote-as
- Use to add an entry to the BGP neighbor table.
- Specifying a neighbor with an AS number that matches the AS number specified in the router bgp command identifies the neighbor as internal to the local AS. Otherwise, the neighbor is treated as an external neighbor.
- If you specify a BGP peer group by using the peerGroupName argument, all the members of the peer group inherit the characteristic configured with this command unless it is overridden for a specific peer.
- This command takes effect immediately.
- Use the no version to remove an entry from the table.
- See neighbor remote-as
Hide Navigation Pane
Show Navigation Pane
SHA1
