A packet leaves a laptop on a home network, crosses a router that quietly rewrites its return address, and lands on a STUN server somewhere else on the planet. The server glances at what arrived, writes the source address it saw into an XOR-MAPPED-ADDRESS attribute, and mails it back. That is the entire trick. The address that comes home is a server-reflexive transport address — one observation, from one vantage point, at one moment, for one transaction. It is evidence. It is not a promise that anybody else on the Internet can reach you.
Getting from the first half of that sentence to the second took the industry seventeen years and three RFCs, and the story is a small masterpiece of engineering humility.
The short version
- STUN reports a server-reflexive transport address: a server's observation, not a guarantee of reachability or durable identity.
- RFC 3489 (2003) tried to be a complete NAT-traversal solution, complete with NAT-type classification. It overpromised.
- RFC 5389 (2008) demoted STUN to a tool; RFC 8489 (2020) kept it there, on purpose.
- ICE (RFC 8445) is what actually proves reachability — by testing candidate pairs rather than trusting a single answer.
- Discovery is not permission. Consent, freshness, security and fallback live in the usage, never in the observation.
What STUN actually does: the mirror in the middle
The mechanism is almost insultingly simple. A client application sits behind a Network Address Translator (NAT) and sends a Session Traversal Utilities for NAT (STUN) Binding request from a local IP address and port it already knows. As the packet crosses the NAT, the device rewrites the source IP and port into a public-facing transport address. The STUN server receives the packet, notes the source transport address it arrived from, builds a Binding response carrying that address inside the XOR-MAPPED-ADDRESS attribute, and sends it back [^1^].
What the client gets is a mirror, not a map. The mirror is accurate about the face it saw. It says nothing about the room.
2003: RFC 3489 and the dream of an all-knowing mirror
The original specification, [^2^ RFC 3489], was a product of a more confident era. Its very name — Simple Traversal of UDP Through NATs — promised traversal, not just observation. STUN would reveal the server-reflexive address and classify the NAT device in front of you as full-cone, restricted-cone, port-restricted-cone or symmetric, and from that classification it would tell you how the rest of the world was going to see you.
The logic was seductive: learn your NAT's personality, learn your external mapping, and you can predict your own reachability. One good look in the mirror, and you could write your own passport.
Where the mirror cracked
Real networks had other ideas. NAT implementations varied wildly, firewalls intervened, topologies multiplied, and the tidy four-box taxonomy turned out to describe a world that did not exist. A classification could be wrong on the day it was taken and stale by the afternoon. An address learned through STUN might work beautifully for one peer and fail for the next; the mapping's lifetime was anybody's guess; a symmetric NAT could quietly hand you a different external port for every destination you spoke to.
Worse, the classification was often confidently wrong — which is the most expensive kind. Applications built on the RFC 3489 promise did not merely fail; they failed after predicting success, which is how you get brittle systems and support tickets written in capital letters.
2008: RFC 5389 and the great demotion
[^3^ RFC 5389] is where the industry stopped pretending. It renamed the protocol — Session Traversal Utilities for NAT, a utility, not a solution — and explicitly documented why the grand RFC 3489 ambition was being retired. NAT classification was pushed out to what became [RFC 5780] behavior discovery, where it belonged: a specialist's diagnostic, not a foundation stone.
RFC 5389 also introduced XOR-MAPPED-ADDRESS for a wonderfully grubby reason. Some NAT devices and application-layer gateways could not resist rewriting an address that appeared in plain text inside a packet's payload. XOR the address against the magic cookie and the transaction ID, and the box no longer recognises what it is looking at. The mirror had to be disguised so the middleboxes would stop editing it.
The demotion was the point. STUN stopped claiming to know whether you were reachable and started reporting, precisely and honestly, what one server had seen.
2020: RFC 8489 keeps the discipline
The current standard, [^4^ RFC 8489], holds the narrower line. It defines the core mechanism for discovering the server-reflexive transport address, specifies supporting attributes such as ERROR-CODE for diagnostics, and is explicit that higher-level protocols and applications own the interpretation. Timing, attribute handling, server selection, transport choice: not STUN's problem.
That restraint is the feature. A protocol that knows its own scope is a protocol you can build on.
ICE: how reachability is actually proven
The payoff is Interactive Connectivity Establishment, [^5^ RFC 8445]. ICE does not take a STUN answer as a certificate of peer-to-peer friendship. It gathers host candidates, server-reflexive candidates (the STUN output) and relayed candidates (courtesy of TURN), shuffles them into pairs, ships them to the peer, and then tests the pairs with explicit connectivity checks in both directions.
Reachability stops being inferred and starts being demonstrated. Different destinations, different protocols, NAT state, firewall rules, alternate paths, mapping lifetimes, and whether the far end has consented to talk at all — every one of these can independently sink a candidate that looked perfect in the mirror. STUN's authentication and integrity mechanisms protect the exchanges it defines; they do not convert a mapped tuple into a universal permission slip.
So the surrounding usage carries the load: candidate exchange, connectivity checks, consent, freshness, path selection, retransmission, fallback, and the graceful admission that sometimes you relay through TURN and get on with your life.
The architectural lesson: a record is not a title
Strip away the acronyms and STUN's history is one idea, learned the hard way: observation is not authority. A single external view of a client is a fact about a packet, not a property of a network. The moment engineers mistook the record for the reality — the mapping for the mandate — they built systems that confidently predicted connections that never happened.
RFC 5389's demotion was not a retreat. It was the moment a protocol stopped auditioning for a job it could not do, and became genuinely excellent at the one it could. The mirror still works. It has simply stopped telling you what is in the room.
[^1^]: https://www.rfc-editor.org/rfc/rfc8489.html [^2^]: https://www.rfc-editor.org/rfc/rfc3489.html [^3^]: https://www.rfc-editor.org/rfc/rfc5389.html [^4^]: https://www.rfc-editor.org/rfc/rfc8489.html [^5^]: https://www.rfc-editor.org/rfc/rfc8445.html
Member Briefing
Read the full trend briefing
Members read the full briefing with the source notes behind every finding.
Strategic Circle
A daily briefing in your language, built from changes we have verified.
Join for USD 20/monthCancel anytime.
Members also get the full research library, a daily briefing on the networks they follow and the private forum.






