Skip to content
7LayerX

Routing / Hands-on lab

Walk through BGP messages and neighbor states

Step through a simulated BGP session, inspect its core messages, and see how TCP or OPEN errors change the neighbor state.

beginnerBGP-4TCP
Before you start:Basic understanding of IP addresses and TCP connections

Lab goal

Follow a BGP peer relationship from the first TCP connection through the exchange of OPEN and KEEPALIVE messages. Then inspect how common connection and peer-identity problems affect the state machine.

Before you start

  • This lab is a browser-based simulation. It does not connect to a router or send network traffic.
  • The peer addresses and AS numbers are documentation examples.
  • A normal session does not have to pass through Active. Active is an alternate retry state when TCP connection setup does not complete.

Explore the session

Select a state or message to inspect it. Use Next event to advance the normal startup exchange. Use the failure controls to see a TCP retry or an OPEN error.

Interactive lab

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

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 →

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.

What to notice

  1. TCP port 179 carries BGP, but a working TCP connection alone does not establish a BGP session.
  2. Each peer sends an OPEN. A peer that accepts the other OPEN sends a KEEPALIVE and waits for the peer's KEEPALIVE.
  3. In Established, peers can exchange UPDATE messages. The state does not prove that any route was received, accepted, selected, or installed.
  4. A NOTIFICATION reports a BGP error and closes the session. Check the notification and the event that caused it instead of treating every reset as a TCP problem.
  5. At each eBGP hop, the advertising speaker prepends its ASN to AS_PATH. A receiving AS rejects a path containing its own ASN; prepending can influence remote routing but cannot override every policy.

Verify on a router

On Cisco IOS-style platforms, these commands provide a starting point. Confirm syntax for your device and software version before using commands in a live network.

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

Compare the observed neighbor state with peer reachability and the latest BGP log message. If the neighbor is Established but the expected route is absent, continue with address-family activation and route-policy checks.

Success criteria

  • Explain what OPEN, UPDATE, KEEPALIVE, and NOTIFICATION do.
  • Put the six neighbor states in context and explain why Active is an alternate retry state.
  • Separate session health from route availability.

Continue learning

If you are new to BGP, start with BGP basics. Then read Introduction to BGP Messages & Neighbor States, followed by the BGP neighbor troubleshooting guide.

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.