TURN_SERVER - Traversal Using Relays around NAT ================================================ .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **What is TURN_SERVER?** TURN stands for Traversal Using Relays around NAT. It is a protocol that allows clients behind NAT (Network Address Translation) or firewalls to receive and send media (like voice or video) by relaying it through a TURN server. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Why is TURN useful?** * Enables peer-to-peer communication even when direct connectivity is blocked by NAT/firewalls * Ensures reliable media delivery in restrictive network environments * Works with WebRTC, VoIP, and video conferencing systems * Provides fallback when STUN or ICE fails to establish direct paths .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **How it works?** * **Allocate Request** – Client asks the TURN server to allocate a public relay address * **Server Response** – TURN server provides a relay IP and port * **Permission Creation** – Client tells the server which peers it wants to communicate with * **Channel Binding** – Client binds a channel number to a peer for efficient transfer * **Data Relay** – TURN server relays all media/data between peers .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Where is TURN used?** * **WebRTC applications** – For video/audio calls in browsers * **VoIP systems** – To ensure call connectivity across NATs * **Enterprise networks** – Where strict firewalls block direct peer communication * **Mobile apps** – That require real-time communication in varied network conditions .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Which OSI layer does TURN belong to?** * TURN operates at the **Application Layer (Layer 7)** * It manages session control and relay logic * It defines message types like Allocate, CreatePermission, ChannelBind, Send, and Data * Although it uses **UDP or TCP (commonly port 3478)** for transport, the protocol logic resides at Layer 7 .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow Topics in this section, * :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 ` .. _TURN_SERVER_step1: .. tab-set:: .. tab-item:: Learnings in this section * In this section, you are going to learn .. _TURN_SERVER_step2: .. tab-set:: .. tab-item:: Terminology * Terminology .. _TURN_SERVER_step3: .. tab-set:: .. tab-item:: Version Info * Version Info .. _TURN_SERVER_step5: .. tab-set:: .. tab-item:: TURN_SERVER Version&RFC Details .. csv-table:: :file: ./TURN_SERVER/TURN_Server_RFC_Details.csv :widths: 10,10,10,30,40,50 :header-rows: 1 .. _TURN_SERVER_step19: .. tab-set:: .. tab-item:: TURN_SERVER Basic Setup on Ubuntu using IPv4 * Setup .. _TURN_SERVER_step20: .. tab-set:: .. tab-item:: TURN_SERVER Basic Setup on Ubuntu using IPv6 * Setup .. _TURN_SERVER_step6: .. tab-set:: .. tab-item:: TURN_SERVER Protocol Packet Details **Allocate Request** .. csv-table:: :file: ./TURN_SERVER/TURN_Server_Protocol_Packet_1.csv :widths: 10,20,30,10 :header-rows: 1 **Allocate Response** .. csv-table:: :file: ./TURN_SERVER/TURN_Server_Protocol_Packet_2.csv :widths: 10,20,30,10 :header-rows: 1 **CreatePermission Request** .. csv-table:: :file: ./TURN_SERVER/TURN_Server_Protocol_Packet_3.csv :widths: 10,20,30,10 :header-rows: 1 **CreatePermission Response** .. csv-table:: :file: ./TURN_SERVER/TURN_Server_Protocol_Packet_4.csv :widths: 10,20,30,10 :header-rows: 1 **ChannelBind Request** .. csv-table:: :file: ./TURN_SERVER/TURN_Server_Protocol_Packet_5.csv :widths: 10,20,30,10 :header-rows: 1 **ChannelBind Response** .. csv-table:: :file: ./TURN_SERVER/TURN_Server_Protocol_Packet_6.csv :widths: 10,20,30,10 :header-rows: 1 **Send Indication** .. csv-table:: :file: ./TURN_SERVER/TURN_Server_Protocol_Packet_7.csv :widths: 10,20,30,10 :header-rows: 1 **Data Indication** .. csv-table:: :file: ./TURN_SERVER/TURN_Server_Protocol_Packet_8.csv :widths: 10,20,30,10 :header-rows: 1 .. _TURN_SERVER_step7: .. tab-set:: .. tab-item:: TURN_SERVER Usecases .. csv-table:: :file: ./TURN_SERVER/TURN_Server_Usecases.csv :widths: 10,20,30 :header-rows: 1 .. _TURN_SERVER_step8: .. tab-set:: .. tab-item:: TURN_SERVER Basic Features .. csv-table:: :file: ./TURN_SERVER/TURN_Server_Features.csv :widths: 10,10,30 :header-rows: 1 .. _TURN_SERVER_step9: .. tab-set:: .. tab-item:: TURN_SERVER Feature : NAT Traversal **NAT Traversal - Testcases** .. csv-table:: :file: ./TURN_SERVER/TURN_Server_Feature_1_NAT_Traversal_Testcase.csv :widths: 10,10,30,20 :header-rows: 1 .. _TURN_SERVER_step10: .. tab-set:: .. tab-item:: TURN_SERVER Feature : Relay Allocation **Relay Allocation - Testcases** .. csv-table:: :file: ./TURN_SERVER/TURN_Server_Feature_2_Relay_Allocation_Testcase.csv :widths: 10,10,30,20 :header-rows: 1 .. _TURN_SERVER_step11: .. tab-set:: .. tab-item:: TURN_SERVER Feature : Transport Protocol Support **Transport Protocol Support - Testcases** .. csv-table:: :file: ./TURN_SERVER/TURN_Server_Feature_3_Transport_Protocol_Support_Testcase.csv :widths: 10,10,30,20 :header-rows: 1 .. _TURN_SERVER_step12: .. tab-set:: .. tab-item:: TURN_SERVER Feature : Authentication **Authentication - Testcases** .. csv-table:: :file: ./TURN_SERVER/TURN_Server_Feature_4_Authentication_Testcase.csv :widths: 10,10,30,20 :header-rows: 1 .. _TURN_SERVER_step13: .. tab-set:: .. tab-item:: TURN_SERVER Feature : Permission Management **Permission Management - Testcases** .. csv-table:: :file: ./TURN_SERVER/TURN_Server_Feature_5_Permission_Management_Testcase.csv :widths: 10,10,30,20 :header-rows: 1 .. _TURN_SERVER_step14: .. tab-set:: .. tab-item:: TURN_SERVER Feature : Channel Binding **Channel Binding - Testcases** .. csv-table:: :file: ./TURN_SERVER/TURN_Server_Feature_6_Channel_Binding_Testcase.csv :widths: 10,10,30,20 :header-rows: 1 .. _TURN_SERVER_step15: .. tab-set:: .. tab-item:: TURN_SERVER Feature : IPv4 and IPv6 Support **IPv4 and IPv6 Support - Testcases** .. csv-table:: :file: ./TURN_SERVER/TURN_Server_Feature_7_IPv4_and_IPv6_Support_Testcase.csv :widths: 10,10,30,20 :header-rows: 1 .. _TURN_SERVER_step16: .. tab-set:: .. tab-item:: TURN_SERVER Feature : ICE Integration **ICE Integration - Testcases** .. csv-table:: :file: ./TURN_SERVER/TURN_Server_Feature_8_ICE_Integration_Testcase.csv :widths: 10,10,30,20 :header-rows: 1 .. _TURN_SERVER_step17: .. tab-set:: .. tab-item:: TURN_SERVER Feature : Secure Media Relay **Secure Media Relay - Testcases** .. csv-table:: :file: ./TURN_SERVER/TURN_Server_Feature_9_Secure_Media_Relay_Testcase.csv :widths: 10,10,30,20 :header-rows: 1 .. _TURN_SERVER_step18: .. tab-set:: .. tab-item:: TURN_SERVER Feature : Resource Management **Resource Management - Testcases** .. csv-table:: :file: ./TURN_SERVER/TURN_Server_Feature_10_Resource_Management_Testcase.csv :widths: 10,10,30,20 :header-rows: 1 .. _TURN_SERVER_step21: .. tab-set:: .. tab-item:: Reference links * Reference links