0% found this document useful (0 votes)
112 views26 pages

BGP Finite State Machine Overview

The document discusses the working mechanism of Border Gateway Protocol (BGP). It describes the BGP messages, including OPEN, UPDATE, NOTIFICATION and KEEPALIVE messages. It also explains the BGP finite state machine and the different states a BGP peer can be in during its lifecycle, including IDLE, CONNECT, ACTIVE, OPENSENT, OPENCONFIRM and ESTABLISHED. Additionally, it provides an overview of BGP operations and transport.

Uploaded by

bong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
112 views26 pages

BGP Finite State Machine Overview

The document discusses the working mechanism of Border Gateway Protocol (BGP). It describes the BGP messages, including OPEN, UPDATE, NOTIFICATION and KEEPALIVE messages. It also explains the BGP finite state machine and the different states a BGP peer can be in during its lifecycle, including IDLE, CONNECT, ACTIVE, OPENSENT, OPENCONFIRM and ESTABLISHED. Additionally, it provides an overview of BGP operations and transport.

Uploaded by

bong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Border Gateway Protocol (BGP)

BGP Working Mechanism

v1.2
BGP Working Mechanism

BGP Messages

v1.2
BGP Messages
• Contains information required by BGP routers for maintaining
BGP session and performing routing updates.
• Each message is processed only after it is entirely received.
– Maximum size: 4,096 octets
• Must be supported by all BGP implementations
– Minimum size: 19 octets
• Message types:
– OPEN
– UPDATE
– NOTIFICATION
– KEEPALIVE
v1.2
BGP Message Types
Message Header:
• OPEN
– First message sent after TCP
connection establishment
– Contains:
• BGP version
• ASN of originating router Message Data:
• Hold Time
• BGP Router ID
• Capability codes (Optional)
– To be confirmed by KEEPALIVE

v1.2
BGP Message Types
Message Header:
• UPDATE
– Actual route updates
– Contains:
• Withdrawn Routes

Message Data:
• Path Attributes

• Network Layer Reachability Information (NLRI)

v1.2
BGP Message Types
Message Header:
• NOTIFICATION
– Sent when error occurred, contains
Error Code and Error Subcode
Error Symbolic Name Reference
Code
1 Message Header Error RFC4271 Section 6.1
Message Data:
2 OPEN Message Error RFC4271 Section 6.2

3 UPDATE Message Error RFC4271 Section 6.3

4 Hold Timer Expired RFC4271 Section 6.5

5 Finite State Machine Error RFC4271 Section 6.6

6 Cease RFC4271 Section 6.7

v1.2
BGP Message Types
Message Header:
• KEEPALIVE
– Does not contain data
– Sent to confirm OPEN, or to keep
HoldTimer from expiring
– As RFC4271’s suggested, Keepalive
Time is 30 seconds, and Hold Time is Message Data: (None)

90 seconds
• Keepalive Time and Hold Time are negotiable,
peers use the smaller values
• Each vendor may implement different default
configuration

v1.2
BGP Working Mechanism

BGP Finite State Machine (FSM)

v1.2
BGP Finite State Machine (FSM)
• BGP peer undergoes several state changes in its life cycle.
– IDLE
– CONNECT
– ACTIVE
– OPENSENT
– OPENCONFIRM
– ESTABLISHED

• During each state, peers must send and receive messages,


process message data, and initialize resources before
proceeding to the next state.
v1.2
BGP Finite State Machine (FSM)
• IDLE
ACTIVE CONNECT
– Initializes resources
– Resets ConnectRetryTimer OPEN OPEN

• RFC4271 suggested 120 seconds as the NOTIFICATION


OPENSENT IDLE
default value for ConnectRetryTime
– Initiates a TCP connection with its KEEPALIVE NOTIFICATION
configured BGP peer, and listens for a
TCP connection from its peer OPENCONFIRM
NOTIFICATION
• If no error, changes peer’s state to CONNECT
KEEPALIVE
• If error occurred, peer remains in IDLE state

ESTABLISHED

v1.2
BGP Finite State Machine (FSM)
• CONNECT
ACTIVE CONNECT
– Waits for successful TCP session
– Sends OPEN to peer OPEN OPEN

• If no error, changes peer’s state to OPENSENT NOTIFICATION


OPENSENT IDLE
• If error occurs, changes peer’s state to ACTIVE
• If ConnectRetryTimer expired, keeps peer in KEEPALIVE NOTIFICATION
CONNECT state and resets ConnectRetryTimer,
then tries a new TCP three-way handshake
OPENCONFIRM
• If something else happens, moves peer back to NOTIFICATION

IDLE state KEEPALIVE

ESTABLISHED

v1.2
BGP Finite State Machine (FSM)
• ACTIVE
ACTIVE CONNECT
– Unable to establish a successful TCP
session OPEN OPEN

– Tries to restart another TCP session with NOTIFICATION


OPENSENT IDLE
the peer
• If successful, sends an OPEN to the peer and KEEPALIVE NOTIFICATION
changes peer’s state to OPENSENT
• If unsuccessful, changes peer’s state to IDLE OPENCONFIRM
NOTIFICATION
• If ConnectRetryTimer expires, moves peer
back to CONNECT state KEEPALIVE

ESTABLISHED

v1.2
BGP Finite State Machine (FSM)
• OPENSENT
ACTIVE CONNECT
– OPEN has been sent to peer
– Waits for OPEN from peer OPEN OPEN

– Checks validity of the received OPEN NOTIFICATION


OPENSENT IDLE
• If there is no error, sends KEEPALIVE message
and changes peer’s state to OPENCONFIRM KEEPALIVE NOTIFICATION
• If error occurs due to mismatched OPEN
between peers, sends NOTIFICATION and OPENCONFIRM
change peer’s state to IDLE NOTIFICATION

• In case TCP session fails, moves peer back to KEEPALIVE


ACTIVE state
ESTABLISHED

v1.2
BGP Finite State Machine (FSM)
• OPENCONFIRM
ACTIVE CONNECT
– Waits for a KEEPALIVE or
NOTIFICATION from the peer OPEN OPEN

• Upon receipt of peer’s KEEPALIVE, changes


NOTIFICATION
peer’s state to ESTABLISHED OPENSENT IDLE

• If the HoldTimer expires or NOTIFICATION is


received, changes peer’s state to IDLE KEEPALIVE NOTIFICATION

OPENCONFIRM
NOTIFICATION

KEEPALIVE

ESTABLISHED

v1.2
BGP Finite State Machine (FSM)
• ESTABLISHED
ACTIVE CONNECT
– BGP peer adjacency is complete
– UPDATE is used for exchanging OPEN OPEN

reachability information NOTIFICATION


OPENSENT IDLE
• Initial full routing table exchange
• Incremental updates for later changes KEEPALIVE NOTIFICATION

– In case NOTIFICATION is received,


changes peer’s state back to IDLE OPENCONFIRM
NOTIFICATION

KEEPALIVE

ESTABLISHED

v1.2
BGP Working Mechanism

BGP Operations

v1.2
BGP Transport
• BGP operates by exchanging Network Layer Reachability
Information (NLRI).
– NLRI includes a set of BGP path attributes and one or more prefixes
which those attributes are associated
– NLRI is encapsulated inside the BGP UPDATE message

• Does not have own transport protocol.


• Utilizes TCP and runs on TCP port 179.
• BGP messages are exchanged over the TCP session.

v1.2
BGP Capabilities
• Capability codes indicate whether a BGP router is able to
accommodate particular capabilities.
– Advertised in OPEN message

• If received capability is not supported by remote peer, it sends


back a NOTIFICATION message.
• BGP routers attempt to peer without the unsupported capability.
• Commonly implemented capabilities:
– Route Refresh
– Multi-protocol Extension
– Support for 4-octet AS Number
v1.2
BGP Router ID
• Each router is identified by a unique 32-bit number written
in dotted decimal notation.
– Can be manually configured, or automatically selected by the router
• Cisco IOS: Highest Loopback IPv4 > Highest active interface IPv4
• Juniper Junos OS: Lowest Loopback IPv4 > Lowest physical interface IPv4
• MikroTik RouterOS: Lowest active interface IPv4
My Router ID My Router ID
is [Link]. is [Link].
[Link]/32, [Link]/128 [Link]/32, [Link]/128
Loopback0 Loopback0
.2 [Link]/24 .1 .2 [Link]/30 .1 .1 [Link]/24 .2
::2 [Link]/64 ::1 ::1 [Link]/127 ::0 ::1 [Link]/64 ::2
GigabitEthernet7 GigabitEthernet6 GigabitEthernet6 GigabitEthernet7

AS64512 AS65000
H1 [Link]/8 R1 BGP Session ISP1 [Link]/13 S1
[Link]/32 [Link]/32

v1.2
BGP Peer
• BGP does not perform auto-discovery for peers (neighbors).
• BGP peers are manually configured.
– Local peer address and ASN
– Remote peer address and ASN
– Authentication (if necessary)
I want to establish a I want to establish a
BGP session with BGP session with
[Link] from [Link] from
AS65000. AS64512.
[Link]/32, [Link]/128 [Link]/32, [Link]/128
Loopback0 Loopback0
.2 [Link]/24 .1 .2 [Link]/30 .1 .1 [Link]/24 .2
::2 [Link]/64 ::1 ::1 [Link]/127 ::0 ::1 [Link]/64 ::2
GigabitEthernet7 GigabitEthernet6 GigabitEthernet6 GigabitEthernet7

AS64512 AS65000
H1 [Link]/8 R1 BGP Session ISP1 [Link]/13 S1
[Link]/32 [Link]/32

v1.2
BGP Network
• Indicates a BGP prefix that should be originated by the router.
• By default, the prefix is advertised only if corresponding route
is present in the routing table.

My BGP networks: My BGP networks:


• [Link]/8 (aggregation) • [Link]/13 (aggregation)
• [Link]/24 (subnet) • [Link]/24 (subnet)
• [Link]/32 (aggregation) • [Link]/32 (aggregation)
• [Link]/64 (subnet) • [Link]/64 (subnet)
[Link]/32, [Link]/128 [Link]/32, [Link]/128
Loopback0 Loopback0
.2 [Link]/24 .1 .2 [Link]/30 .1 .1 [Link]/24 .2
::2 [Link]/64 ::1 ::1 [Link]/127 ::0 ::1 [Link]/64 ::2
GigabitEthernet7 GigabitEthernet6 GigabitEthernet6 GigabitEthernet7

AS64512 AS65000
H1 [Link]/8 R1 BGP Session ISP1 [Link]/13 S1
[Link]/32 [Link]/32

v1.2
BGP Network
• Prefixes are usually subnet or aggregate routes instead of
individual host routes.
• IPv4 prefixes longer than /24 and IPv6 prefixes longer than
/48 won’t generally be accepted on the Internet.
My BGP networks: My BGP networks:
• [Link]/8 (aggregation) • [Link]/13 (aggregation)
• [Link]/24 (subnet) • [Link]/24 (subnet)
• [Link]/32 (aggregation) • [Link]/32 (aggregation)
• [Link]/64 (subnet) • [Link]/64 (subnet)
[Link]/32, [Link]/128 [Link]/32, [Link]/128
Loopback0 Loopback0
.2 [Link]/24 .1 .2 [Link]/30 .1 .1 [Link]/24 .2
::2 [Link]/64 ::1 ::1 [Link]/127 ::0 ::1 [Link]/64 ::2
GigabitEthernet7 GigabitEthernet6 GigabitEthernet6 GigabitEthernet7

AS64512 AS65000
H1 [Link]/8 R1 BGP Session ISP1 [Link]/13 S1
[Link]/32 [Link]/32

v1.2
BGP Best Path
• Best path is the path that BGP selected to use in RIB.
• BGP uses path attributes to determine best path.
– Administrator influence the selection process by routing policy
– Best paths might not be the shortest path, but the most suitable path based on
the routing policy
• By default, BGP installs single best path for each destination.
• BGP propagates only the best path to the peers.
• BGP Multipath is a feature that allows BGP to install multiple best
paths when they have the same metrics.
– For load sharing over multiple next hops

v1.2
BGP Session Establishment
OPEN with 4-byte ASN Capability

NOTIFICATION: Unsupported Capabilities

AS65000 OPEN without Capability AS65001


KEEPALIVE

• Sends OPEN to peer after TCP three-way handshake.


• Peer replies NOTIFICATION if capabilities unsupported.
• Resends OPEN without unsupported capabilities.
• Peer replies KEEPALIVE if OPEN is acceptable.
• KEEPALIVE is sent periodically for maintaining the session.
v1.2
BGP Updates
Initial Full Update

AS65000 Subsequent Incremental Update AS65001

• Initial full update upon BGP session establishment.


• Subsequent incremental updates after initial full update.
– When new prefixes are being advertised
– When existing prefixes are being updated
– When existing prefixes are being withdrawn

v1.2
Route Refresh Capability
Route Refresh Request

AS65000 Full Update on Request AS65001

• Requests peer to resend full BGP update.


– RFC2918: Route Refresh Capability for BGP-4
• ROUTE-REFRESH message:
– AFI: Address Family Identifier
– Res.: Reserved field, set to 0 by the sender and ignored by the receiver
– SAFI: Subsequent Address Family Identifier

v1.2

You might also like