Table 6-1. Basic BGP Configuration Commands

Sets up peering between BGP routers. IP address must match the source of routing updates.

neighbor peer-group-namepeer-group

Creates a peer group to which you can then assign neighbors.

neighborip-addresspeer-grouppeer-group-name

Assigns a neighbor to a peer group.

neighborip-addressnext-hop-self

Configures a router to advertise its connected interface as the next hop for all routes to this neighbor.

neighborip-addressupdate-sourceinterface-type number

Configures a router to use the IP address of a specific interface as the source for its advertisements to this neighbor.

no synchronization

Turns off BGP synchronization.

networkprefix[masksubnet-mask]

Initiates the advertisement of a network in BGP.

BGP Network Command

In most IGPs, the network command starts the routing process on an interface. In BGP, the command tells the router to originate an advertisement for that network. The network does not have to be connected to the router; it just has to be in the routing table. In theory, it can even be a network in a different autonomous system (not usually recommended).

When advertising a network, BGP assumes you are using the default classful subnet mask. If you want to advertise a subnet, you must use the optional keyword mask and specify the subnet mask to use. Note that this is a subnet mask, not the inverse mask used by OSPF and EIGRP network statements. The routing table must contain an exact match (prefix and subnet mask) to the network listed in the network statement before BGP advertises the route.

BGP Peering

BGP assumes that external neighbors are directly connected and that they are peering with the IP address of the directly connected interface of their neighbor. If not, you must tell BGP to look more than one hop away for its neighbor, with the neighborip-addressebgp-multihopnumber-of-hops command. You might use this command if you are peering with loopback interface IP addresses, for instance. BGP assumes that internal neighbors might not be directly connected, so this command is not needed with IBGP. If you do peer with loopback IP addresses, you must change the source of the BGP packets to match the loopback address with the neighborip-addressupdate-sourceinterface command.

To take down the peering session with a neighbor but keep the neighbor configuration, use the neighborip-addressshutdown command.

BGP Peering States

The command show ip bgp neighbors shows a list of peers and the status of their peering session. This status can include the following states:

Idle: No peering; router is looking for neighbor. Idle (admin) means that the neighbor relationship has been administratively shut down.

Connect: TCP handshake completed.

OpenSent, or Active: An open message was sent to try to establish the peering.

OpenConfirm: Router has received a reply to the open message.

Established: Routers have a BGP peering session. This is the desired state.

You can troubleshoot session establishment with debug commands. Use debug ip bgp events or debug ip bgp ipv4 unicast (in IOS versions 12.4 and up) to see where the process fails. Some common failure causes include AS number misconfiguration, neighbor IP address misconfiguration, a neighbor with no neighbor statement for your router, and a neighbor with no route to the source address of your router's BGP messages.