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 ASthe 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.
- Example
host1(config)#router bgp 100Use the no version to remove the BGP process. 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 Chapter 3, Configuring BGP-MPLS Applications, provide more information about command behavior.
- The commands listed in Table 6 configure parameters for the BGP process globally, regardless of address family.
The commands listed in Table 7 configure parameters for all address families within the current VRF context.
The commands listed in Table 8 configure parameters only for the current address family context.
The commands listed in Table 9 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 availablethat is, EBGP multihop is not configurable per address family: host1(config-router)#neighbor 10.1.3.4 remote-as 1234host1(config-router)#neighbor 10.2.3.4 ebgp-multihop 5host1(config-router)#address-family ipv4 multicasthost1(config-router-af)#neighbor 10.2.3.4 ebgp-multihop ?^% Invalid input detected at '^' marker.host1(config-router-af)#exit-address-family
The commands listed in Table 10 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 1234host1(config-router)#neighbor 1.2.3.4 route-map ucast-map inhost1(config-router)#address-family ipv4 multicasthost1(config-router-af)#neighbor 1.2.3.4 activatehost1(config-router-af)#neighbor 1.2.3.4 route-map mcast-map inhost1(config-router-af)#exit-address-family
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 11, 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.
Some of the commands in Table 11 inherit global values set by other commands. Table 12 describes the relationship between these commands.
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.
host1(config-router)#neighbor lisbon peer-grouphost1(config-router)#neighbor 10.19.7.8 peer-group lisbonInbound soft-reconfiguration is disabled by default, hence it is currently disabled for both the lisbon peer group and peer 10.19.7.8.
host1(config-router)#neighbor lisbon soft-reconfiguration inboundInbound 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.
host1(config-router)#no neighbor 10.19.7.8 soft-reconfiguration inboundThe 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.
host1(config-router)#default neighbor 10.19.7.8 soft-reconfiguration inboundThe 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.
host1(config-router)#default neighbor lisbon soft-reconfiguration inboundFinally, 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.
host1(config-router)#neighbor eastcoast peer-grouphost1(config-router)#neighbor 10.10.21.23 peer-group eastcoastPeer 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.
host1(config-router)#neighbor eastcoast timers 15 40Now 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.
host1(config-router)#no neighbor 10.10.21.23 timersNow 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.
host1(config-router)#default neighbor 10.10.21.23 timersNothing 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.
host1(config-router)#neighbor eastcoast timers 20 20The 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:
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
host1(config-router)#bgp router-id 10.25.1.1The 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. Configuring Neighbors
Use the neighbor remote-as command to create a BGP peering session with a given BGP peeridentified by its IP addressin 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.
![]()
The following commands configure router Boston with router SanJose as a peer:
host1(config)#router bgp 17host1(config-router)#neighbor 10.5.5.4 remote-as 873The following commands configure router SanJose with router LA and router Boston as peers:
host2(config)#router bgp 873host2(config-router)#neighbor 10.2.2.3 remote-as 873host2(config-router)#neighbor 10.5.5.1 remote-as 17The following commands configure router LA with router SanJose as a peer:
host3(config)#router bgp 873host3(config-router)#neighbor 10.2.2.4 remote-as 873neighbor 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.