A while back we wrote post about WebRTC technology. Today, we'll continue to remind some basics about WebRTC and learn few things about STUN. Web Real-Time Communication (RTC) is an open standard for embedding real-time multimedia communications directly to a web browser, via VP8 video codec, which is free. WebRTC uses a server called Web Conferencing Server that in conjunction with a STUN Server it is required to provide the initial page and synchronize the connections between two WebRTC endpoints, between two phones. Hence the question What is STUN Server?
STUN (Simple Traversal of UDP through NATs (Network Address Translation)) is a protocol for assisting devices behind a NAT firewall or router with their packet routing. Basically, it allows all clients on a LAN, behind a firewall/router, to set up phone calls to a VoIP provider located outside of the local network.
NAT stands for Network Address Translation. (First thing you probably learn in IT, right?). In general, it is the process used by routers to modify IP information by translating local IP addresses on a private subnet to public IP addresses usually assigned by an Internet service provider (ISP). They present a major challenge when attempting to establish direct connections between clients on a network. There are a cases, where you can have static public IP but usually, those are paid options. (From my own experience I had this option for free only once, but since then I moved to another house and changed ISP…).
The STUN server allows clients to find out their public address, the type of NAT they are behind and the Internet side port associated by the NAT with a particular local port. This information is used to set up UDP communication between the client and the VoIP provider to establish a call.
How does it work? The client, usually inside a private network, sends a binding request to a STUN server on the public Internet. The STUN server responds with a success response that contains the IP address and port number of the client, as observed from the server's perspective.
The result is obfuscated through exclusive or (XOR) mapping to avoid translation of the packet content by application layer gateways (ALGs) that perform deep packet inspection in an attempt to perform alternate NAT traversal methods.
STUN messages are sent in User Datagram Protocol (UDP) packets.
Img. courtesy of 3CX.com
Generally, it is recommended to use STUN options for any ATA devices connected behind a non-symmetrical NAT/Firewall router. This will avoid some manual labors to perform ports forwarding on the NAT/Firewall router.
Definitions (from the RFC)
- STUN Client – A STUN client (also just referred to as a client) is an entity that generates STUN requests. A STUN client can execute on an end system, such as a user's PC, or can run in a network element, such as a conferencing server.
- STUN Server – A STUN Server (also just referred to as a server) is an entity that receives STUN requests, and sends STUN responses. STUN servers are generally attached to the public Internet.
STUN is basically a NAT helper.
Img. courtesy of positrontelecom.com
Where can I get STUN server?
There are some open source STUN servers, but there is also a STUN server baked in the Free edition of 3CX package, which you can run on Window, Linux or MiniPC for $100. So yes, STUN server can be set up different ways.
The STUN Protocol, or Session Traversal Utilities for NAT, can assist devices behind a NAT firewall or router with routing UDP packets. The router-related problems can lead to a wide range of issues, including one-way or lost audio, no dial or ring tones, intermittent loss of registration, and problems making or receiving calls.
Usually, it is enough to know that STUN can solve many NAT router-related problems but isn't designed to be a solution in every situation. You may need to omit STUN, or use it as a part of a complete solution.
More about PBX systems, 3CX, WebRTC on ESX Virtualization:
- Debian for 3CX on MiniPC and How-to prepare an USB key for Installation
- Three Simple Steps to Install 3CX Debian Appliance
- 3CX on a $100 MiniPC – Tips
- WebRTC and Free Edition of 3CX – some details
- 3CX Phone System Backup Options
- Free Tools
Stay tuned through RSS, and social media channels (Twitter, FB, YouTube)