BGP Fundamentals
Review of BGP Fundamentals
Review of BGP Fundamentals
Border Gateway Protocol (BGP):
• Considered an Exterior Gateway Protocol (EGP)
• Routes between autonomous systems
• “Protocol of the Internet”
• Autonomous system numbers (ASNs) allow for communication
Review of BGP Fundamentals
Border Gateway Protocol (BGP):
• AS numbers provided from the IANA
• Designated 32-bit range of ASNs for unique assignment
• Roughly 4.3 billion unique ASNs available
Review of BGP Fundamentals
Border Gateway Protocol (BGP):
• Adjacencies allow for route exchange
• Adjacencies do not have to be directly connected
• BGP session = an adjacency established between BGP peers
Review of BGP Fundamentals
Border Gateway Protocol (BGP):
• Neighbor addressing not learned via Multicast
• Neighbor addressing is explicitly configured
• BGP sessions use a TCP connection
• BGP advertisements contain address prefix and length
• Network Layer Reachability Information (NLRI) contains BGP
advertisement information and path attributes (PAs)
Review of BGP Fundamentals
Border Gateway Protocol (BGP):
• Path-vector routing protocol
• Counts autonomous system hops, rather than router hops
Review of BGP Fundamentals
Border Gateway Protocol (BGP):
• Internal BGP (iBGP)
• Communication between routers within same AS
• More robust than other IGPs such as OSPF or EIGRP
• External BGP (eBGP)
• Communication between routers in different AS
Review of BGP Fundamentals
Border Gateway Protocol (BGP):
• BGP sessions use TCP port 179
• TCP allows for adjacencies that are multiple hops away
• Multi-hop sessions require underlying routes from RIB
Review of BGP Fundamentals
BGP Message Types:
• OPEN, UPDATE, NOTIFICATION, KEEPALIVE
OPEN Message:
• Establishes initial BGP adjacency
• BGP version, ASN of originating router, BGP identifier,
hold time, and other optional parameters
• BGP identifier = 32-bit router ID (RID)
• Hold time determines when session is torn down (180 second default)
Review of BGP Fundamentals
BGP Message Types:
• OPEN, UPDATE, NOTIFICATION, KEEPALIVE
KEEPALIVE Message:
• Heartbeat that keeps hold time from expiring
• Exchanged at a rate of 1/3 of the hold time
• Default value is 60 seconds (1/3 of 180 second hold time)
Review of BGP Fundamentals
BGP Message Types:
• OPEN, UPDATE, NOTIFICATION, KEEPALIVE
UPDATE Message:
• Updates known routes
• Advertises feasible routes and removing routes
• NLRI exchanged within the UPDATE messages
Review of BGP Fundamentals
BGP Message Types:
• OPEN, UPDATE, NOTIFICATION, KEEPALIVE
NOTIFICATION Message:
• Alert about error detection within a BGP session
• Expired hold timers, neighbor changes, request for BGP
session reset
BGP States and
Timers
BGP States and Timers
BGP States and Timers
Border Gateway Protocol (BGP):
• Explicit manual neighbor configuration
• TCP connection over port 179
BGP States and Timers
BGP Idle State:
• BGP start event detected
• Actively trying to establish TCP connection with peer
• Listens for a new connect from peer
BGP States and Timers
BGP Connect State:
• Waiting for TCP three-way handshake to complete
• 120 second ConnectRetry timer
• Connect state failure (ConnectRetry timer reaches zero)
moves BGP to Active state
BGP States and Timers
BGP Active State:
• New TCP connection with peer is attempted
• Failure moves BGP back to Connect state, resets
ConnectRetry timer
• Success moves BGP to OpenSent state
BGP States and Timers
“TCP Phase” of States
• Idle state
• Connect state
• Active state
• Failure in these states indicates a TCP connection issue
BGP States and Timers
BGP OpenSent State:
• BGP-related messages are exchanged
• Originating router sends Open message
• Waits for similar Open message from peer
• Compares BGP version, source IP addressing, AS number,
BGP RID, and security parameters
• If parameters match, KEEPALIVE messages keep session active
and reset the Hold Time
• If errors are found, a notification message is sent and BGP moves
back to Idle state
BGP States and Timers
BGP OpenCon rm State:
• Open messages match and session is established
• Waiting for KEEPALIVE messages
• If no KEEPALIVE is received, BGP moves to Idle state
• Receipt of KEEPALIVE moves BGP to Established state
fi
BGP States and Timers
BGP Established State:
• Routes exchanged via Update messages
• KEEPALIVE messages exchanged between peers to reset
Hold Time
• KEEPALIVE default value is 60 seconds
• Hold Time default value is 180 seconds
BGP States and Timers
“BGP Phase” of States
• OpenSent state
• OpenConfirm state
• Established state
• Failure in these states indicates a BGP configuration issue
BGP Neighbor
Formation
BGP Neighbor Formation
AS 65100 AS 65200
10.1.1.0 /30
R1 .1 .2 R2
BGP Path Selection
BGP Path Selection
BGP Route Advertisements:
• Network Layer Reachability Information (NLRI)
• Path Attributes (PAs)
BGP Path Selection
Well-Known Mandatory Attributes:
• Must be present in all BGP updates
• ORIGIN, AS_PATH, NEXT_HOP
BGP Path Selection
Well-Known Discretionary Attributes:
• Optional, not required
• LOCAL_PREF
BGP Path Selection
Optional Transitive Attributes:
• Optional attributes passed on to other BGP routers
• COMMUNITY
BGP Path Selection
Optional Non-Transitive Attributes:
• Not passed on to other BGP routers
• Multi-Exit Discriminator (MED)
BGP Path Selection Algorithm
1. Choose route with the highest weight.
2. Choose route with highest local preference.
3. Choose routes originating from local router.
4. Choose the shortest Autonomous System path.
5. Choose the path with the lowest origin code.
6. Choose route with lowest MED.
7. Prefer eBGP over iBGP route.
8. Choose route through nearest IGP neighbor by lowest metric.
9. Choose the oldest route.
10. Choose path through neighbor with lowest RID.
11. Choose path with the minimum cluster list length.
12. Choose path through neighbor with lowest IP address.
BGP Synchronization
BGP Synchronization
BGP Synchronization
BGP Synchronization Rule:
• Avoid unintentional network “black holes”
• Only advertises a route learned from an iBGP peer to an
eBGP peer when there is an exact match of that route
learned from an IGP in the routing table
BGP Peer Groups
BGP Peer Groups
BGP Peer Groups
BGP Peer Groups:
• Group neighbors together who share policies
• More efficient update process
• Simplified configuration
• Uses less neighbor resources
AS 65200
ISP1
.2
198.51.100.0 / 30
AS 65100
.1
R1 R2 AS 65300 INET
.5
198.50.100.4 / 30
.6
AS 65400 ISP2
BGP Multihop
AS 65100 AS 65200
10.1.1.0 /30 20.1.1.0 /30
R1 .2 .1 R2 .1 .2 R3
BGP Route Reflector
AS 65200
AS 65100
20.1.1.0 /30 30.1.1.0 /30 40.1.1.0 /30
R1 .1 .2 R2 .1 .2 R3 .1 .2 R4
10.1.1.1 /24
BGP Summarization
AS 65100 AS 65200
30.1.1.0 /30
20.1.1.0 /30
R1 .1 .2 R2 .1 .2 R3
10.10.0.0 /2
10.10.1.0 /2
10.10.2.0 /2
10.10.3.0 /24
4
Influencing BGP
Influencing BGP
20.1.1.0 /30 .2
ISP-C
10.1.1.0 /30
AS 300
.1
.1 .2
ISP-A ISP-B .1
AS 100 AS 200
30.1.1.0 /30 .2
ISP-D
AS 400
Influencing BGP
10.1.1.0 /30 20.1.1.0 /30
.1 .2 .1 .2
Branch 1 ISP Branch 2
AS 100 AS 200 AS 100
Lo0: 1.1.1.1 Lo0: 2.2.2.2
Influencing BGP
12.12.12.0 /30 .2 R2 .2
20.20.20.0 /30
AS 200
AS 100 Lo0: 2.2.2.2 AS 400
Lo0: 1.1.1.1 Lo0: 4.4.4.4
.1 .1
R1 .1 .1 INET
AS 300
Lo0: 3.3.3.3
13.13.13.0 /30 30.30.30.0 /30
.2 .2
R3