NAT Traversal Protocols ======================== This section covers the core components that enable WebRTC (Web Real-Time Communication) to establish peer-to-peer connectivity, particularly across NAT/firewall environments. .. toctree:: :maxdepth: 1 :hidden: :includehidden: ICE STUN_SERVER TURN_SERVER WebRTC .. list-table:: :widths: 20 60 20 :header-rows: 1 * - Component - Description - Use Case * - ICE (Interactive Connectivity Establishment) - Framework that tries multiple methods to connect peers. *Combines STUN and TURN for NAT traversal.* - Establishing peer-to-peer connections. * - STUN (Session Traversal Utilities for NAT) - Helps clients discover their public IP and NAT type. *Enables direct peer-to-peer communication.* - Enables connections behind NAT/firewalls. * - TURN (Traversal Using Relays around NAT) - Relays media when direct connection fails. *Acts as a media proxy server.* - Ensures reliable communication fallback. * - WebRTC (Web Real-Time Communication) - A set of APIs and underlying protocols enabling peer-to-peer audio, video, and data in browsers. *Enables real-time communication with NAT traversal support via ICE, STUN, and TURN.* - Browser-based peer-to-peer media/data connections .. tab-set:: .. tab-item:: ICE (Interactive Connectivity Establishment) **RFC:** RFC 8445 **Main Features:** - Connectivity framework for NAT/firewall traversal - Uses STUN and TURN as fallback mechanisms - Collects multiple candidates (IP addresses and ports) **Use Cases:** - Peer-to-peer connection setup in WebRTC - Negotiating the best path between peers **Alternative Protocols:** - None – ICE is the standard coordination mechanism for WebRTC .. panels:: :container: container pb-4 :column: col-lg-12 p-2 **Let us learn more about ICE:** * :ref:`Learnings in this section ` * :ref:`Terminology ` * :ref:`Version Info ` * :ref:`ICE Version&RFC Details ` * :ref:`ICE Basic Setup on Ubuntu using IPv4 ` * :ref:`ICE Basic Setup on Ubuntu using IPv6 ` * :ref:`ICE Protocol Packet Details ` * :ref:`ICE Usecases ` * :ref:`ICE Basic Features ` * :ref:`ICE Feature : Candidate Gathering ` * :ref:`ICE Feature : Candidate Prioritization ` * :ref:`ICE Feature : Candidate Pairing ` * :ref:`ICE Feature : Connectivity Checks ` * :ref:`ICE Feature : Nomination ` * :ref:`ICE Feature : NAT Traversal ` * :ref:`ICE Feature : STUN Integration ` * :ref:`ICE Feature : TURN Integration ` * :ref:`ICE Feature : Consent Freshness ` * :ref:`ICE Feature : Trickle ICE Support ` * :ref:`Reference links ` .. button-link:: ./ICE.html :color: primary :shadow: :expand: Jump to "ICE" .. tab-set:: .. tab-item:: STUN (Session Traversal Utilities for NAT) **RFC:** RFC 5389 **Main Features:** - Discovers public IP addresses of clients - Identifies NAT type and firewall behavior - Lightweight UDP-based protocol **Use Cases:** - Peer discovery in WebRTC - Assisting direct P2P media path setup **Alternative Protocols:** - TURN – Used when STUN fails .. panels:: :container: container pb-4 :column: col-lg-12 p-2 **Let us learn more about STUN:** * :ref:`Learnings in this section ` * :ref:`Terminology ` * :ref:`Version Info ` * :ref:`STUN_SERVER Version&RFC Details ` * :ref:`STUN_SERVER Basic Setup on Ubuntu using IPv4 ` * :ref:`STUN_SERVER Basic Setup on Ubuntu using IPv6 ` * :ref:`STUN_SERVER Protocol Packet Details ` * :ref:`STUN_SERVER Usecases ` * :ref:`STUN_SERVER Basic Features ` * :ref:`STUN_SERVER Feature : Public IP Discovery ` * :ref:`STUN_SERVER Feature : NAT Type Detection ` * :ref:`STUN_SERVER Feature : Port Mapping Discovery ` * :ref:`STUN_SERVER Feature : Lightweight Protocol ` * :ref:`STUN_SERVER Feature : Client-Server Architecture ` * :ref:`STUN_SERVER Feature : Support for IPv4 and IPv6 ` * :ref:`STUN_SERVER Feature : Used in WebRTC and VoIP ` * :ref:`Reference links ` .. button-link:: ./STUN.html :color: primary :shadow: :expand: Jump to "STUN" .. tab-set:: .. tab-item:: TURN (Traversal Using Relays around NAT) **RFC:** RFC 8656 **Main Features:** - Relays media through an intermediate server - Used when direct peer connection is not possible - Supports TCP and UDP relaying **Use Cases:** - WebRTC calls behind symmetric NAT or strict firewalls - Reliable fallback for P2P media delivery **Alternative Protocols:** - STUN – Preferred when NAT allows direct access .. panels:: :container: container pb-4 :column: col-lg-12 p-2 **Let us learn more about TURN:** * :ref:`Learnings in this section ` * :ref:`Terminology ` * :ref:`Version Info ` * :ref:`TURN_SERVER Version&RFC Details ` * :ref:`TURN_SERVER Basic Setup on Ubuntu using IPv4 ` * :ref:`TURN_SERVER Basic Setup on Ubuntu using IPv6 ` * :ref:`TURN_SERVER Protocol Packet Details ` * :ref:`TURN_SERVER Usecases ` * :ref:`TURN_SERVER Basic Features ` * :ref:`TURN_SERVER Feature : NAT Traversal ` * :ref:`TURN_SERVER Feature : Relay Allocation ` * :ref:`TURN_SERVER Feature : Transport Protocol Support ` * :ref:`TURN_SERVER Feature : Authentication ` * :ref:`TURN_SERVER Feature : Permission Management ` * :ref:`TURN_SERVER Feature : Channel Binding ` * :ref:`TURN_SERVER Feature : IPv4 and IPv6 Support ` * :ref:`TURN_SERVER Feature : ICE Integration ` * :ref:`TURN_SERVER Feature : Secure Media Relay ` * :ref:`TURN_SERVER Feature : Resource Management ` * :ref:`Reference links ` .. button-link:: ./TURN.html :color: primary :shadow: :expand: Jump to "TURN" .. tab-set:: .. tab-item:: WebRTC (Web Real-Time Communication) **Standard:** W3C Recommendation (latest March 13, 2025) **Components:** ICE (RFC 8445), STUN (RFC 5389), TURN (RFC 8656), and Media/Data APIs **Status:** Defines APIs (e.g., RTCPeerConnection) and underlying NAT traversal mechanisms :contentReference[oaicite:0]{index=0} **Main Features:** - Browser-based framework for real-time peer-to-peer audio, video, and data - Integrates ICE, STUN, and TURN for NAT/firewall traversal :contentReference[oaicite:1]{index=1} - Exposes APIs (such as `RTCPeerConnection`) to manage connection setup and media handling - Supports media handling, secure transport (DTLS/SRTP), and data channels **Use Cases:** - Video conferencing, voice calls, and real-time messaging in browsers - Peer-to-peer file sharing and data exchange via WebRTC Data Channels - Any app needing real-time, low-latency, NAT-traversing communication directly between clients **Alternative Protocols/Frameworks:** - SIP/WebRTC Gateway – for interoperability with legacy VoIP - Traditional real-time transport using centralized servers (e.g. WebSockets, media servers) - Custom media/data transport over VPN or proprietary mechanisms .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: What You Will Learn in This Section **Let us learn more about WebRTC:** * :ref:`Learnings in this section ` * :ref:`Terminology ` * :ref:`Version Info ` * :ref:`WebRTC Version&IEEE Details ` * :ref:`WebRTC Basic Setup on Ubuntu using IPv4 ` * :ref:`WebRTC Basic Setup on Ubuntu using IPv6 ` * :ref:`WebRTC Protocol Packet Details ` * :ref:`WebRTC Usecases ` * :ref:`WebRTC Basic Features ` * :ref:`Reference links ` .. button-link:: ./WebRTC.html :color: primary :shadow: :expand: Jump to "WebRTC"