Routelearn.net
Course menu

Course 8: RoutingLesson 3.3 (10 of 12 in this course)59 of 91 in the CCNA series

Where BGP fits

The protocol that connects separate networks across the internet, explained without the deep detail.

Intermediate · 6 min read

BGP (Border Gateway Protocol) is the path-vector routing protocol used to exchange routes between autonomous systems, the separately run networks that make up the internet. Each route carries an AS path listing the autonomous systems it has crossed, which BGP uses for loop prevention and path selection.

In simple terms: BGP is how the networks of different companies and internet providers tell each other which addresses they can reach. It's the protocol that ties the internet together.

A real-life situation

The company's website must stay online even if its ISP has an outage. So it signs up with a second ISP. Now the rest of the internet needs to know that the company's public addresses, 198.51.100.0/24, can be reached through either ISP. A static default route can't announce anything to the internet. This is BGP's job.

What BGP is

BGP (Border Gateway Protocol) is the routing protocol that connects separate networks into the internet. Each of those networks is an autonomous system (AS): a group of routers run by one organisation with one routing policy. Each AS has a number, an ASN. In this lesson the company is AS 64500 and its ISPs are AS 64501 and AS 64502 (numbers reserved for documentation).

BGP is a path-vector protocol. Every route carries the AS path: the list of ASes it has passed through. A router that sees its own ASN in the path rejects the route, which stops loops between networks.

eBGPeBGPR1AS 64500 · 198.51.100.0/24ISP-AAS 64501ISP-BAS 64502Rest of the internet
  1. 1. R1 announces the company's block to both ISPs. AS path so far: 64500.
  2. 2. The ISPs pass it on, each adding its own ASN to the path. The internet now knows two ways in.
  3. 3. ISP-A fails: its announcement is withdrawn, and traffic arrives through ISP-B instead.

eBGP and iBGP

eBGP (external)iBGP (internal)
Neighbours are inDifferent ASesThe same AS
Used forExchanging routes with ISPs and partnersCarrying those routes across your own AS
Administrative distance20200

BGP neighbours, called peers, are configured by hand and talk over a TCP connection on port 179. Nothing is discovered automatically like OSPF's hellos.

Why it works this way

OSPF runs inside one network you control, so it simply finds the cheapest path. BGP runs between organisations that don't trust each other and have business rules: "use the cheaper ISP for outbound traffic", "never carry traffic between my two providers". So BGP chooses paths by policy, using attributes such as local preference and AS path length, rather than by speed. It is also built to carry about a million internet routes calmly, which no IGP is designed for.

OSPFBGP
TypeIGP, link stateEGP, path vector
RunsInside one organisationBetween organisations (and inside large ones)
Picks paths byLowest costPolicy and attributes
NeighboursFound automaticallyConfigured by hand, over TCP 179

A minimal example

⚠️ Based on Cisco IOS / IOS XE documentation, not run on a lab device. Real ISP connections also need filters so you only announce your own prefix; that is beyond the CCNA.

ip route 198.51.100.0 255.255.255.0 Null0 router bgp 64500 neighbor 203.0.113.1 remote-as 64501 neighbor 192.0.2.1 remote-as 64502 network 198.51.100.0 mask 255.255.255.0

On R1. BGP only announces a network that exists exactly in the routing table, so a static route to Null0 (a discard interface) holds the /24 in place.

How to verify it

This output is based on Cisco documentation, not run on a lab device.

Example output · based on Cisco documentation; exact format varies by platform and software version
R1#show ip bgp summary
BGP router identifier 1.1.1.1, local AS number 64500
BGP table version is 4, main routing table version 4
2 network entries using 496 bytes of memory
3 path entries using 408 bytes of memory

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
192.0.2.1       4        64502      38      36        4    0    0 00:31:02        1
203.0.113.1     4        64501      45      42        4    0    0 00:35:10        1
A number in the last column means the session is up and that many prefixes were received (here, a default route from each ISP). A word such as Idle or Active there means the session is not up.

Check yourself

Predict · scenario 1

Two routers in the same AS run BGP with each other. What is this called?

Predict · scenario 2

A BGP route arrives with AS path 64502 64500 at a router in AS 64500. What does the router do?