Skip to content
7LayerX

Routing / Field note

Introduction to BGP Messages & Neighbor States

Follow BGP OPEN, UPDATE, KEEPALIVE, and NOTIFICATION messages, then see how the six neighbor states build and maintain a session.

7LayerX Editorialupdated 7 min readBGP-4TCP
Session mapBGP-4 · TCP 179
EXAMPLE PEERING LINK
Technical illustration of two network systems connected by parallel signal paths

Local autonomous system

Edge Router A

AS 64512

192.0.2.1 · Router ID 192.0.2.1

eBGP · IPv4 unicast example

Remote autonomous system

Edge Router B

AS 64520

192.0.2.2 · Router ID 192.0.2.2

TYPE 01OPEN

The peers introduce themselves and propose the session parameters they support.

Both peers · after TCP connects

Example-only documentation addresses. Real peers need matching neighbor configuration, reachability, and policy on both sides. Open the interactive lab →

BGP neighbors do not exchange routes as soon as a cable comes up. First, they establish a reliable TCP connection. Then they exchange BGP messages to identify each other, agree on session details, and decide whether the session can reach the Established state.

This guide introduces the four core BGP-4 message types and the six neighbor states. The interactive lab lets you step through a normal session and inspect each message along the way.

Start with TCP, then speak BGP

BGP uses TCP port 179. TCP provides the ordered, reliable connection between peers; BGP uses that connection to exchange routing information and session control messages. A successful TCP connection is necessary, but it does not prove that the BGP session is configured correctly.

Every BGP message begins with a 19-octet header:

Header fieldSizePurpose
Marker16 octetsSupports message framing and compatibility; its exact use depends on the message and negotiated capabilities.
Length2 octetsGives the total message length, including the header.
Type1 octetIdentifies the message that follows.

The length includes the header. A message is at least 19 octets long. Most messages can be up to 4,096 octets; extended message support can allow larger messages when negotiated.

The four core BGP messages

MessageTypeWhat it doesWhen you will see it
OPEN1Starts a BGP conversation by identifying the speaker and proposing session parameters and capabilities.Each peer sends an OPEN after the TCP connection is established.
UPDATE2Advertises reachable routes, withdraws routes, or does both in one message.During initial route exchange and when reachability changes.
NOTIFICATION3Reports a BGP error and closes the BGP connection.When a speaker detects a protocol or session error.
KEEPALIVE4Confirms that the peer is still active when no other message has refreshed the hold timer.Periodically, unless the negotiated hold time is zero.

An UPDATE carries route information such as network-layer reachability and path attributes. It is not a periodic “I am alive” message. A valid UPDATE also resets the hold timer, so a separate KEEPALIVE is not required after every update.

Each peer proposes a hold time in its OPEN message. The session uses the lower of the two values. If that value is zero, the speakers do not send periodic KEEPALIVE messages and do not use the hold timer to detect a silent peer.

The optional ROUTE-REFRESH message has type 5. A peer can send it only when the Route Refresh capability was advertised and accepted. It asks a peer to resend routes for an address family without resetting the BGP session. It is an extension, not one of the four core messages in the original BGP-4 specification.

Follow the six neighbor states

The BGP finite state machine describes the progress of a peer relationship. A normal session does not necessarily visit every state in a straight line: Active is a retry state that can occur when a connection attempt does not complete.

StateWhat the speaker is doingWhat to check if it stays here
IdlePreparing or waiting to begin peer connection attempts.Peer configuration, administrative shutdown, and local policy.
ConnectWaiting for the TCP connection to complete.Peer address, route to the peer, source address, and TCP port 179 filtering.
ActiveRetrying or waiting for a TCP connection.Reachability in both directions, source/update-source settings, and firewall rules. Active does not by itself identify the cause.
OpenSentTCP is up; the local speaker has sent an OPEN and is waiting for the peer's OPEN.Remote peer configuration and OPEN errors in logs.
OpenConfirmThe OPEN exchange was accepted; the speaker is waiting for a KEEPALIVE from its peer.Notifications, negotiated timers, and whether the peer responds.
EstablishedThe peers can exchange BGP messages and routes for negotiated address families.Route counts, address-family activation, policy, and next-hop reachability.

In the usual startup sequence, each peer sends an OPEN after TCP is established. When a speaker accepts the other peer's OPEN, it sends a KEEPALIVE and enters OpenConfirm. Receiving the expected KEEPALIVE moves it to Established. UPDATE messages can then carry routes.

TCP connection
     ↓
Connect → OpenSent → OpenConfirm → Established
              OPEN        KEEPALIVE       UPDATEs
     ↖
  Active can be a retry path when TCP connection setup does not complete

The diagram is a learning model, not a promise that every implementation logs each transition in the same way. BGP timers, simultaneous connection attempts, and error handling can affect the observed sequence.

Follow a route with AS_PATH

An UPDATE can carry one or more path attributes alongside the advertised prefix. For eBGP, each speaker adds its own AS number to the front of AS_PATH when it advertises a route to an external peer. A route that starts in AS 64512 and crosses AS 64520 and AS 64530 can therefore arrive with 64530 64520 64512 in its path. These are private documentation ASNs used for the interactive example.

When a route returns to an AS that already appears in AS_PATH, that AS rejects the route to prevent a routing loop. Operators can also prepend their own AS number more than once to influence how some remote networks compare routes. This is a limited signal: it does not force a remote network to choose another path. Local preference and routing policy can take priority over AS_PATH length.

Use the route propagation visualizer above to step through the UPDATE, inspect the path at each hop, compare an alternate transit, and see prepending and loop rejection. It is a teaching simulation and does not connect to live routers.

Established does not mean routes are usable

Established means the BGP session is up. It does not guarantee that a peer advertised a route, that local policy accepted it, that BGP selected it as best, or that the forwarding table can reach its next hop.

When the state is Established but the expected prefix is missing, check address-family activation, inbound policy, received and accepted route counts, best-path selection, and next-hop reachability. Keep session health and route health as separate questions.

A practical first-check sequence

For Cisco IOS-style examples, these commands show the session summary and details for a peer. Command syntax and available output vary by platform and software version.

show ip bgp summary
show ip bgp neighbors 192.0.2.2
show ip route 192.0.2.2

Start by identifying the current state. If TCP is not established, investigate peer reachability and port 179 before changing route policy. If the state reaches Established, move on to address families, route advertisements, policy, and forwarding.

Try the BGP messages and neighbor states lab

Open the interactive BGP session lab to step through the state transitions, inspect a message at each point, and try common failure conditions. It is a simulator: it does not connect to a router or send packets.

For the wider picture, continue with BGP basics, then build an eBGP session. For a deeper troubleshooting workflow, read BGP neighbor troubleshooting.

Common questions about BGP messages and states

Quick answers about BGP session startup and route exchange.

3 answers

Does Established mean the routes are working?

No. It confirms that the BGP session can exchange messages. Check route advertisements, address-family settings, policy, best-path selection, and next-hop reachability separately.

Is Active always a failure state?

Not by itself. Active means the peer is trying to establish or re-establish TCP. If it stays there, check reachability, peer addresses, source settings, and filtering.

Is ROUTE-REFRESH one of the four core messages?

No. It is an extension defined separately. The peers must negotiate the Route Refresh capability before one sends a ROUTE-REFRESH message.

Learn more

Interactive lab

Maximize the lab for a focused, full-screen workspace.

02 / Protocol data units · RFC 4271

The Four Fundamental BGP Messages

Choose a message to see why a BGP speaker sends it and what the message carries.

01

BGP message type 01

OPEN

Introduce a BGP speaker

Each peer identifies itself and proposes the session settings and capabilities it supports.

Used

Sent by both peers after TCP connects.

Minimum size

29 octets minimum

Common BGP message header

19 octets · RFC 4271 §4.1

Marker

16 octets

Length

2 octets

Type

01

Message-specific fields

  • Version
  • My AS
  • Hold Time
  • BGP Identifier
  • Optional Parameters

OPEN message fields

Type 1 · 29 octets minimum
FieldSizeData typeMeaningExample value
Marker16 octetsBinaryMessage framing field; all bits are set to 1 in this example.FF × 16
Length2 octetsUnsigned 16-bitTotal message length including the 19-octet header.0x001D · 29 octets
Type1 octetUnsigned 8-bitIdentifies this as an OPEN message.0x01
Version1 octetUnsigned 8-bitBGP protocol version proposed by this speaker.0x04 · BGP-4
My Autonomous System2 octetsUnsigned 16-bitSender's two-octet AS number for this example.64512 · 0xFC00
Hold Time2 octetsUnsigned 16-bitProposed maximum seconds between successive KEEPALIVE or UPDATE messages.90 seconds · 0x005A
BGP Identifier4 octetsIPv4 address formatNonzero identifier for the BGP speaker.192.0.2.1 · 0xC0000201
Optional Parameters Length1 octetUnsigned 8-bitNumber of octets in the optional parameters that follow.0x00 · none in this minimal example

03 / Finite state machine · RFC 4271 §8

Watch the session form.

Follow the normal path at your pace. Active is shown separately because it is a retry path when TCP setup does not complete.

Session walkthrough

Normal session walkthrough

Current state

IDLE

BGP starts

The peer is configured and the speaker is ready to begin connection attempts.

Event log · example

%BGP: neighbor 192.0.2.2 is ready
EVENT 01 / 070% walkthrough

04 / Path vector · RFC 4271 §5.1.2

Follow a route across AS boundaries.

Step through UPDATE propagation and watch each eBGP speaker add its ASN. Explore an alternate, prepending, and loop-rejection example.

Primary route

Follow an UPDATE from its origin through two eBGP boundaries to the receiving AS.

eBGP · hop 1eBGP · hop 2eBGP · hop 3AS 64512Origin routerOrigin ASAS 64520Transit ATransit ASAS 64530Transit BTransit ASAS 64521Transit CAlternate ASAS 64531Transit DAlternate ASAS 64540DestinationReceiving AS

Diagram uses documentation-only private ASNs. Scroll horizontally on narrow screens to inspect the full route.

Route at current hop

1 / 3 hops
64512

AS_PATH = 64512

What this demonstrates

At AS 64520, the route has advanced 1 of 3 eBGP hops. The next eBGP advertisement prepends that speaker's ASN.

AS_PATH is one input to BGP route selection, not a universal shortest-path rule. Local preference, policy, route eligibility, and other decision steps can select a route with a longer AS_PATH. See RFC 4271, section 5.1.2.

05 / Field engineering · read the symptom

Start with the state. Verify the cause.

A state narrows the investigation, but it does not prove the root cause. Compare the peer details, reachability, and logs before making a change.

Diagnostic brief · Active

The peer keeps retrying TCP

Active is a retry state, not a diagnosis. Check the route to the configured peer address, the connection source address, TCP port 179 in both directions, and any multihop or authentication requirements in the design.

Example first check · Cisco IOS style

show ip route 192.0.2.2

NEXT CHECK

Test reachability from the configured source, then inspect firewall and peer logs.

06 / Terminal telemetry · illustrative output

Read the neighbor summary.

On many Cisco IOS-style summaries, the final column shows a prefix count when established and a state label while the session is not established.

edge-router#show ip bgp summary
NeighborASMsgRcvdMsgSentState / PfxRcd
192.0.2.26452024825124

Interpret carefully: the example shows 24 received prefixes when Established. A count of zero can also be valid if no routes are expected or accepted; verify the address family and route policy before calling it a fault. Output varies by vendor and software version.

Pass it along

Found this useful? Share it.

Choose a platform or copy the direct link.

LinkedInXFacebook

Continue reading

Reader signal

Was this useful?

Your feedback helps shape the next field note and lab.

… views

Views count when this page opens. You can change or remove your vote during this tab session.