Loading...
STUN
Session Traversal Utilities for NAT (STUN) is a protocol that enables applications to discover their public IP address and the presence and type of network address translator (NAT) they are behind. This facilitates communication between devices located behind different NAT devices, which is crucial for peer-to-peer applications like voice and video chat..
Session Traversal Utilities for NAT (STUN) is a standardized protocol defined in RFC 5389. Its primary purpose is assisting endpoints in communicating across firewalls and NATs by discovering their external (public) IP address and port mappings. It functions as a tool for NAT traversal by allowing clients to query a public STUN server, which responds with the IP and port as seen externally.
STUN works using a lightweight request/response model. The client sends a binding request to a well-known STUN server on port 3478 over UDP or TCP. The server returns the mapped IP address and port, enabling the client to learn its public-facing network information. This data helps applications attempt direct peer-to-peer connectivity in protocols such as WebRTC or SIP.
STUN is often combined with other protocols like TURN (Traversal Using Relays around NAT) and ICE (Interactive Connectivity Establishment) to create reliable NAT traversal mechanisms. STUN's simplicity favors low-latency NAT discovery, while TURN provides relay capabilities when direct connections fail.