Join our Newsletter — 33% off our NHI Course
Home› Guides› BGP Session Protection: TCP-AO, MD5 and GTSM Compared…
Guide Network Security

BGP Session Protection: TCP-AO, MD5 and GTSM Compared and Configured

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 13 min read
On this page

A BGP session is a long-lived TCP connection on port 179, and anyone who can inject or spoof packets into it can reset it, flood the routing process or, at worst, tamper with the routes it carries. Three IETF mechanisms protect the session itself: the TCP MD5 Signature Option (RFC 2385), the TCP Authentication Option, TCP-AO (RFC 5925), and the Generalized TTL Security Mechanism, GTSM (RFC 5082). This guide compares them as protocols, explains how TCP-AO key rollover works and why MD5 keys rarely change, and sets out a vendor-neutral deployment and key management approach. It is written for network engineers running eBGP and iBGP at the enterprise edge, in data centres, at internet exchanges and in provider networks. Route origin and path validation are a separate problem covered in the BGP and Routing Security Guide.

Key takeaways

  • Layer the controls. A control-plane ACL for TCP 179, GTSM on directly connected peers and TCP-AO or MD5 authentication address different threats; RFC 7454 (BCP 194) recommends the ACL and GTSM and says TCP-AO "SHOULD be preferred when implemented".
  • MD5 is legacy but common. RFC 5925 obsoletes RFC 2385, yet MD5 remains the most used option because both ends support it; it has no key identifier, so hitless key change depends on implementation tricks.
  • TCP-AO fixes the key problem. KeyID and RNextKeyID allow key changes "with zero segment loss", per-connection traffic keys and replay protection for long-lived sessions, with HMAC-SHA-1-96 and AES-128-CMAC-96 as mandatory algorithms.
  • GTSM is cheap and effective, within limits. Requiring TTL or Hop Limit 255 on arrival blocks spoofed packets from off-link hosts, but it is "not a substitute for authentication" and offers little on multihop sessions.
  • The keys are the weak point. Session keys are shared secrets that are often set once and never rotated; treat them like any other machine credential with an owner, a vault and a rotation schedule.

Threats to BGP sessions

BGP runs over TCP, so it inherits TCP's exposure. The table separates threats to the session from threats to routing content, because session protection only addresses the first group.

ThreatEffectSession control that helpsNot addressed by session controls
Spoofed TCP RST or SYN from a remote hostSession reset, route withdrawal and flappingTCP-AO or MD5 (segments without a valid MAC are discarded); GTSM; ACLCovered by the session control
Packet flood at TCP 179 (CPU exhaustion)Routing process starves, sessions dropACL and rate limiting; GTSM drops off-link packets before expensive processingVolumetric attacks on links (ATT&CK T1498 Network Denial of Service)
Injected or modified segments by an on-path attackerFalse updates or session disruptionTCP-AO or MD5 integrity checkConfidentiality: neither option encrypts
Replay of captured segmentsDisruption of long-lived sessionsTCP-AO (sequence number extension)Covered by the session control
Unauthorised router forming a sessionRoute injection from a rogue speakerAuthentication keys; neighbour ACL; explicit peer configurationCovered by the session control
Hijacks and route leaks from a legitimate peerTraffic misdirectionNone: the peer is authenticatedNeeds RPKI, prefix filters and ASPA; see RPKI vs BGP Prefix Filtering

RFC 6952 adds the operational threat: access lists alone do not stop spoofing or man-in-the-middle attacks on BGP sessions, and static keys that never change become guessable or exposed over time, for example when an administrator who knew them leaves.

Before any authentication, RFC 7454 says the device SHOULD "discard all packets directed to TCP port 179 on the local device and sourced from an address not known or permitted" to be a neighbour, and MAY rate-limit BGP traffic. Apply this in the control-plane policy (CoPP or the equivalent loopback filter) on every BGP speaker.

TCP MD5

RFC 2385 (August 1998) defines TCP option Kind 19, Length 18, carrying a 16-byte MD5 digest in every segment. The digest covers the TCP pseudo-header, the TCP header without options (checksum zeroed), the segment data and a shared key. Implementations should accept printable ASCII keys of up to 80 bytes.

  • Weaknesses: the RFC itself notes MD5 is vulnerable to collision search and that some consider it too weak; there is no algorithm field, so the hash cannot be upgraded; and every connection between a pair uses the same key directly.
  • No key identifier: keys can change mid-connection only if both ends synchronise. RFC 4808 (Informational, March 2007) describes the interim workaround: the receiver accepts a list of keys and tries each one, while the sender switches to a new key after an agreed period or once that key has validated an incoming segment. It warns that accepting multiple keys eases CPU denial of service, so the overlap should be short, and that silent peers make it hard to tell whether the new key works.
  • Status: RFC 5925 obsoletes RFC 2385, and RFC 7454 calls MD5 superseded but "still the most used mechanism due to its availability in vendors' equipment".

In practice, MD5 key changes on most platforms reset the session unless the platform implements key chains with overlapping accept and send lifetimes. That reset cost is the main reason MD5 keys at internet exchanges and with transit providers often stay unchanged for years.

TCP-AO

RFC 5925 (Standards Track, June 2010) uses option Kind 29. It was designed to replace MD5 with stronger, agile algorithms and proper key management hooks.

  • Master Key Tuple (MKT): each MKT holds the socket pair it applies to, a flag for whether TCP options are included in the MAC, a SendID and RecvID, the master key, and the KDF and MAC algorithms. Components "MUST NOT change during a connection"; you add a new MKT instead.
  • Traffic keys: derived from the MKT, the IP addresses, ports and both Initial Sequence Numbers, so every connection gets unique keys even when the master key is reused.
  • KeyID and RNextKeyID: each segment says which MKT produced its MAC (KeyID) and which MKT the sender is ready to receive next (RNextKeyID). This is what allows key changes "with zero segment loss".
  • Replay protection: a 32-bit Sequence Number Extension emulates a 64-bit sequence space, protecting very long-lived sessions such as BGP.
  • Algorithms: RFC 5926 makes HMAC-SHA-1-96 and AES-128-CMAC-96 mandatory for MACs, with KDF_HMAC_SHA1 and KDF_AES_128_CMAC as KDFs. The default MAC is 96 bits, so the option is 16 bytes, 2 shorter than MD5.
  • Out of scope: TCP-AO does not negotiate keys or parameters, does not encrypt and does not authenticate ICMP. Master keys are configured manually or by an out-of-band system.
  • No mixing: "An endpoint MUST NOT use TCP-AO for the same connection in which TCP MD5 is used."

TCP-AO key rollover

  1. Configure a new MKT (new KeyID and master key) on both routers alongside the existing one. Both remain valid for receipt.
  2. On one router, set the new KeyID as the preferred next key. That router advertises it in RNextKeyID.
  3. The peer sees the RNextKeyID and starts sending with the new MKT; once both directions use the new key, traffic continues without a reset.
  4. Confirm in the session statistics that segments are being authenticated with the new KeyID and that the authentication failure counters are not rising.
  5. Remove the old MKT from both routers after an agreed grace period.

Many platforms express this as a key chain with send and accept lifetimes per key. Keep accept lifetimes overlapping by at least the time needed to update both ends, and agree the KeyID numbering with external peers, because SendID and RecvID must match across the session.

Interoperability notes

  • Algorithms: use one of the two RFC 5926 mandatory MACs with external peers. Extensions such as HMAC-SHA-256 only interoperate when both sides derive keys the same way and use the same MAC length, as the Linux kernel documentation warns.
  • Include options flag: both ends must agree whether TCP options are covered by the MAC; a mismatch fails every segment.
  • Key encoding: agree whether the master key is entered as ASCII or hexadecimal; the same string encoded differently produces different keys.
  • Migration from MD5: a connection cannot move from MD5 to TCP-AO, so migration requires a planned session reset. Some stacks let a listening socket accept both AO and MD5 peers, but a single peer cannot have keys of both types.
  • Open source routing stacks: TCP-AO depends on the operating system's TCP implementation; confirm kernel and routing daemon support before planning, and treat support as per platform and release.

GTSM

RFC 5082 (Standards Track, October 2007, obsoleting the Experimental RFC 3682) relies on routers decrementing TTL. Both peers send BGP packets with TTL (IPv4) or Hop Limit (IPv6) 255; the receiver accepts packets for that session only if they arrive with 255, which means they most likely came from a directly connected neighbour. Packets for the session with any other value are classified "Dangerous" and can be dropped early, before they cost CPU.

  • Where it fits: RFC 7454 says operators "SHOULD implement TTL security on directly connected BGP peerings". It must be configured on both ends.
  • Multihop: the RFC 5082 multihop check (accepting 255 minus a configured hop count) is non-normative, and RFC 7454 notes that anyone inside the TTL diameter could spoof the TTL, so for iBGP between loopbacks rely on authentication and ACLs rather than GTSM.
  • Limits: GTSM does not stop an attacker on the same link, does not prevent replay or on-path tampering, and can be defeated by some tunnel types.

Mechanisms compared

PropertyTCP MD5 (RFC 2385)TCP-AO (RFC 5925, 5926)GTSM (RFC 5082)
What it providesSegment integrity and peer authentication with a shared keySegment integrity, peer authentication, replay protectionFiltering of spoofed packets from off-link sources
AlgorithmMD5, fixedHMAC-SHA-1-96 or AES-128-CMAC-96 (agile)None (TTL check)
TCP optionKind 19, 18 bytesKind 29, 16 bytes by defaultNone
Hitless key changeImplementation dependent (RFC 4808 workaround)Built in (KeyID, RNextKeyID)No keys
Per-connection keysNoYes (traffic keys from ISNs)Not applicable
EncryptionNoNoNo
Best usePeers that only support MD5Default for new sessions where both ends support itEvery directly connected eBGP session, alongside authentication
IETF standingObsoleted by RFC 5925Preferred by RFC 7454 when implementedRecommended by RFC 7454 for direct peers

Key management for sessions

BGP session keys are machine credentials. RFC 6952 observes that routers with static keys often never change them because coordinating a pair is hard. Treat them as follows:

  • Generate, do not invent: use random keys of at least 128 bits of entropy (for example 32 hexadecimal characters), unique per peering. Never reuse one key across an exchange or across customers.
  • Store centrally: keep keys in a secrets vault referenced by your network automation, not in spreadsheets, tickets or email. Restrict who can read router configuration, since some platforms store session keys in a reversible form. See the Network Automation Security guide.
  • Exchange securely: share keys with external peers over an encrypted channel or the peer's portal, never in the same email as the session details.
  • Rotate on a schedule and on events: rotate TCP-AO keys on a defined period (for example annually) and immediately when staff with access leave, a configuration backup is exposed or a peer reports compromise.
  • Own every key: record owner, peer, KeyID, creation date and next rotation date in your inventory. The Secrets Rotation Runbook Template can be adapted for peering keys.

Deployment approach

  1. Inventory sessions: list every BGP session with peer type (IXP route server, bilateral IXP, transit, customer, iBGP, data centre fabric), current protection and both ends' TCP-AO support.
  2. Apply the control-plane ACL and rate limiting on all BGP speakers first; this needs no peer coordination. Test in a lab, then deploy with logging to catch legitimate peers you missed.
  3. Enable GTSM on directly connected eBGP sessions, coordinated with each peer. Watch session state during the change window; a mismatch drops the session, and rollback is removing the setting on your side.
  4. Turn on TCP-AO for internal sessions (iBGP, fabric underlay and overlay) where you control both ends, starting with a pilot pair, then a region.
  5. Offer TCP-AO to external peers at the next maintenance or onboarding; keep MD5 only where the peer cannot support AO, and record those exceptions.
  6. Rehearse rollover: perform one TCP-AO key change on the pilot pair and confirm no session reset before rolling out schedules.
  7. Rollback plan: each change has a tested reversal (remove GTSM, revert to the previous key), and peer contacts are confirmed before the window. RFC 7454 notes session protection adds configuration and management overhead, so automate it.

Enterprises with two transit providers should prioritise the ACL, GTSM and authentication on those few sessions. Providers and large exchanges should automate key generation and peer onboarding so every new session gets TCP-AO or a documented MD5 exception by default.

Detection and measurement

  • Log: BGP session state changes, authentication failures (missing or invalid MAC), GTSM drops and control-plane ACL hits; forward them to your monitoring platform.
  • Alert: on flapping sessions, sudden increases in authentication failures from a peer and ACL hits from unexpected sources on TCP 179.
MetricTarget
BGP speakers with a TCP 179 control-plane ACL100%
Directly connected eBGP sessions with GTSM100% where the peer agrees
Sessions using TCP-AO100% internal; rising for external
Session keys older than the rotation periodZero
Unique key per peering100%

Framework mapping

FrameworkReferenceRelevance
NIST SP 800-53 Rev 5SC-7, SC-8, SC-23, IA-3, SC-12Boundary protection of the control plane, transmission integrity, session authenticity, device authentication, key management
NIST CSF 2.0PR.IR-01, PR.DS-02, DE.CM-01Network protection, data-in-transit integrity, network monitoring
MITRE ATT&CKT1557 Adversary-in-the-Middle; T1498 Network Denial of ServiceOn-path tampering and floods against routing infrastructure
IETF BCP 194RFC 7454 sections 4 and 5Protecting the BGP speaker and the session

Practitioner checklist

  • Inventory every BGP session with its current protection and the peer's TCP-AO support.
  • Filter TCP 179 to configured neighbours and rate-limit BGP traffic on every speaker.
  • Enable GTSM on all directly connected eBGP peerings, on both ends.
  • Use TCP-AO with an RFC 5926 mandatory algorithm for all internal sessions.
  • Move external peers from MD5 to TCP-AO at the next window and record remaining MD5 exceptions.
  • Generate unique random keys per peering and store them in a vault, not in tickets or email.
  • Rehearse a hitless TCP-AO key rollover before setting rotation schedules.
  • Rotate keys on schedule and immediately after staff changes or configuration exposure.
  • Alert on authentication failures, GTSM drops and session flaps.

Standards and references

Related NHI Mgmt Group resources: BGP and Routing Security Guide · RPKI vs BGP Prefix Filtering · RTBH and BGP Flowspec DDoS Mitigation Guide · RPKI and Route Origin Validation Deployment Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.