decoder.tools

BGP Attribute Decoder

Decode BGP path attributes from raw update-message bytes.

INPUT
OUTPUT

The result appears here as you type.

Decoding runs in your browser. What you paste is not sent to a server.

A BGP decoder parses the path attributes carried in a BGP UPDATE message — AS_PATH, NEXT_HOP, ORIGIN, MED, LOCAL_PREF and communities — which together determine how the internet routes a prefix.

Example

Input
400101004002040201fd ea40030400000000
Output
ORIGIN: IGP
AS_PATH: 65002
NEXT_HOP: 0.0.0.0
Attributes: 3
AS number size: 2 bytes

What is the BGP Attribute Decoder?

BGP is the protocol that glues autonomous systems together, and it makes decisions by comparing path attributes rather than by measuring anything. AS_PATH lists the autonomous systems a route has traversed and doubles as loop prevention; NEXT_HOP says where to send traffic; ORIGIN records how the prefix entered BGP.

Policy lives in the rest. LOCAL_PREF is the highest-weight tiebreaker inside your own AS, MED hints to a neighbour which of several links to prefer, and communities are tags — a 32-bit value like 65000:100 — that let operators signal 'prepend this', 'don't export that' or 'blackhole this prefix' to each other.

Reading attributes directly matters when a route is doing something unexpected: an AS_PATH longer than it should be, a community that triggered someone else's policy, or a NEXT_HOP that isn't reachable are all visible in the raw update.

How to use the BGP Attribute Decoder

  1. Paste the attribute bytes from a BGP UPDATE message as hex.
  2. Read the decoded attribute types, flags and values.
  3. Compare AS_PATH length and communities against the policy you expect.

When to use it

  • Investigating why a prefix is preferred over an alternative path.
  • Confirming a customer's communities were received and acted on.
  • Studying BGP data from a route collector or looking glass.

BGP Attribute Decoder at a glance

ProtocolBGP-4 · RFC 4271, over TCP port 179
AS_PATHAS sequence traversed; also loop prevention
Selection orderLOCAL_PREF, then AS_PATH length, then ORIGIN, then MED
Communities32-bit tags, written ASN:value

Frequently asked questions

What decides which BGP route wins?

A fixed sequence: highest LOCAL_PREF first, then shortest AS_PATH, then lowest ORIGIN, then lowest MED, then eBGP over iBGP, and finally lowest IGP cost to the next hop.

What are BGP communities for?

Signalling policy between operators. A community tag on a prefix can request prepending, restrict export to certain regions or trigger a blackhole — the meaning is defined by the receiving network, not the protocol.

Why does AS_PATH prevent loops?

A router rejects any route whose AS_PATH already contains its own AS number, which guarantees the route hasn't been round-tripped back to where it came from.

Last reviewed · found a mistake? contact@decoder.tools · view as markdown