8.3 Configuring BGP 
8.3.3 EBGP and IBGP configuration example
In the example depicted by the figure, RTB speaks EBGP to RTA, which is a different AS, and IBGP to RTC, which resides in the same AS. To start the EBGP process with RTA, use the following commands:

RTB(config)#router bgp 200
RTB(config-router)#neighbor 10.1.1.2 remote-as 100

Note that the neighbor command's remote-as value, 100, is different from the AS number specified by the router bgp command (200). Because the two AS numbers are different, BGP will start an EBGP connection with RTA. Communication will occur between autonomous systems.

The commands to configure IBGP are essentially the same as those to configure EBGP, except for the possible addition of the update-source interface  keyword.

RTB(config)#router bgp 200
RTB(config-router)#neighbor 172.16.1.2 remote-as 200
RTB(config-router)#neighbor 172.16.1.2 update-source loopback 0

The remote-as value (200) is the same as RTB's BGP AS number, so BGP recognizes that this connection will occur within AS 200. It attempts to establish an IBGP session. In reality, AS 200 is not a remote AS at all; it is the local AS because both routers reside there. For simplicity, the keyword remote-as is used when configuring both EBGP and IBGP sessions.

Note also the second neighbor command, which is used to assign an optional parameter to be used when communicating with that neighbor. It is typical to use multiple neighbor commands for the same BGP neighbor, each specifying a particular BGP option.

In this example, the option specified is update-source loopback 0. If multiple pathways to the neighbor exist, then the router can use any IP interface to speak BGP with that neighbor. The update-source loopback 0 command is used to instruct the router to use interface loopback 0 for TCP connections. This command is typically used in all IBGP configurations. Without this command, BGP routers can use only the closest IP interface to the peer. The capability to use any operational interface provides BGP with robustness in case the link to the closet interface fails. Because EBGP sessions are typically point-to-point, there is no need to use this command with EBGP.

Returning to the example configuration, assume that the following route appears in RTB's table:

O 192.168.1.0/24 [110/74] via 10.2.2.1, 00:31:34, Serial2

RTB learned this route via an IGP (OSPF). AS 200 uses OSPF internally to exchange route information. Can RTB advertise this network via BGP? Certainly. Redistributing OSPF into BGP will work, but the BGP network command will do the same thing:

RTB(config-router)#network 172.16.1.0 mask 255.255.255.252
RTB(config-router)#network 10.1.1.0 mask 255.255.255.252
RTB(config-router)#network 192.168.1.0

The first two network commands above include the mask keyword, so only a particular subnet is specified. The third network command results in the OSPF route being advertised by BGP without redistribution. Remember that the BGP network command works differently than the IGP network command.

Interactive Lab Activity (Flash, 372 kB)
  The purpose of this activity is to configure both IBGP and EBGP sessions on the ISP1 router. All other routers have already been configured for BGP.