BGP Message Types: OPEN, UPDATE, NOTIFICATION Byte by Byte

BGP message types byte by byte: OPEN, UPDATE, KEEPALIVE, NOTIFICATION and ROUTE-REFRESH decoded from real captures

A new peering session reaches OpenSent, drops back to Idle, and the log says only NOTIFICATION 2/2. Another session has been fine for months and then dies at 03:00 with 4/0. A third one never fails, but after every policy change someone types clear ip bgp * soft and hopes. All three cases come down to the five BGP message types: OPEN, UPDATE, KEEPALIVE, NOTIFICATION and ROUTE-REFRESH. This is part 3 of our 26-part BGP Deep Dive. Here we read each message byte by byte from real captures: a 2000 sample, Cisco IOS from 2008, an NTT shutdown message from 2016 and FRRouting from 2022. Then we build a GoBGP 4.11 lab with a hand-written Python BGP speaker and break the session on purpose to see exactly which NOTIFICATION comes back.

TL;DR
  • One header for all: 16 bytes of 0xff, a 2-byte length (19 to 4,096, or 65,535 with Extended Message) and a 1-byte type.[1][10] A KEEPALIVE is that header and nothing else.
  • OPEN carries the version, AS, hold time, BGP Identifier and capabilities. The hold time used is the lower of the two offers, and it must be 0 or at least 3 seconds.[1][2] GoBGP's OPEN in our lab carried six capabilities in 70 bytes; FRR's carried ten in 100 bytes.
  • UPDATE = withdrawn routes + path attributes + NLRI. An empty one (23 bytes) is the End-of-RIB marker.[12] Other address families travel inside MP_REACH_NLRI and MP_UNREACH_NLRI.[3]
  • NOTIFICATION = error code, subcode, data, then the TCP session closes. We triggered 2/2, 2/6, 1/1, 1/2, 1/3, 4/0 and 6/2 in our lab, and saw a malformed ORIGIN handled as treat-as-withdraw without a reset.[9][19]
  • ROUTE-REFRESH asks the peer to resend its routes for one AFI/SAFI. RFC 7313 turns the reserved byte into a subtype: BoRR and EoRR mark the start and end of the refresh.[5][6]

Why BGP message types matter for troubleshooting

BGP runs over TCP port 179 and has no hello protocol of its own, no flooding and no periodic refresh. Everything the two peers ever tell each other travels as one of five message types, defined in RFC 4271 and in RFC 2918 for ROUTE-REFRESH.[1][5] IANA still lists exactly those five; values 6 to 255 are unassigned.[15] So most BGP questions can be answered from the messages: why a session will not start (OPEN and NOTIFICATION), why it drops (KEEPALIVE and the hold timer), why a route is missing or wrong (UPDATE), and how to apply a new policy without a reset (ROUTE-REFRESH). Show commands give you the router's interpretation. A packet capture shows what was actually sent.

Our blog covered this topic in 2011 in a short post, BGP Message Types. This article goes much deeper: the exact byte layout of every field, how the format has changed since 2006 (capabilities, 4-byte ASNs, Extended Message, Extended Optional Parameters, Shutdown Communication, revised error handling, enhanced route refresh), and real captures for each message.

Every BGP message starts with the same three fields:[1]

  • Marker (16 bytes). RFC 4271 says it "MUST be set to all ones". In the older BGP-4 specification, RFC 1771 (1995), the marker could carry authentication data.[20] That was dropped, and today the marker only helps a receiver check that it is still aligned to message boundaries in the TCP stream. A receiver that sees anything else sends NOTIFICATION 1/1 Connection Not Synchronized, as our lab shows below.
  • Length (2 bytes). The total message length including the header, between 19 and 4,096 bytes. RFC 8654 (2019) adds the Extended Message capability (code 6). When both peers advertise it, every message except OPEN and KEEPALIVE may be up to 65,535 bytes.[10] That matters for large BGP-LS, EVPN or BGPsec updates. GoBGP 4.11 and FRR both advertised capability 6 in our captures.
  • Type (1 byte). 1 OPEN, 2 UPDATE, 3 NOTIFICATION, 4 KEEPALIVE, 5 ROUTE-REFRESH.

TCP is a byte stream, so a BGP receiver reads 19 bytes, takes the length from them, and then reads the rest of the message. Several messages often share one TCP segment. In the Cisco captures an OPEN and a KEEPALIVE arrived in the same 64-byte segment, and our decoder has to split them by length, just as a router does. The minimum lengths also work as sanity checks: OPEN at least 29 bytes, UPDATE at least 23, NOTIFICATION at least 21, KEEPALIVE exactly 19.[1]

BGP message header format: 16-byte marker, 2-byte length, 1-byte type, and the five BGP message types with minimum lengths
Figure 1. The common BGP header and the five message types. A KEEPALIVE is just the 19-byte header. Sources: RFC 4271, RFC 2918, RFC 8654, IANA.

OPEN: who I am and what I can do

When the TCP connection is up, each side sends an OPEN.[1] After the header come six fields:

FieldSizeMeaning and rules
Version14. A mismatch gives NOTIFICATION 2/1 Unsupported Version Number.
My Autonomous System2The sender's AS. A speaker with a 4-byte ASN puts AS_TRANS 23456 here and the real number in capability 65.[4] If the AS does not match the configured remote AS, the result is 2/2 Bad Peer AS.
Hold Time2Proposed hold time in seconds. The session uses the smaller of the two values. It "MUST be either zero or at least three seconds". Zero means no keepalives at all. A value of 1 or 2 gives 2/6 Unacceptable Hold Time.
BGP Identifier4The router ID, an IPv4-formatted 32-bit number. A bad value gives 2/3 Bad BGP Identifier. It also decides connection collisions.
Opt. Parm. Len1Length of the optional parameters, 0 to 255.
Optional Parametersvar.Type-length-value triplets. Type 2 = Capabilities (RFC 5492); type 1 (authentication) is deprecated.[2][15]

The oldest capture we decoded, the Wireshark sample bgp.pcap from March 2000, shows an OPEN in its original form: 29 bytes, AS 65033, hold time 180 and Opt. Parm. Len 0, so no capabilities at all.[16] Every newer capture uses capabilities, and that is where the protocol has changed most since then.

Capabilities: how BGP negotiates features

RFC 5492 puts a list of capabilities inside optional parameter type 2. Each capability is a code (1 byte), a length (1 byte) and a value.[2] A feature is used only if both peers advertise it. If a speaker requires a capability that the peer does not support, it can refuse the session with NOTIFICATION 2/7 Unsupported Capability. The important codes are multiprotocol (1, an AFI/SAFI pair per capability), route refresh (2), 4-octet AS (65), graceful restart (64), ADD-PATH (69) and enhanced route refresh (70).[3][4][5][6][12][13]

Figure 2 shows the 70-byte OPEN that GoBGP 4.11 sent to our Python peer. Note the 13-byte capability 73: GoBGP advertised the lab host's name, CLAUDE-BOSS. That is the FQDN capability, which IANA lists with a reference to an individual draft (draft-walton-bgp-hostname-capability), not an RFC.[15] FRR sends it too; in the 2022 Wireshark sample its value is ubuntu01. It helps operators, but every peer, and anyone with a capture, learns your router's hostname.

Real BGP OPEN message from GoBGP decoded byte by byte: version 4, My AS 65001, hold time 90, BGP identifier and six capabilities
Figure 2. A real OPEN message sent by GoBGP 4.11, decoded byte by byte. GoBGP 4.11 lab output, 28 Nov 2026.

The Opt. Parm. Len field is a single byte, so all optional parameters together are limited to 255 bytes. FRR's 100-byte OPEN already uses 71 of them. With many AFI/SAFIs, ADD-PATH and graceful-restart entries the list can outgrow that limit, so RFC 9072 (2021) defines an escape: Opt. Parm. Len = 255, then a parameter type of 255, then a 2-byte length.[11] FRR switches to this format automatically when it needs it, and its neighbor PEER extended-optional-parameters command forces it for testing.[18]

BGP capabilities advertised in real OPEN messages by Cisco IOS 2008, FRRouting 2022, GoBGP 4.11 and older speakers
Figure 3. Capabilities seen in real OPEN messages from 2000 to 2026, decoded by us from Wireshark and packetlife.net captures and our GoBGP lab.

Figure 3 shows how the OPEN has grown. The 2008 Cisco IOS OPEN (45 bytes) advertised only IPv4 unicast, standard route refresh (2) and Cisco's pre-standard route refresh (128), which IANA now marks deprecated.[15][17] The 2022 FRR OPEN adds 4-octet AS, Extended Message, ADD-PATH, FQDN, graceful restart and long-lived graceful restart. In the FRR capture both sides offered hold time 180 and sent keepalives exactly every 60.0 seconds.

Hold time and keepalive negotiation in the lab

Our Python peer offered hold time 9. GoBGP was configured for 90 s with a 30 s keepalive. GoBGP accepted the lower value, and gobgp neighbor 127.0.2.32 showed:

  Hold time is 9, keepalive interval is 3 seconds
  Configured hold time is 90, keepalive interval is 30 seconds

GoBGP sent its KEEPALIVEs at 3.002, 6.004 and 9.001 seconds, which is a third of the negotiated hold time as RFC 4271 suggests. A peer that offered 2 seconds got NOTIFICATION 2/6 straight away. RFC 4271 suggests a default hold time of 90 s, while the Cisco and FRR captures both use 180 s with 60 s keepalives, so mixed-vendor sessions often run on the lower value without anyone noticing.[1]

KEEPALIVE: 19 bytes that keep the session alive

A KEEPALIVE has no body. It does two things. During setup, the first KEEPALIVE confirms the peer's OPEN and moves the FSM from OpenConfirm to Established. After that, keepalives keep the peer's hold timer from expiring. RFC 4271: "A reasonable maximum time between KEEPALIVE messages would be one third of the Hold Time interval. KEEPALIVE messages MUST NOT be sent more frequently than one per second."[1] UPDATEs also reset the hold timer, so a busy session needs fewer keepalives. If the hold time is 0, no keepalives are sent at all.

Real timing from the captures: FRRouting in 2022 sent keepalives every 60.00 s in both directions (18 intervals measured). Cisco IOS in 2008 sent them every 59.97 to 60.02 s once the session was stable. Shortly after session setup the Cisco intervals were irregular: 25.0 s and 35.0 s in one capture, 30.1 s and 30.0 s in another, before settling at 60 s.[16][17]

The hold timer protects against a peer that has gone silent. To test it, we opened a session with hold time 3 and then sent nothing after the first KEEPALIVE. GoBGP sent keepalives at 1.001 and 2.002 s, and at 3.001 s it sent NOTIFICATION 4/0 Hold Timer Expired and logged hold timer expired. The opposite problem, a peer that keeps the TCP connection open but stops reading so that our messages cannot be sent, is covered by RFC 9687 (2024). It adds a Send Hold Timer and a new error code 8, Send Hold Timer Expired.[14][15]

UPDATE: announcing and withdrawing routes

All routing information travels in UPDATE messages. The body has five parts:[1]

  1. Withdrawn Routes Length (2 bytes) and Withdrawn Routes: prefixes that are no longer reachable.
  2. Total Path Attribute Length (2 bytes) and Path Attributes: one set of attributes (ORIGIN, AS_PATH, NEXT_HOP and so on) that applies to every prefix in this message.
  3. NLRI: the prefixes being announced, filling the rest of the message.

Prefixes are packed tightly: one length byte, then only as many address bytes as the length needs. A /24 takes 3 bytes, a /30 takes 4 and 0.0.0.0/0 takes none. Because the attributes are shared, a router groups prefixes with the same attributes into one UPDATE. In the 2008 Cisco capture one 60-byte UPDATE carried 10.10.1.0/24, 10.10.2.0/24 and 10.10.3.0/24, and the next one carried two /30s that had a different ORIGIN.[17]

Real BGP UPDATE message decoded byte by byte: withdrawn routes length, ORIGIN, AS_PATH, NEXT_HOP, COMMUNITIES, NLRI and attribute flag bits
Figure 4. A real 54-byte UPDATE from GoBGP 4.11 with four path attributes and one prefix, plus the attribute flag bits. GoBGP 4.11 lab output, 28 Nov 2026.

Each attribute begins with a flags byte (Figure 4). The O bit says optional or well-known, T says transitive, P says partial (some router on the path did not recognise this optional transitive attribute), and E says the length field is 2 bytes instead of 1. The real captures show that implementations use E differently: FRR sets 0x50 on AS_PATH even for a 6-byte path, while GoBGP and Cisco use 0x40 with a 1-byte length. Both are valid. Each attribute gets its own article later in this series; here we only need the format.

MP_REACH_NLRI, End-of-RIB and ADD-PATH

The classic NLRI and NEXT_HOP fields can only carry IPv4. Every other address family (IPv6, VPNv4, EVPN, flowspec and so on) is carried in two optional attributes from RFC 4760: MP_REACH_NLRI (type 14: AFI, SAFI, next hop and prefixes) and MP_UNREACH_NLRI (type 15: withdrawals).[3] In the packetlife.net capture BGP_MP_NLRI.cap the IPv6 UPDATE is 108 bytes long with an empty classic NLRI field. All of its routes are inside attribute 14, flagged 0x80 (optional, non-transitive).[17]

An UPDATE with no withdrawn routes and no attributes, just 23 bytes, is the End-of-RIB marker of RFC 4724. It tells the peer that the initial table transfer is complete.[12] For other address families it is an UPDATE that contains only an empty MP_UNREACH_NLRI for that AFI/SAFI. In the 2022 sample both FRR routers sent the 23-byte marker about 1.1 s after the TCP connection opened. GoBGP did not send one to our peer, which had not advertised graceful restart. Our Python peer sent one to GoBGP. Do not rely on End-of-RIB unless the capability is negotiated.

ADD-PATH (RFC 7911, capability 69) lets a speaker send several paths for the same prefix. It puts a 4-byte Path Identifier in front of every prefix.[13] That changes the NLRI encoding, so a decoder that does not know ADD-PATH was negotiated will misread the prefixes. Our own decoder did exactly that on bgp-add-path.cap until we taught it about the path ID. Wireshark has the same problem when a capture starts after the OPEN.

NOTIFICATION: the error report that ends the session

A NOTIFICATION is the header plus an error code (1 byte), an error subcode (1 byte) and data of variable length. After sending it, the speaker closes the TCP connection.[1] The codes registered by IANA are:[15]

CodeNameTypical subcodes
1Message Header Error1 Connection Not Synchronized, 2 Bad Message Length, 3 Bad Message Type
2OPEN Message Error1 Unsupported Version, 2 Bad Peer AS, 3 Bad BGP Identifier, 4 Unsupported Optional Parameter, 6 Unacceptable Hold Time, 7 Unsupported Capability, 11 Role Mismatch
3UPDATE Message Error1 Malformed Attribute List ... 11 Malformed AS_PATH (now mostly handled per RFC 7606)
4Hold Timer Expirednone
5Finite State Machine Errorunexpected message in the current state
6Cease1 Max Prefixes, 2 Administrative Shutdown, 3 Peer De-configured, 4 Administrative Reset, 5 Connection Rejected, 6 Other Configuration Change, 7 Connection Collision Resolution, 8 Out of Resources, 9 Hard Reset, 10 BFD Down
7ROUTE-REFRESH Message Error1 Invalid Message Length (RFC 7313)
8Send Hold Timer ExpiredRFC 9687 (2024)
9Loss of LSDB SynchronizationRFC 9815

The Cease subcodes come from RFC 4486, with Hard Reset added by RFC 8538.[8] Cease 1 is what you see when a maximum-prefix limit trips (see BGP Max-Prefix and Prefix-Limit). Cease 10, BFD Down (RFC 9384), lets a session protected by BFD say why it went down (see BGP Convergence Explained).

Real NOTIFICATIONs from a lab where we broke things on purpose

We ran one GoBGP 4.11 router (AS 65001) with eight passive neighbours. A Python script played each neighbour and sent one deliberately wrong message per session. Figure 5 shows what came back. GoBGP's log confirms each case, for example:

level=INFO msg="sent notification" Key=127.0.2.33 State=BGP_FSM_OPENSENT Code=2 Subcode=2 Data=""
level=WARN msg="Session will be reset due to malformed BGP Header" Key=127.0.2.35 Error="marker is not all ones"
level=INFO msg="sent notification" Key=127.0.2.36 State=BGP_FSM_OPENSENT Code=1 Subcode=2 Data="\x00\x12"
level=INFO msg="sent notification" Key=127.0.2.37 State=BGP_FSM_ESTABLISHED Code=1 Subcode=3 Data="\t"
level=WARN msg="hold timer expired" Key=127.0.2.38 State=BGP_FSM_ESTABLISHED
level=WARN msg="the received Update message was treated as withdraw" Key=127.0.2.39 Error="invalid origin attribute. value : 7"
Real BGP NOTIFICATION error codes from a GoBGP lab: bad peer AS, unacceptable hold time, bad marker, bad length, bad type, hold timer expired, Cease
Figure 5. NOTIFICATIONs returned by GoBGP 4.11 to deliberately broken messages from our Python peer, 28 Nov 2026 05:04-05:05 CET.

Three details are worth noting. First, the data field follows RFC 4271: for Bad Message Length GoBGP returned the bad length (00 12 = 18), and for Bad Message Type it returned the type (09; Go prints it as \t). Second, implementations differ on optional data. For Bad Peer AS GoBGP sent no data, but the Cisco IOS router in the 2008 packetlife.net capture BGP_notification.cap replied to an OPEN from AS 65200 with 03 02 02 fe b0: type 3, then 2/2, then the rejected AS 65200 as data. The NOTIFICATION came back 16 ms after the OPEN.[17] Third, the last case shows RFC 7606 at work. Under the original RFC 4271 rules an invalid ORIGIN meant NOTIFICATION 3/6 and a session reset, so one bad route took down every route on the session. RFC 7606 says that "an UPDATE message with a malformed ORIGIN attribute SHALL be handled using the approach of treat-as-withdraw".[9] That is what GoBGP did: 198.18.0.0/24 disappeared from the RIB, and the session and the other routes stayed up.

Shutdown Communication: leaving a message for the other NOC

Cease 2 (Administrative Shutdown) and 4 (Administrative Reset) can carry a human-readable text: one length byte, then UTF-8. RFC 8203 (2017) allowed up to 128 bytes; RFC 9003 (2021) raised the limit to 255.[7] The Wireshark sample bgp_shutdown_communication.pcap (November 2016) contains a real one, 146 bytes on the wire with a 124-byte text:[16]

NOTIFICATION code 6 (Cease) subcode 2 (Administrative Shutdown), length 0x7c = 124:
"NTT will perform maintenance on this router. This is tracked in TICKET-1-24824294.
 Contact noc@ntt.net for more information."

We sent our own through GoBGP with gobgp neighbor 127.0.2.32 shutdown --reason "Maintenance TICKET-1234, back 06:00 UTC". GoBGP printed that shutdown is deprecated in favour of disable, and our peer received a 61-byte NOTIFICATION: type 03, code 06, subcode 02, length 27 (39), then 39 bytes of text. In FRR, neighbor PEER shutdown message MSG does the same.[18] If you have a ticket number, put it in the message: the other side's NOC sees it in their logs.

ROUTE-REFRESH: asking for the routes again

When you change inbound policy, the router needs the routes it received before filtering. Before 2000 there were two options: reset the session, or keep an unfiltered copy of everything the peer sent (soft-reconfiguration inbound). RFC 2918 added a third: send the peer a ROUTE-REFRESH message (type 5) and it sends its Adj-RIB-Out for that address family again.[5] The message is always 23 bytes: header, AFI (2 bytes), a reserved byte and SAFI (1 byte). It may only be sent if the peer advertised capability 2.

RFC 2918 has a gap: the receiver cannot tell when the refresh is finished, so it cannot safely delete routes that the peer did not send again. RFC 7313 (2014) fixes this with capability 70 and turns the reserved byte into a message subtype: 0 = normal request, 1 = BoRR (Beginning of Route Refresh), 2 = EoRR (End of Route Refresh).[6] The refreshing speaker sends BoRR, then its routes, then EoRR. The receiver marks its old routes stale at BoRR and deletes any still stale at EoRR. FRR uses its bgp graceful-restart stalepath-time as the timer if the EoRR never arrives.[18]

BGP ROUTE-REFRESH message format: plain RFC 2918 route refresh vs enhanced route refresh with BoRR and EoRR in real captures
Figure 6. ROUTE-REFRESH in three real captures: plain RFC 2918 (Cisco IOS, 2008), enhanced RFC 7313 with BoRR/EoRR (2013) and our GoBGP 4.11 lab.

The captures show all three variants (Figure 6):

  • Cisco IOS, 2008 (BGP_soft_reset.cap): 1.1.1.1 sent 05 | 00 01 | 00 | 01 at t = 77.177 s. 2.2.2.2 answered with its 6 UPDATEs at 77.185 s, 8 ms later. Both routers also re-sent their own UPDATEs, which is what a soft clear in both directions does.[17]
  • Enhanced refresh, 2013 (bgp-add-path.cap, iBGP in AS 64512, both sides advertising capabilities 69 and 70): BoRR (subtype 1), the UPDATEs, EoRR (subtype 2) and an End-of-RIB, all within 2 ms after the session came up.[17]
  • GoBGP 4.11, our lab: our Python peer advertised capability 70, but GoBGP did not, so enhanced refresh was not negotiated. Our plain ROUTE-REFRESH at 8.001 s brought back both UPDATEs within 1 ms, with no BoRR, no EoRR and no End-of-RIB. Then we ran gobgp neighbor 127.0.2.32 softresetin. No ROUTE-REFRESH appeared on the wire in the next three seconds, so in this test GoBGP re-applied inbound policy from the routes it had already stored. Do not assume that every implementation's 'soft in' sends a refresh: check it with a capture.

RFC 5291 (Outbound Route Filtering) reuses the same message type to send prefix filters to the peer. It gets its own article later in this series.

One session from start to finish

Figure 7 puts all of this together. These are the messages of one session between our Python peer and GoBGP, with timestamps from our capture. The order is the one RFC 4271 specifies: OPEN in both directions, a KEEPALIVE to confirm each OPEN, then UPDATEs. Our peer sent a second KEEPALIVE in reply to GoBGP's first one, which is harmless. After that come keepalives every 3 s, our refresh request and finally the Cease. The FSM states behind these steps (Idle, Connect, Active, OpenSent, OpenConfirm, Established) are the subject of part 4.

BGP message sequence from a real GoBGP lab: OPEN, KEEPALIVE, UPDATE, End-of-RIB, ROUTE-REFRESH and a Cease NOTIFICATION with timestamps
Figure 7. One real BGP session, message by message, between our Python peer and GoBGP 4.11 (28 Nov 2026, 05:04 CET).

The FRR capture shows the setup phase from the other side. For 4.6 minutes, every SYN to port 179 got a TCP RST, at intervals of exactly 120 s: 0.0, 120.0, 240.0 s. That interval is the ConnectRetryTime default that RFC 4271 suggests.[1][16] When the peer came up, the SYN came from the other side. OPEN, KEEPALIVE, UPDATEs and End-of-RIB followed within 1.2 s. In the Cisco BGP_hard_reset.cap, by contrast, the routes arrived 30.1 s after the OPENs, although in the first session setup (EBGP_adjacency.cap) they followed 24 ms after the first OPEN. The capture alone does not tell us why. When routes are slow after a reset, look at the gap between OPEN and the first UPDATE before you blame the network.[17]

How we built the lab

GoBGP needs no root: it listens on a high port on a loopback address. One router, r1 (AS 65001, 127.0.2.31, port 10179), had eight passive neighbours 127.0.2.32-39. A short Python script opened a TCP connection from each of those source addresses and wrote BGP messages by hand with struct.pack. Everything sent and received was logged with timestamps and hex. The OPEN it sends:

caps = bytes([1, 4, 0, 1, 0, 1])            # MP: AFI 1, SAFI 1
caps += bytes([2, 0])                        # Route Refresh
caps += bytes([65, 4]) + struct.pack('!I', asn)   # 4-octet AS
opt = bytes([2, len(caps)]) + caps           # optional parameter type 2 = Capabilities
body = struct.pack('!BHH4sB', 4, asn, hold, socket.inet_aton(router_id), len(opt)) + opt
msg = b'\xff' * 16 + struct.pack('!HB', 19 + len(body), 1) + body   # header: marker, length, type 1

The neighbour configuration on r1 (GoBGP TOML):

[global.config]
  as = 65001
  router-id = "10.0.0.31"
  port = 10179
  local-address-list = ["127.0.2.31"]
[[neighbors]]
  [neighbors.config]
    neighbor-address = "127.0.2.32"
    peer-as = 65002
  [neighbors.transport.config]
    passive-mode = true
    local-address = "127.0.2.31"
  [neighbors.timers.config]
    hold-time = 90
    keepalive-interval = 30

The RIB on r1 in the treat-as-withdraw test, before and after our UPDATE with ORIGIN 7 (GoBGP 4.11 lab output):

$ gobgp global rib -a ipv4          # after a valid UPDATE from 127.0.2.39
   Network              Next Hop             AS_PATH              Age        Attrs
*> 198.18.0.0/24        127.0.2.39           65009                00:00:01   [{Origin: i}]
*> 198.51.100.0/24      0.0.0.0                                   00:01:00   [{Origin: i}]
*> 203.0.113.0/24       0.0.0.0                                   00:01:00   [{Origin: i} {Communities: 65001:100}]

$ gobgp global rib -a ipv4          # 4 s after the same prefix with ORIGIN = 7
   Network              Next Hop             AS_PATH              Age        Attrs
*> 198.51.100.0/24      0.0.0.0                                   00:01:04   [{Origin: i}]
*> 203.0.113.0/24       0.0.0.0                                   00:01:04   [{Origin: i} {Communities: 65001:100}]

The session to 127.0.2.39 stayed up: no NOTIFICATION reached our peer in the 4 seconds we waited.

The same decoder read the ten public capture files. It reassembles each TCP direction, skips retransmissions, strips Ethernet padding (the 2008 captures pad short frames to 60 bytes, which at first looked like six extra bytes of BGP) and splits the stream into messages by the length field.

Capturing and reading BGP messages yourself

On a Linux router (FRR, a container lab, a route server) or a SPAN port:

# capture only BGP, full packets
tcpdump -ni eth0 -s0 -w bgp.pcap 'tcp port 179'

# Wireshark display filters
bgp                     # all BGP messages
bgp.type == 3           # NOTIFICATION only
bgp.type == 5           # ROUTE-REFRESH only

Three practical warnings. If the session uses TCP MD5 or TCP-AO, the capture still decodes, because neither one encrypts the payload. If the capture starts after the OPEN, the decoder does not know whether 4-byte AS or ADD-PATH was negotiated and may decode AS_PATH or NLRI wrongly. And one TCP segment can hold several BGP messages, while one large UPDATE can span several segments, so count messages, not packets.

Configuration examples for the knobs discussed above (syntax from the vendor documentation; we ran only the GoBGP commands):

! FRR: timers, shutdown with a message, soft refresh in
router bgp 64500
 neighbor 192.0.2.1 remote-as 64511
 neighbor 192.0.2.1 timers 10 30
 neighbor 192.0.2.1 shutdown message "Maintenance CHG-1234, back 02:00 UTC"
!
clear bgp 192.0.2.1 soft in          ! uses ROUTE-REFRESH if the peer supports it

! Cisco IOS / IOS XE
router bgp 64500
 neighbor 192.0.2.1 timers 10 30
!
clear ip bgp 192.0.2.1 soft in
show ip bgp neighbors 192.0.2.1 | include Hold time|Route refresh|Notification

# Junos
set protocols bgp group upstream hold-time 30

FRR's documentation adds that soft-reconfiguration inbound is still needed for features that must count every received prefix, including filtered ones, such as maximum-prefix ... force. Otherwise route refresh is enough when both sides support it.[18]

Common mistakes and how to read them

SymptomMessage evidenceLikely cause and fix
Session goes OpenSent -> Idle immediatelyNOTIFICATION 2/2, data = the peer's ASremote-as typo, or a 4-byte ASN peer showing 23456 to a speaker without 4-byte AS support
Session never reaches Established, 2/6Hold Time 1 or 2 in an OPENTimer too aggressive: use BFD for fast failure detection instead
Session refused, 2/7 or 2/11Unsupported Capability / Role MismatchA required capability (or BGP Role, RFC 9234) is missing on one side
Session drops every few minutes, 4/0No KEEPALIVE or UPDATE within the hold timeCPU starvation, MTU/PMTUD black hole for large UPDATEs, policer on TCP 179
Session drops, peer logs 3/xMalformed attributeA peer without RFC 7606 support; ask for the hex of the bad UPDATE
Session dropped by "the other side" with a text6/2 or 6/4 with Shutdown CommunicationRead the text: it is often a ticket number
Session drops after a leak6/1 Maximum Number of Prefixes ReachedMax-prefix tripped. See our max-prefix guide
Session stuck in Active, no BGP messages at allTCP SYN then RST, every ConnectRetry intervalNobody listening or the wrong source address: BGP Active state troubleshooting
Stale routes after a policy changeNo ROUTE-REFRESH sent, or no EoRRCheck capability 2/70 in both OPENs; use soft in, not a hard reset

When the session is Established but routes are missing, the messages are fine and the problem is in policy or next-hop resolution. Our guide BGP Troubleshooting: Established but No Routes covers that case. The 2011 posts BGP Message Types and BGP Neighbor States are the short originals of this article and the next one.

FAQ

What are the five BGP message types?

OPEN (type 1) starts the session and carries capabilities, UPDATE (2) announces and withdraws routes, NOTIFICATION (3) reports an error and closes the session, KEEPALIVE (4) confirms the OPEN and keeps the hold timer alive, and ROUTE-REFRESH (5, RFC 2918) asks a peer to send its routes again. All five share the same 19-byte header.

How big can a BGP message be?

RFC 4271 allows 19 to 4,096 bytes. If both peers advertise the Extended Message capability (code 6, RFC 8654), every message except OPEN and KEEPALIVE may be up to 65,535 bytes. The smallest message is a KEEPALIVE: the header alone, 19 bytes.

How are the BGP hold time and keepalive interval negotiated?

Each OPEN carries a Hold Time. The session uses the smaller of the two values, which must be 0 or at least 3 seconds. Keepalives are normally sent every third of the hold time and never more than once per second. In our lab a peer offered 9 s against GoBGP's 90 s, and GoBGP switched to a 3-second keepalive.

What does BGP NOTIFICATION code 6 subcode 2 mean?

Cease / Administrative Shutdown: an operator shut the session down on purpose. Since RFC 8203 (2017) and RFC 9003 (2021) the message can carry a UTF-8 text of up to 255 bytes, for example a maintenance ticket number. The real NTT capture in this article carries a 124-byte text.

What is the difference between soft reconfiguration inbound and route refresh?

Soft reconfiguration inbound stores an unmodified copy of everything a peer sent, so the router can re-run inbound policy locally at the cost of memory. Route refresh (RFC 2918) keeps no copy: the router sends a ROUTE-REFRESH message and the peer sends its routes again. Enhanced route refresh (RFC 7313) adds BoRR and EoRR markers so stale routes can be removed safely.

What is a BGP End-of-RIB marker?

An UPDATE with no withdrawn routes and no path attributes, 23 bytes long for IPv4 unicast (RFC 4724). It tells the peer that the initial table transfer is complete. FRRouting sent it in the Wireshark sample capture; GoBGP did not send one to our peer, which had not negotiated graceful restart.

Does a malformed UPDATE always reset the BGP session?

Not any more. RFC 7606 replaced the old 'send NOTIFICATION and reset' rule for most attribute errors with treat-as-withdraw or attribute discard. In our lab an UPDATE with ORIGIN value 7 made GoBGP withdraw the route and keep the session up.

References (all read on 28 November 2026)
[1] Y. Rekhter, T. Li, S. Hares (eds.), "RFC 4271: A Border Gateway Protocol 4 (BGP-4)," January 2006: sections 4.1-4.5, 6, 8, 10.
[2] J. Scudder, R. Chandra, "RFC 5492: Capabilities Advertisement with BGP-4," February 2009.
[3] T. Bates, R. Chandra, D. Katz, Y. Rekhter, "RFC 4760: Multiprotocol Extensions for BGP-4," January 2007.
[4] Q. Vohra, E. Chen, "RFC 6793: BGP Support for Four-Octet Autonomous System (AS) Number Space," December 2012.
[5] E. Chen, "RFC 2918: Route Refresh Capability for BGP-4," September 2000.
[6] K. Patel, E. Chen, B. Venkatachalapathy, "RFC 7313: Enhanced Route Refresh Capability for BGP-4," July 2014.
[7] J. Snijders, J. Heitz, J. Scudder, "RFC 8203: BGP Administrative Shutdown Communication," July 2017; J. Snijders, J. Heitz, J. Scudder, A. Azimov, "RFC 9003: Extended BGP Administrative Shutdown Communication," January 2021.
[8] E. Chen, V. Gillet, "RFC 4486: Subcodes for BGP Cease Notification Message," April 2006; K. Patel et al., "RFC 8538: Notification Message Support for BGP Graceful Restart," March 2019.
[9] E. Chen, J. Scudder, P. Mohapatra, K. Patel, "RFC 7606: Revised Error Handling for BGP UPDATE Messages," August 2015, section 7.1.
[10] R. Bush, K. Patel, D. Ward, "RFC 8654: Extended Message Support for BGP," October 2019.
[11] E. Chen, J. Scudder, "RFC 9072: Extended Optional Parameters Length for BGP OPEN Message," July 2021.
[12] S. Sangli et al., "RFC 4724: Graceful Restart Mechanism for BGP," January 2007, section 2 (End-of-RIB).
[13] D. Walton, A. Retana, E. Chen, J. Scudder, "RFC 7911: Advertisement of Multiple Paths in BGP," July 2016.
[14] J. Snijders, B. Cartwright-Cox, Y. Qu, "RFC 9687: Border Gateway Protocol 4 (BGP-4) Send Hold Timer," November 2024.
[15] IANA, "Border Gateway Protocol (BGP) Parameters" (updated 2026-09-09: message types, error codes and subcodes, OPEN optional parameter types) and "Capability Codes".
[16] Wireshark Foundation, "Sample Captures": bgp.pcap (30 Mar 2000), bgp.pcapng (FRRouting, 24 Aug 2022), bgp_shutdown_communication.pcap (30 Nov 2016). Decoded by Network freak.
[17] J. Stretch, packetlife.net capture library (mirror: epiecs/packetlife-backup): BGP_notification.cap, BGP_soft_reset.cap, BGP_hard_reset.cap, EBGP_adjacency.cap (Cisco IOS, June 2008), BGP_MP_NLRI.cap (June 2010), bgp-add-path.cap (July 2013). Decoded by Network freak.
[18] FRRouting, "BGP" user documentation (latest): neighbor shutdown message, extended-optional-parameters, timers, stalepath-time and enhanced route refresh, soft reconfiguration vs route refresh.
[20] Y. Rekhter, T. Li, "RFC 1771: A Border Gateway Protocol 4 (BGP-4)," March 1995, section 4.1 (Marker).
[19] Network freak lab: GoBGP 4.11 router r1 (AS 65001, 127.0.2.31) with eight passive neighbours driven by a raw Python BGP speaker, 28 November 2026, 05:04-05:05 CET. Raw messages and gobgpd log kept with the article sources.
Figures 1-7: Network freak, drawn from the sources above and our own captures.

Try it: BGP Route Lookup: origin AS, AS paths and RPKI check - free, runs in your browser. Also try: CIDR to IP Range - free, runs in your browser.

Comments

Popular posts from this blog

BGP Neighbor States

Reason legend in show ip ospf statistics

Cisco SPAN Port Mirroring for Troubleshooting