Course contents

Module 3: Stability and SecurityLesson 3.1 (1 of 3 in this module)7 of 11 in the Advanced BGP course

Securing BGP sessions

Maximum-prefix limits, TTL security (GTSM) and session authentication.

Advanced · 20 min read

You'll learn to set a maximum-prefix limit, enable TTL security for a directly connected neighbour, and combine session protections into a baseline.

Layers for different threats

How a more-specific announcement attracts traffic
How a more-specific announcement attracts trafficAS 64503 owns 203.0.113.0/24 and announces it. A wrong network, AS 64599, announces 203.0.113.0/25, a more specific part of it. Routers prefer the longest matching prefix before they compare any BGP attribute, so traffic for addresses in the /25 flows to AS 64599 even though the /24 has the shorter AS path.Rest of the internetAS 64503owner: 203.0.113.0/24AS 64599wrong: 203.0.113.0/25/24, shorter path/25, longest match winsHosts in 203.0.113.128/25still reach the owner only if the /25 is blockedDefenceprefix-list per neighbour + RPKI ROV

On small screens, swipe sideways or focus the diagram and use the arrow keys.

Longest-prefix match happens in forwarding, before best-path selection. Only filtering what neighbours may announce, and validating the origin AS with RPKI, stops the wrong route from being accepted in the first place.

A BGP session can go wrong in two ways: someone outside the session interferes with it, or the neighbour sends something it should not. The first needs packet-level protection. The second needs limits on what you accept.

Three threats, three defences
Three threats, three defencesProtect the session, the prefixes and the router itself.BGP security layersSessionMD5 or TCP-AO keyTTL security for hop countPrefixesmaximum-prefix, filters,RPKI validationRoutercontrol plane protectionand management ACLs

On small screens, swipe sideways or focus the diagram and use the arrow keys.

No single feature covers everything.
Two cheap protections for a BGP session
Two cheap protections for a BGP sessionLeft: maximum-prefix shuts a session when a neighbour sends more routes than expected. Right: GTSM sets TTL 255 and rejects packets that arrive with a lower value.maximum-prefixNeighboursends routesLimit 100warn at 80%Limit exceededsession closed, loggedGTSM (TTL security)NeighbourTTL 255AcceptedTTL ≥ 254ForgedTTL 240Dropped

On small screens, swipe sideways or focus the diagram and use the arrow keys.

Maximum-prefix limits damage from a leak. GTSM stops forged packets from far away, because only a directly connected neighbour can arrive with a TTL of 254 or more.

Limit what a neighbour can send

maximum-prefix in action
maximum-prefix in actionThe router counts prefixes from the neighbour and acts at a threshold.Prefixes arrivefrom the neighbourThreshold80 percent: warningLimit reachedsession closed orextra routes droppedOperatorinvestigates beforerestart

On small screens, swipe sideways or focus the diagram and use the arrow keys.

A warning at the threshold gives time to react before the session is closed.
router bgp 64500 address-family ipv4 unicast neighbor 192.0.2.1 maximum-prefix 100 80

R1. Warn at 80 percent of 100 prefixes and shut the session at 100. Pick the limit from what the provider has agreed to send, with some headroom.

Illustrative Cisco IOS XE output written for this lesson, not a router capture
R1#show logging | include MAXPFX
%BGP-4-MAXPFX: No. of prefix received from 192.0.2.1 (afi 0) reaches 81, max 100
%BGP-3-MAXPFXEXCEED: No. of prefix received from 192.0.2.1: 101 exceed limit 100
The first line is the warning at 80 percent. The second means the limit was crossed and the session was closed. Clear it only after you understand why the neighbour sent more than expected.

Protect the session from far away

TTL security (GTSM) exploits the fact that only a directly connected neighbour can send a packet that arrives with a TTL near 255. Each side sends with TTL 255 and drops packets with a lower value than expected.

Why TTL security works
Why TTL security workseBGP packets from a directly connected peer arrive with a TTL near 255. A remote attacker cannot send packets that arrive with such a TTL.Direct neighbourTTL 255 on sendArrives with 254Remote attackerPacket crosses routersTTL falls below 254vs

On small screens, swipe sideways or focus the diagram and use the arrow keys.

ttl-security hops 1 accepts only packets that could come from the neighbour.
router bgp 64500 neighbor 192.0.2.1 ttl-security hops 1

R1. Both ends must enable it. With hops 1 only packets arriving with TTL 254 or more are accepted. Do not combine it with ebgp-multihop on the same neighbour.

A baseline for every external neighbour

  1. Authenticate the TCP session (MD5 or TCP-AO where supported).
  2. Enable GTSM for directly connected neighbours.
  3. Filter inbound and outbound by prefix list.
  4. Set a maximum-prefix limit.
  5. Validate origin where RPKI is available.

Technical references: RFC 5082 (GTSM) and RFC 7454 (BGP operations and security). Output above is illustrative.

A baseline for each eBGP neighbour
A baseline for each eBGP neighbourApply the same set to every external peer.AuthenticationMD5 key or TCP-AOTTL securityttl-security hops 1 for direct peersPrefix limitmaximum-prefix with a warning thresholdFiltersInbound and outbound prefix listsLogginglog-neighbor-changes

On small screens, swipe sideways or focus the diagram and use the arrow keys.

A short checklist beats remembering each option.

Check your understanding

Predict · scenario 1

Which control limits the harm from a neighbour that leaks a full table?

Predict · scenario 2

Why does GTSM work against distant attackers?

Predict · scenario 3

Can you use ttl-security hops 1 together with ebgp-multihop on one neighbour?

FAQ

What happens when maximum-prefix is exceeded?
By default the session is shut down and stays down until you clear it. Options let it restart after a time, or only log a warning.
Can I use GTSM with ebgp-multihop?
No. GTSM expects the neighbour to be a known number of hops away. Use ttl-security hops N instead of ebgp-multihop for a neighbour more than one hop away.
Is a session password enough?
It stops forged segments but does not stop a neighbour from sending bad routes. Combine it with prefix limits and filters.