External BGP (eBGP)
Connect two routers in different autonomous systems. Establish the session first, then advertise one network from each side and verify the result.
Network and setup
R1 uses AS 65010; R2 uses AS 65020. Their GigabitEthernet1 interfaces share 192.0.2.0/30. Each router has a loopback for its router ID and a separate loopback network to advertise.
Initial interface configuration · R1 and R2
R1
enable
configure terminal
hostname R1
interface GigabitEthernet1
ip address 192.0.2.1 255.255.255.252
no shutdown
exit
interface Loopback0
ip address 10.255.0.1 255.255.255.255
exit
interface Loopback10
ip address 198.51.100.1 255.255.255.0
exit
endR2
enable
configure terminal
hostname R2
interface GigabitEthernet1
ip address 192.0.2.2 255.255.255.252
no shutdown
exit
interface Loopback0
ip address 10.255.0.2 255.255.255.255
exit
interface Loopback10
ip address 203.0.113.1 255.255.255.0
exit
endBefore configuring BGP, check the direct link from both sides.
R1# ping 192.0.2.2
!!!!!
Success rate is 100 percent (5/5)R2# ping 192.0.2.1
!!!!!
Success rate is 100 percent (5/5)A failed ping here points to interface addressing, link state, or filtering. Fix that before continuing.
Configure neighbors
Define the local AS, identify the neighbor’s address and AS, and activate IPv4 unicast. This example disables implicit IPv4 activation so the address-family step is explicit.
R1
configure terminal
router bgp 65010
bgp router-id 10.255.0.1
no bgp default ipv4-unicast
neighbor 192.0.2.2 remote-as 65020
address-family ipv4 unicast
neighbor 192.0.2.2 activate
exit-address-family
endR2
configure terminal
router bgp 65020
bgp router-id 10.255.0.2
no bgp default ipv4-unicast
neighbor 192.0.2.1 remote-as 65010
address-family ipv4 unicast
neighbor 192.0.2.1 activate
exit-address-family
endrouter bgp sets the local AS. remote-as names the other router’s AS. Different local and remote ASes make this an eBGP relationship.
Optional neighbor authentication
For TCP MD5 authentication, set the same neighbor password at both endpoints. This authenticates TCP segments; it does not encrypt BGP or user traffic. The value below is a lab example.
R1
configure terminal
router bgp 65010
neighbor 192.0.2.2 password PacketLabLab
endR2
configure terminal
router bgp 65020
neighbor 192.0.2.1 password PacketLabLab
endA missing or different password prevents a new authenticated TCP connection. Apply matching settings on both lab routers and recheck the session. Existing sessions may reset during changes.
Verify the session
Use the summary on each router. At this stage we have not originated any BGP prefixes.
R1# show ip bgp summary
BGP router identifier 10.255.0.1, local AS number 65010
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.0.2.2 4 65020 8 8 1 0 0 00:03:10 0Neighbor addresses and remote ASes must match the opposite router. Where adjacency logging is enabled, a successful connection can also produce:
R1: %BGP-5-ADJCHANGE: neighbor 192.0.2.2 Up
R2: %BGP-5-ADJCHANGE: neighbor 192.0.2.1 UpA number in State/PfxRcd indicates an established session and the number of accepted prefixes. Zero is normal before route origination. A word such as Active means the session is not Established.
R2# show ip bgp summary
Neighbor V AS Up/Down State/PfxRcd
192.0.2.1 4 65010 00:03:10 0R1# show ip bgp neighbors 192.0.2.2
BGP neighbor is 192.0.2.2, remote AS 65020, external link
BGP version 4, remote router ID 10.255.0.2
BGP state = Established, up for 00:03:10R2 should identify R1 as remote AS 65010. The detailed neighbor view should report Established and remote router ID 10.255.0.2 on R1.
Advertise networks
Originate the Loopback10 networks. The exact prefix and mask must already exist in the local IP routing table; the network command does not create that route.
R1
configure terminal
router bgp 65010
address-family ipv4 unicast
network 198.51.100.0 mask 255.255.255.0
exit-address-family
endR2
configure terminal
router bgp 65020
address-family ipv4 unicast
network 203.0.113.0 mask 255.255.255.0
exit-address-family
endThe loopbacks provide the exact connected /24 routes. We are advertising those networks, not every interface on either router.
Verify routes
R1# show ip bgp
Network Next Hop Metric LocPrf Weight Path
*> 198.51.100.0/24 0.0.0.0 0 32768 i
*> 203.0.113.0/24 192.0.2.2 0 0 65020 i
R1# show ip route bgp
B 203.0.113.0/24 [20/0] via 192.0.2.2R1 originated 198.51.100.0/24 locally. It learned 203.0.113.0/24 from R2, with next hop 192.0.2.2 and AS path 65020. The final i is the origin code; it does not mean this is an iBGP neighbor.
R2# show ip bgp
Network Next Hop Metric LocPrf Weight Path
*> 198.51.100.0/24 192.0.2.1 0 0 65010 i
*> 203.0.113.0/24 0.0.0.0 0 32768 i
R2# show ip route bgp
B 198.51.100.0/24 [20/0] via 192.0.2.1R2 has the reciprocal view: its own prefix is local, and R1’s prefix has AS path 65010. The default administrative distance for an installed eBGP route is 20; the bracketed 0 is the route metric.
The BGP table and IP routing table are separate checks. In this clean lab the remote prefix should be installed. On R2, the reciprocal learned prefix is 198.51.100.0/24 through 192.0.2.1.
R1# ping 203.0.113.1 source 198.51.100.1
!!!!!
Success rate is 100 percent (5/5)R2# ping 198.51.100.1 source 203.0.113.1
!!!!!
Success rate is 100 percent (5/5)These source-specific tests exercise both learned routes. An established session alone does not prove data-plane reachability.
Packet view
Illustrative message exchange and UPDATE fields
This is a constructed protocol view, not a recorded capture. BGP messages can share a TCP segment or span multiple segments.
| Step | Observation |
|---|---|
| TCP setup | One peer connects to the other’s TCP port 179. |
| OPEN exchange | Peers identify their ASes, router IDs, and supported session parameters. |
| KEEPALIVE exchange | Successful establishment is confirmed. |
| R2 advertises its prefix | UPDATE: NLRI 203.0.113.0/24; AS_PATH 65020; NEXT_HOP 192.0.2.2. |
A lab capture on Gi1 can use display filter tcp.port == 179. Session states and individual message formats have their own later lessons.
Troubleshooting
| Observation | First checks |
|---|---|
| Idle / Active | Link reachability, neighbor address, remote AS, IPv4 activation, TCP 179 access. |
| Established, zero prefixes | Network statements and exact local routing-table entries. |
| Prefix in BGP, absent from IP table | Route validity and competing routes in the IP routing table. |
Final configurations
R1 and R2 · complete base lab
This base configuration omits the optional password. If you use authentication, add the matching password command at both endpoints.
R1
configure terminal
hostname R1
interface GigabitEthernet1
ip address 192.0.2.1 255.255.255.252
no shutdown
exit
interface Loopback0
ip address 10.255.0.1 255.255.255.255
exit
interface Loopback10
ip address 198.51.100.1 255.255.255.0
exit
router bgp 65010
bgp router-id 10.255.0.1
no bgp default ipv4-unicast
neighbor 192.0.2.2 remote-as 65020
address-family ipv4 unicast
neighbor 192.0.2.2 activate
network 198.51.100.0 mask 255.255.255.0
exit-address-family
endR2
configure terminal
hostname R2
interface GigabitEthernet1
ip address 192.0.2.2 255.255.255.252
no shutdown
exit
interface Loopback0
ip address 10.255.0.2 255.255.255.255
exit
interface Loopback10
ip address 203.0.113.1 255.255.255.0
exit
router bgp 65020
bgp router-id 10.255.0.2
no bgp default ipv4-unicast
neighbor 192.0.2.1 remote-as 65010
address-family ipv4 unicast
neighbor 192.0.2.1 activate
network 203.0.113.0 mask 255.255.255.0
exit-address-family
endKey Takeaways
- Configure each neighbor explicitly: router bgp sets the local AS and remote-as identifies the other AS.
- Different AS numbers make the relationship eBGP; IPv4 unicast must be active for this lab.
- A numeric State/PfxRcd value means Established; zero prefixes is normal before advertisements.
- A network statement originates an exact prefix already installed in the local routing table.
- Verify both BGP tables, installed IP routes and source-specific pings; session state alone does not prove forwarding.
References and lab notes
Command behavior: basic BGP configuration · TCP MD5 authentication.
Check interface names and feature support on the selected router software. Router-symbol attribution.