BGP Basics PDF
BGP Basics PDF
2
Internal & External BGP
• eBGP used to:
– Exchange networks/routes between ASes
• Aggregates and sub-aggregates
3
BGP Message Types
• Open:
– After a TCP connection has been established between two
BGP routers, an Open message is sent
• Once the open message is confirmed (keepalive), the BGP session is
established – become BGP peers/neighbors!
– Contains:
• Sender’s ASN
• BGP version
• BGP router ID
• Hold-time (3 x keepalive interval)
4
BGP Message Types
• Keepalive:
– Exchanged initially to acknowledge Open messages
– Exchanged periodically (60 secs) to maintain BGP session
• Dataless packet
• Update:
– BGP peers exchange network information through Update
messages
• One update for each path!
– Contains:
• Withdrawn routes – no more reachable
• Path attributes – attributes for this path to reach the destinations
specified by the NLRI
• NLRI – list of networks reachable through this path <prefix, length>
5
BGP Message Types
• Notification:
– Sent when an error condition is detected
– The BGP session is torn down immediately!
– Contains:
• Error code
• Error sub-code
• Data related to error
6
BGP Neighbor States
• A BGP router goes through six different states
– Idle
• The router is looking for a route to its neighbor
– Connect
• BGP router moves from Idle to Connect state if it has found a route to its
neighbor, and has started the 3-way TCP handshake
• If the 3-way handshake is complete, sends an Open message
– Active
• A router transitions to Active state if the initial 3-way handshake was not
successful
• Initiates a new 3-way handshake
• If the 3-way handshake is complete, sends an Open message
• Else, falls back to Idle
7
BGP Neighbor States
• A BGP router goes through six different states
– Open Sent
• An Open message has been sent to the neighbor
• If it receives a keepalive, moves to Open Confirm, else back to Active
– Open Confirm
• Has received an acknowledgment for its Open message, and is waiting
for the initial keepalive
• If it receives the intial keepalive, transitions to Established
– Established
• The BGP neighbor relationship (session) is established!
• Routing information can now be exchanged
8
BGP Neighbor Relationship
• eBGP neighbors/peers
– BGP session established between routers in different ASes
– Generally directly connected!
• Session established using directly connected intf IP
• Peering address must match the TCP session!
9
BGP Neighbor Relationship
• iBGP neighbors/peers
– BGP session established between routers within the same AS
10
iBGP Operation
• iBGP routers must:
– Originate directly connected routes
11
iBGP full-mesh
R2
12
Sourcing iBGP from Loopback
• By default, routers use the exit-interface address as
the source address for locally originated packets
(updates)
– If the BGP TCP session was established using any other
interface (loopbacks) addresses, the source address for BGP
updates must match!
13
Advertising Networks in BGP
• The network statement
– allows BGP to inject routes into BGP table and advertise to
neighbors only if it already exists in the routing table!
router bgp 17821
address-family ipv4 unicast
network <prefix> mask <subnet-mask>
address-family ipv6 unicast
network <prefix/length>
14
How it all works?
eBGP eBGP
15
Acknowledgement:
• Philip Smith
• Cisco Systems
16
17