Updated November 2026: Cloudflare STUN and TURN ports and relay limits from its September 2026 docs, coturn 4.18.0 upgrade note, TURN prices re-checked.
Why This Matters
If you ship a product that uses WebRTC — a video conferencing app, a telemedicine consultation, a browser-based surveillance viewer, a customer-support widget, an AI voice agent — then NAT traversal is the single most common reason a call fails to connect. The signalling worked, the cameras turned on, the SDP was exchanged, the user sees "connecting…" — and then nothing. Almost every such failure traces back to ICE, STUN, or TURN. A product manager or founder who does not understand this layer ends up paying a vendor per gigabyte for a problem that has open-source solutions, or runs a TURN cluster whose egress quietly becomes one of the biggest lines on the cloud bill. This article explains what each piece does, when each one is needed, what they cost, and the practical defaults a streaming or real-time product should ship with in 2026.
What is ICE in WebRTC? The short answer
ICE, short for Interactive Connectivity Establishment (IETF RFC 8445, July 2018), is the procedure a WebRTC browser or app runs to find a network path to the other side: it collects every address it might be reached on, swaps that list with the peer through your signalling server, tests each pair of addresses with small STUN probes and keeps the best pair that answers. STUN (RFC 8489) tells a device the public address the internet sees. TURN (RFC 8656) relays the media when no direct path works.
An ICE server is simply a STUN or TURN server that you list in the iceServers setting of RTCPeerConnection. It gives ICE somewhere to ask "what is my public address?" and somewhere to relay through. Your application server should hand these settings to the browser, with TURN credentials that expire within hours:
// ICE servers handed to the browser by your app server
const pc = new RTCPeerConnection({
iceServers: [
{ urls: "stun:stun.cloudflare.com:3478" },
{ urls: ["turn:turn.example.com:3478?transport=udp",
"turns:turn.example.com:443?transport=tcp"],
username: "1793000000:user-42", // expiry timestamp : user id
credential: "base64-hmac-from-your-server" }
]
});
STUN vs TURN vs ICE at a glance
STUN discovers, TURN relays, ICE decides. STUN and TURN are servers your product runs or rents; ICE is the logic inside every WebRTC endpoint that uses them. You need all three in production, because ICE without a TURN server has nothing to fall back on when both users sit behind strict NATs or firewalls.
| Question | STUN | TURN | ICE |
|---|---|---|---|
| Current spec | RFC 8489 (February 2020) | RFC 8656 (February 2020) | RFC 8445 (July 2018), Trickle ICE RFC 8838 (January 2021) |
| What it does | Tells a device its public IP and port | Relays media between peers | Gathers, pairs and tests candidate paths, picks one |
| Carries media? | No | Yes, every byte of relayed calls | No, it chooses the path media takes |
| Where it runs | Public server (UDP/TCP 3478, TLS 5349) | Public server (3478, 5349, ideally TLS on 443) | Inside the browser, app or media server |
| Cost | Near zero; public servers are free | Paid per GB relayed ($0.05–$0.80/GB managed, 2026) | None |
| Enough on its own? | Fails behind symmetric NAT | Works almost everywhere, at a latency and cost premium | Needs STUN and TURN servers to work with |
Free public STUN servers in 2026, including stun.cloudflare.com
stun.cloudflare.com is Cloudflare's public STUN server: a WebRTC client sends it a Binding Request on port 3478 and gets back the public IP address and port it was seen from, and Cloudflare states the service is free and unlimited (Cloudflare Realtime TURN FAQ, checked November 2026). Google's stun.l.google.com:19302 is the other address you will find in most tutorials. Both only tell a device its public address. Neither relays media, so neither helps a user behind a symmetric NAT or a firewall that blocks UDP; for that you need TURN.
| STUN server | Address for iceServers | Price (2026) | Note |
|---|---|---|---|
| Cloudflare | stun:stun.cloudflare.com:3478 | Free, unlimited | Anycast; Cloudflare's paid TURN at turn.cloudflare.com also answers STUN |
stun:stun.l.google.com:19302 | Free | Widely used in demos and samples | |
| Your own | stun:stun.yourdomain.com:3478 | One small VM | coturn or eturnal; no dependency on a third party |
stun.cloudflare.com and turn.cloudflare.com ports
Cloudflare lists one STUN entry, stun.cloudflare.com on UDP port 3478, so a network that blocks UDP gets no answer from it. Its TURN service at turn.cloudflare.com also answers STUN Binding Requests and listens on more ports, including TLS on 443 (Cloudflare TURN service page, updated September 2026).
| Protocol | Host | Primary port | Alternate port |
|---|---|---|---|
| STUN over UDP | stun.cloudflare.com | 3478/udp | none listed |
| TURN over UDP | turn.cloudflare.com | 3478/udp | 443/udp |
| TURN over TCP | turn.cloudflare.com | 3478/tcp | 80/tcp |
| TURN over TLS | turn.cloudflare.com | 5349/tcp | 443/tcp |
Before you put Cloudflare TURN into production, check its limits (Cloudflare Realtime TURN FAQ, updated July 2026). Relay addresses are IPv4 only, even though clients can reach the server over IPv6. TCP relaying from RFC 6062 is not implemented. Each allocation is capped at roughly 50–100 Mbps and 5–10 thousand packets per second, and packets above that are dropped. Relayed traffic costs nothing when you use it together with Cloudflare's Realtime SFU (Cloudflare TURN service page, September 2026).
Why stun.cloudflare.com shows up in your network logs
When stun.cloudflare.com appears in a DNS, Pi-hole or firewall log, a browser tab or app on that device has started a WebRTC session and asked Cloudflare for its public address. Video-call and remote-desktop apps built on WebRTC do this routinely. The request is a single small UDP packet to port 3478 and carries no audio or video. If you block the hostname, those apps fall back to other STUN or TURN servers in their configuration, or fail to connect.
What NAT is, in one paragraph
Network Address Translation — NAT — is the trick that lets every device in your home share one public IP address. Your laptop, your phone, your TV, and your thermostat all have private IP addresses inside the home network (192.168.x.x or 10.x.x.x), and the router holds a single public address (203.0.113.45). When the laptop sends a packet out to the internet, the router rewrites the source address from the laptop's private address to the router's public address, and remembers the mapping in a table. When the reply comes back, the router uses the table to rewrite the destination from public back to private and forwards the packet to the laptop. This is the mechanism the IETF specified in RFC 4787 (January 2007) and the reason the public internet did not run out of IPv4 addresses in 2008 the way every projection said it would. The cost: a device behind a NAT cannot be reached from the outside unless something on the inside opens a pinhole first. For an outbound HTTP request to Google, this is invisible. For an incoming WebRTC call from a stranger's phone, this is the entire problem.
The four flavours of NAT, and why one of them ruins your day
Different NAT boxes behave differently when a device sends packets out and another device tries to reply. The classical taxonomy comes from RFC 3489 (March 2003) — the original STUN specification — and even though RFC 8489 superseded it, the four-name taxonomy is still how the industry talks about NAT in 2026.
The first is Full-Cone NAT. Once a device behind the NAT sends a packet from internal address-and-port (X, x) to any external destination, the NAT creates a mapping to external address-and-port (X', x'), and any external host on the internet can send packets to (X', x') and they will be delivered to (X, x). The most permissive. Best behaved for WebRTC.
The second is Address-Restricted Cone NAT. The same mapping is created, but only external hosts that the internal device has already sent a packet to (matched by IP, not port) can send packets back. Most home routers behave this way.
The third is Port-Restricted Cone NAT. As above, but the external host has to match both the IP and the source port the internal device contacted. Still tractable for WebRTC: a STUN exchange tells each side what the other side will see, and they punch matching pinholes.
The fourth is Symmetric NAT. The NAT assigns a different external port for every distinct destination. The mapping the STUN server saw — (X', x'_stun) — is not the mapping the peer would need to use, because the peer is at a different destination address and gets a different port (X', x'_peer). The STUN-discovered candidate is useless. The two peers cannot find each other without help.
The modern, more precise terminology from RFC 4787 splits NAT behaviour into two independent properties: mapping behaviour (how the NAT assigns external ports — endpoint-independent, address-dependent, or address-and-port-dependent) and filtering behaviour (which external hosts are allowed to send packets back through the mapping). A NAT with endpoint-independent mapping and endpoint-independent filtering is what most people mean by "Full-Cone"; a NAT with address-and-port-dependent mapping is what most people mean by "Symmetric". The IETF prefers the RFC 4787 terms because they are precise; the streaming industry still uses the four-name taxonomy because everyone knows what it means.
The bad news for WebRTC: a meaningful slice of carrier-grade NAT (CGNAT) on mobile carriers, and a significant fraction of enterprise NAT, behave as symmetric NAT. The good news: ICE has a fallback — TURN — that handles the case. The whole architecture below exists to make symmetric NAT survivable.
STUN — the device learns its own public address
STUN — Session Traversal Utilities for NAT — is the smallest of the four protocols. It is a single-purpose tool: a device asks a public STUN server "what does my address look like to you?", and the STUN server replies with the public IP and port it observed in the request. The current specification is RFC 8489, published in February 2020, which obsoletes RFC 5389 from 2008. The on-the-wire format is a 20-byte fixed header followed by attribute-value pairs, sent over UDP (default port 3478), TCP (port 3478), or TLS over TCP (port 5349).
The exchange is one round trip. The client sends a Binding Request to the STUN server. The server sees the packet arriving from the NAT-rewritten address-and-port (X', x') and copies that pair into a XOR-MAPPED-ADDRESS attribute in the Binding Response. The client now knows its own public-facing address — at least, the one this particular NAT mapping uses for this particular destination. This is called a server-reflexive candidate, abbreviated srflx.
Two things matter about that wording. First, server-reflexive — the address is the reflection the server saw, not an absolute property of the device. A symmetric NAT will give a different reflexive address for every destination, which is exactly why STUN alone is not enough for symmetric NAT. Second, candidate — the address is one of several possible routes for an incoming packet to take, and ICE will rank it among the others (host, relay) and try them in priority order.
STUN servers are stateless and cheap to run. Google operates stun.l.google.com:19302 as a free public STUN endpoint, and Cloudflare runs stun.cloudflare.com:3478, which it describes as free and unlimited (2026). A STUN answer is one small packet, so the smallest cloud VM running coturn or eturnal covers a typical product's STUN load. Many teams still run their own to avoid depending on a third party's uptime.
STUN does not relay media. STUN does not authenticate peers. STUN does not survive network changes. It is a single-question, single-answer probe whose only job is to tell the device how the outside world sees it. The protocols that do the real work — TURN and ICE — are built on top of STUN's message format.
TURN — the relay server, for when nothing else works
TURN — Traversal Using Relays around NAT — is the fallback when direct peer-to-peer connectivity is impossible. The current specification is RFC 8656, also from February 2020, which obsoletes the original TURN RFC (5766, April 2010) and its IPv6 addendum (RFC 6156, April 2011). TURN extends STUN: a TURN server is a STUN server with the extra ability to act as a media relay.
The mechanics are simple to describe. A WebRTC client connects to a TURN server and asks it to allocate a public address and port — an "allocation". The TURN server replies with a public address-and-port pair (T, t) reserved for that client. Anything sent to (T, t) from the internet gets forwarded over the existing client-server connection to the WebRTC client. Anything the WebRTC client wants to send to a peer, it sends through the TURN server, which forwards it from (T, t) to the peer's address. The allocation lasts as long as the client refreshes it (the default lifetime is 600 seconds; the client refreshes every 5 minutes).
Two consequences fall out of that design. First, every byte of media goes through the TURN server twice — once from client A to TURN, once from TURN to client B. For a 2-megabit-per-second video call, the TURN server moves 4 megabits per second per call. For 1,000 concurrent relayed calls, the TURN server moves 4 gigabits per second per direction. This is why TURN bandwidth is the single biggest line item in a WebRTC infrastructure budget. Second, the latency added by TURN is the round-trip delay between client and TURN server, doubled — typically 20–60 ms for a well-placed TURN cluster, 100 ms or more if the TURN server is on the wrong continent.
TURN servers require authentication. RFC 8656 reuses the long-term credential mechanism of STUN (RFC 8489 §9.2), and almost every production deployment adds the time-limited scheme from the IETF "TURN REST API" draft (draft-uberti-behave-turn-rest, 2013) on top. Your application server gives the client a username made of an expiry Unix timestamp plus a user identifier. The password is an HMAC-SHA1 of that username, keyed with a secret that only the application server and the TURN server know.
The TURN server recomputes the HMAC, checks that the timestamp has not passed, and accepts the client without any user database. A leaked credential stops working when its timestamp expires. Managed services follow the same idea: Cloudflare, for example, lets a TURN credential live at most 48 hours (Cloudflare Realtime TURN FAQ, 2026). RFC 8489 also added SHA-256 message integrity next to the original SHA-1, which newer servers and clients can negotiate.
TURN listens on UDP/3478, TCP/3478, and TLS over TCP on port 5349. Most production deployments also expose TLS on port 443 — labelled "turns" in the ICE candidate URL — because port 443 looks like HTTPS to the corporate firewalls that drop everything else. The result: a TURN-over-TLS-on-443 candidate is the universal fallback that gets through almost any network. The cost is that the call rides over TCP (latency-sensitive) instead of UDP, but a call that connects with 200 ms of one-way latency beats a call that does not connect at all.
The 2026 production reality for TURN looks like this. Coturn, the open-source server originally written by Oleg Moskalenko, is still the default most teams reach for, and it is actively maintained: version 4.18.0 shipped on 8 September 2026 and removed three turnserver flags (--drop-invalid-packets, --no-dtls and --no-cli), so check old config files before you upgrade. eturnal, written in Erlang by ProcessOne (the team behind ejabberd), is an independent alternative to coturn rather than a fork of it. Pion TURN, now on its v5 module line, is a Go toolkit for embedding a TURN server inside Go media servers; LiveKit, for example, ships a built-in TURN server so clients on UDP-blocking networks can still reach it.
Managed TURN is priced per gigabyte of relayed traffic. Twilio's Network Traversal Service charges $0.40 per GB in the US and Europe and $0.60–$0.80 per GB in Asia-Pacific and South America. Cloudflare Realtime TURN charges $0.05 per GB after the first 1,000 GB each month, and only for traffic sent from Cloudflare to the client (both price pages, checked November 2026). Xirsys and Metered sell similar plans. All of them speak the same RFC 8656 protocol, so switching providers is a configuration change, not a rewrite.
ICE — the algorithm that picks the path
ICE — Interactive Connectivity Establishment — is the algorithm that ties STUN and TURN together. The current specification is RFC 8445, published in July 2018, which obsoletes RFC 5245 from 2010. ICE does three things: it gathers every possible address each peer might be reachable on, it pairs every local address with every remote address to form a list of candidate pairs, and it tests every pair until it finds a working route. The whole point of ICE is to avoid hard-coding any single strategy for NAT traversal — instead, the algorithm tries every plausible path in parallel and keeps the one that works.
A candidate is one of four kinds. A host candidate is the device's real network address — a Wi-Fi interface, a 5G interface, a wired Ethernet interface. A server-reflexive candidate is the public address learned from a STUN server (the srflx from earlier). A peer-reflexive candidate is a public address learned during the connectivity-check itself, when a peer's STUN probe shows the device an address it had not yet observed — this happens when the NAT mapping was created mid-call. A relay candidate is a TURN-allocated relayed transport address.
The connectivity check uses STUN's Binding Request message, but this time peer-to-peer rather than client-to-server. Each pair is tested in priority order; ICE's priority formula favours host candidates first, then peer-reflexive, then server-reflexive, then relay (RFC 8445 recommends type preferences of 126, 110, 100 and 0). A pair becomes "valid" when one side sends a STUN Binding Request to the other side and gets a Binding Response back from the expected address. The first valid pair goes into the "selected pair" slot and the call connects; ICE keeps testing other pairs in the background and can switch to a better one.
Once a pair is selected, STUN keeps watching it. RFC 7675 specifies the consent freshness protocol: about every 5 seconds (randomised between 4 and 6), each side sends a Binding Request over the selected pair, and if no answer arrives for 30 seconds, consent expires and media must stop. Separately, RFC 8445 asks each side to send a keepalive at least every 15 seconds so the NAT mapping stays open. Together they detect a dead path; the application then runs an ICE restart to find a new one, for example after a phone moves from Wi-Fi to 5G.
Trickle ICE, specified separately in RFC 8838 (January 2021), is the optimisation that nearly every modern WebRTC stack uses by default. Instead of waiting until every candidate is gathered before sending them to the peer, each side sends candidates over the signalling channel as they are discovered. The slowest step, waiting for a distant TURN server to answer, leaves the critical path: the call can connect on the first working pair while later candidates are still arriving.
The end-to-end story — what happens when you click "join call"
A user clicks "join" in a browser. The browser opens the camera, the microphone, and creates an RTCPeerConnection. The application server has already given the browser a list of ICE servers — a STUN URL and a TURN URL with short-lived credentials. The browser starts ICE.
In parallel, the browser does five things. It enumerates every network interface — Wi-Fi, 5G, Ethernet — and creates a host candidate for each one. It sends a STUN Binding Request to the STUN server from each interface and waits for the server-reflexive candidate to come back. It sends a TURN Allocate request to the TURN server from each interface and waits for the relay candidate to come back. It generates an SDP offer that lists every candidate gathered so far. And it sends the offer through the application's signalling channel (WebSocket, HTTP long-poll, gRPC — the signalling transport is outside ICE's scope) to the other peer.
The other peer does the symmetric thing. It receives the offer, generates an SDP answer with its own list of candidates, and sends the answer back. Both peers trickle additional candidates as they finish gathering. Each side pairs every local candidate with every remote candidate, computes a priority for each pair using the formula in RFC 8445 §6.1.2.3 (essentially 2^32 × min(G,D) + 2 × max(G,D) + (G > D ? 1 : 0)), sorts the pairs by priority, and starts sending STUN Binding Requests on each pair in priority order with a small pacing delay (Ta, default 50 ms).
A pair succeeds when a Binding Request gets a Binding Response back with the expected transaction ID and authentication. The first pair to succeed becomes the selected pair, the media starts flowing, and the user hears the other person speak. ICE keeps testing other pairs in the background for the next few seconds; if a better pair completes (host-host wins over host-relay every time), the media switches over silently.
As a rule of thumb from our own deployments, a home-to-home call connects in well under a second, while a call where only the TLS-over-443 TURN candidate works takes noticeably longer, often a second or more. The difference comes almost entirely from how long it takes to discover that the cheaper candidates do not work.
A worked example — TURN bandwidth math for a 1,000-seat product
A founder is planning the infrastructure for a video meeting product expected to host 1,000 simultaneous one-on-one calls at peak. Average call bitrate: 1.5 Mbps of video plus 50 kbps of audio per direction, so ~1.6 Mbps × 2 directions = 3.2 Mbps per call total. Industry estimates for the share of consumer sessions that need TURN usually fall between 15 and 25 %; we use 20 % here. Replace it with your own number: in getStats(), count the calls whose selected candidate pair is of type relay.
Step one: how many calls go through TURN? 1,000 calls × 20 % = 200 calls relayed.
Step two: TURN traffic per relayed call. The relay receives each direction's 1.6 Mbps from one peer and sends it on to the other. So it carries 3.2 Mbps in and 3.2 Mbps out for every relayed call. Cloud providers bill the outbound half, called egress: 3.2 Mbps per relayed call.
Step three: peak load. 200 calls × 3.2 Mbps = 640 Mbps of egress at peak. The TURN servers' network ports must handle twice that, 1.28 Gbps, because inbound traffic flows through them too.
Step four: monthly egress. Peak is not average. Assume the monthly average is 12.5 % of peak, a heuristic for business video products with a strong busy hour: 640 Mbps × 12.5 % = 80 Mbps. Then 80 Mbps ÷ 8 = 10 MB/s, and 10 MB/s × 86,400 s × 30 days ≈ 25.9 TB of egress per month.
Step five: what that costs. On AWS EC2, internet egress costs $0.09 per GB for the first 10 TB and $0.085 per GB for the next 40 TB, with 100 GB free each month (AWS pricing, verified April 2026). 25.9 TB comes to about $2,250 a month. On Cloudflare Realtime TURN at $0.05 per GB after 1,000 free GB, the same traffic costs about $1,250. On Twilio's Network Traversal Service at $0.40 per GB in the US and Europe, it costs about $10,400.
Step six: what moves the number. The bill grows in a straight line with three inputs: relay fraction, bitrate and hours of use. Double the relay fraction to 40 %, which is realistic for a customer base of large enterprises, and every figure above doubles. A busier average than 12.5 % of peak does the same. Self-hosted TURN on bare-metal servers with flat-rate bandwidth turns the per-GB bill into a fixed server cost. That is why measuring your real relay fraction matters more than picking the cheapest provider; the TURN bandwidth calculator runs this math with your own inputs.
AI voice agents change the shape of this math rather than multiplying it. The agent usually runs next to a media server, such as a LiveKit SFU, that has a public IP address. Most users then reach it directly over UDP and need no relay at all. The users who do need TURN are the ones whose network blocks UDP, and for them the relay must offer TLS on port 443. Plan TURN capacity from the share of your users on locked-down networks, not from the fact that the product is an AI agent.
Common pitfalls
Pitfall 1: trusting STUN-only on a symmetric NAT. Many demos use only a STUN server. They work fine until the first user on a mobile carrier — most of which run symmetric CGNAT — joins the call, and connectivity fails silently. Always include at least one TURN server in your ICE configuration. The fallback is the entire point.
Pitfall 2: TURN over UDP only. Corporate firewalls routinely block UDP altogether and force everything through TCP/443. A TURN candidate on turn:host:3478?transport=udp is useless inside such a network. Always also expose turns:host:443?transport=tcp (TLS-over-TCP on 443). The browser will pick the cheapest one that works.
Pitfall 3: long-lived TURN credentials. A handful of vendor tutorials still show TURN credentials hardcoded in client-side JavaScript. Anyone who opens devtools can extract them and use your TURN cluster as free egress for years. Always mint short-lived credentials server-side, signed with a shared secret, scoped to the call. The common HMAC-SHA1 format comes from the TURN REST API draft and sits on the long-term credential mechanism of RFC 8489 §9.2.
Pitfall 4: one TURN server on one continent. Latency added by TURN equals the round-trip time between client and TURN server, doubled. A call between two users in São Paulo relayed through a TURN server in Virginia adds 240 ms of latency for no reason. Deploy TURN geographically close to your users — at least one cluster per major continent, with anycast or geo-DNS in front.
Pitfall 5: forgetting keepalives and consent freshness. RFC 8445 asks each side to send a keepalive on the selected pair at least every 15 seconds, and RFC 7675 adds consent checks about every 5 seconds. Some homegrown stacks skip both. That works until a NAT mapping idles out (many home routers reclaim UDP mappings after 30–60 seconds of silence) and the call drops mid-conversation with no diagnostic.
STUN, TURN and ICE FAQ
What is ICE in WebRTC?
ICE (Interactive Connectivity Establishment, RFC 8445) is the procedure every WebRTC endpoint runs to find a working network path: it gathers host, server-reflexive and relay candidates, exchanges them with the peer, tests each pair with STUN checks and keeps the best pair that answers. For candidate priorities and the connectivity-check state machine one level down, see our ICE candidate deep dive.
What is an ICE server in WebRTC?
An ICE server is a STUN or TURN server listed in the iceServers array of RTCPeerConnection. STUN entries let the browser learn its public address; TURN entries, which need a username and credential, give it a relay when no direct path works.
What is the difference between STUN and TURN?
STUN only tells a device the public IP address and port the internet sees, costs almost nothing and carries no media. TURN relays the actual audio and video when a direct path fails, so it carries every byte of those calls and is billed per gigabyte.
What is stun.cloudflare.com?
stun.cloudflare.com is Cloudflare's public STUN server, reached at stun:stun.cloudflare.com:3478. Cloudflare describes it as free and unlimited (2026); it returns your public address but does not relay media, which needs Cloudflare's paid TURN service at turn.cloudflare.com or another TURN server.
Which ports do stun.cloudflare.com and turn.cloudflare.com use?
stun.cloudflare.com answers on UDP port 3478. turn.cloudflare.com answers on UDP 3478 and 443, TCP 3478 and 80, and TLS 5349 and 443 (Cloudflare docs, September 2026); list the TLS-on-443 URL so users on networks that block UDP can still connect.
What is a srflx candidate?
A srflx (server-reflexive) candidate is the public IP address and port a STUN server saw a device's request come from. ICE tries it after host candidates; behind a symmetric NAT it usually fails, and a relay candidate from TURN takes over.
Which RFCs define STUN, TURN and ICE?
STUN is RFC 8489 (February 2020), TURN is RFC 8656 (February 2020), and ICE is RFC 8445 (July 2018). Trickle ICE is RFC 8838 (January 2021), consent freshness is RFC 7675 (October 2015), and NAT behaviour terminology is RFC 4787 (January 2007).
Does every WebRTC app need a TURN server?
Yes, for production. Without TURN, users behind symmetric NAT or firewalls that block UDP cannot connect at all; industry estimates put that share at 15–25 % of consumer sessions, and higher for enterprise users.
How much does a TURN server cost?
TURN cost is relayed bandwidth: in 2026 Cloudflare charges $0.05 per GB after 1,000 free GB a month, Twilio $0.40–$0.80 per GB, and AWS egress for a self-run server $0.05–$0.09 per GB. A 1,000-call product with 20 % relayed calls moves about 26 TB a month; the TURN bandwidth calculator sizes your own case.
How do I test whether my TURN server works?
Create an RTCPeerConnection with iceTransportPolicy: "relay", which forbids every candidate except TURN, and check that a call still connects and that getStats() reports a selected pair of type relay. The WebRTC project's Trickle ICE sample page also lists the candidates your STUN and TURN servers return.
What is symmetric NAT?
Symmetric NAT gives a device a different public port for every destination it talks to, so the address STUN discovered is useless to the peer. RFC 4787 calls this address-and-port-dependent mapping; it is common on mobile carrier-grade NAT and enterprise firewalls, and TURN is the only reliable way through it.
Free download: NAT, STUN, TURN Deployment ChecklistOne page for opening the right ports, minting short-lived TURN credentials, placing TURN clusters geographically, picking observability KPIs, and a worked bandwidth and cost model for a 1,000-seat product.Where Fora Soft Fits In
Fora Soft has been building WebRTC and conferencing software since 2005, with 250+ shipped projects across video conferencing, OTT, telemedicine, e-learning, video surveillance, and AR/VR. NAT traversal is the part of WebRTC most teams underestimate — the SDP offer/answer is documented in every tutorial, the cameras and microphones are well-supported in the browser, the SFU options (mediasoup, Janus, LiveKit, Pion) are well understood. What separates a product that works in a demo from a product that works for a Brazilian mobile carrier customer on a corporate office Wi-Fi is the TURN cluster — its placement, its credentials story, its observability, and its cost discipline. We run TURN clusters for clients on dedicated bare-metal and on hyperscaler infrastructure, instrument them with per-call cost attribution, and pair them with multi-region SFU deployments where the call topology calls for it. If your calls fail behind corporate firewalls, our WebRTC developers fix the ICE and TURN layer, and our WebRTC architecture team plans the multi-region relay and SFU layout. If you only need a second pair of eyes on an existing setup, our WebRTC consulting review covers ICE configuration, TURN placement and the relay share behind your bill.
The book
Video Streaming: A Complete Guide to Video Delivery: From Network Protocols and Transport to Ingest, HLS, and MPEG-DASH
This article follows one call from a phone behind a NAT to a working path. Book 2 covers the network under that path in the same detail: what NAT, loss and jitter do to a stream, TCP against UDP, congestion control, QUIC and HTTP/3, and the ingest protocols that cross the same firewalls. Book 3 picks up where ICE ends, with WebRTC topologies, SFUs and the economics of relayed traffic. Both belong to a seven-volume handbook that covers the whole video stack from the pixel to production, so an engineer who works through it can design and run a WebRTC product whose calls connect on every network. Written by Nikolay Sapunov, CEO at Fora Soft.
Are your calls failing on mobile networks and office Wi-Fi?
Send us your ICE configuration, your TURN setup and the share of calls that fail or fall back to relay, and we will find where connectivity breaks, size and place the TURN cluster for your traffic, and estimate what relayed bandwidth will cost you at peak. 250+ video products shipped since 2005.
See our case studies
Case study
Nucleus
An on-premise Slack alternative for Fibernetics, a Canadian telecom, with WebRTC and SIP video and audio calls over both cellular and online networks — business users behind office firewalls and phones on carrier NAT in the same call.
Case study
ProVideoMeeting
A WebRTC and FreeSWITCH conferencing service with in-call document signing, full mobile browser support and phone dial-in — guests join from whatever network they happen to be on, with no app to install.
What to read next
WebRTC
ICE, STUN, TURN in Depth
Candidate priorities, the connectivity-check state machine and consent freshness, one level down.
Economics
TURN Bandwidth Calculator: What Your WebRTC Relay Traffic Actually Costs
The 1,000-seat math from this article, with your own relay fraction and bitrate.
WebRTC
WebRTC Explained Without Arcana
Where ICE sits among signalling, SDP, DTLS-SRTP and the media engine.
Transport
TCP, UDP, and the Choice Every Streaming Protocol Must Make
Why WebRTC wants UDP, and what it loses when TURN falls back to TCP or TLS on 443.
References
- IETF RFC 8489, Session Traversal Utilities for NAT (STUN), M. Petit-Huguenin et al., February 2020. Obsoletes RFC 5389. The controlling specification for STUN message format, attributes, and the discovery flow. <https://datatracker.ietf.org/doc/html/rfc8489>
- IETF RFC 8656, Traversal Using Relays around NAT (TURN): Relay Extensions to STUN, T. Reddy et al., February 2020. Obsoletes RFC 5766 and RFC 6156. The controlling specification for TURN allocation, permissions, channels, and the short-lived-credential mechanism. <https://datatracker.ietf.org/doc/html/rfc8656>
- IETF RFC 8445, Interactive Connectivity Establishment (ICE): A Protocol for NAT Traversal, A. Keränen, C. Holmberg, J. Rosenberg, July 2018. Obsoletes RFC 5245. The controlling specification for ICE candidate gathering, pairing, priority computation, and the connectivity-check state machine. <https://datatracker.ietf.org/doc/html/rfc8445>
- IETF RFC 8838, Trickle ICE: Incremental Provisioning of Candidates for the ICE Protocol, E. Ivov, J. Uberti, P. Saint-Andre, January 2021. The standard for sending candidates incrementally over the signalling channel instead of waiting for full gathering. <https://datatracker.ietf.org/doc/html/rfc8838>
- IETF RFC 4787, Network Address Translation (NAT) Behavioral Requirements for Unicast UDP, F. Audet, C. Jennings, January 2007. BCP 127. The IETF's terminology for NAT mapping and filtering behaviours; the modern replacement for the four-name taxonomy. <https://datatracker.ietf.org/doc/html/rfc4787>
- IETF RFC 5780, NAT Behavior Discovery Using STUN, D. MacDonald, B. Lowekamp, May 2010. The STUN-based technique for probing what kind of NAT a device sits behind. <https://datatracker.ietf.org/doc/html/rfc5780>
- IETF RFC 7675, STUN Usage for Consent Freshness, M. Perumal et al., October 2015. The keep-alive mechanism that detects path failure on a selected ICE pair. <https://datatracker.ietf.org/doc/html/rfc7675>
- IETF RFC 8826, Security Considerations for WebRTC, E. Rescorla, January 2021. The security model that frames why TURN credentials must be short-lived and why DTLS-SRTP is mandatory. <https://datatracker.ietf.org/doc/html/rfc8826>
- W3C WebRTC 1.0 Recommendation, WebRTC: Real-Time Communication Between Browsers, W3C Recommendation, 13 March 2025. The W3C surface that exposes ICE candidates as JavaScript objects on
RTCPeerConnection. <https://www.w3.org/TR/webrtc/> - coturn project repository, the de-facto open-source TURN server reference implementation; release 4.18.0, 8 September 2026, which removed the
--drop-invalid-packets,--no-dtlsand--no-cliflags. <https://github.com/coturn/coturn> - eturnal documentation, the ProcessOne STUN/TURN server written in Erlang, an independent alternative to coturn. <https://eturnal.net/>
- Pion TURN repository, the Go-language TURN toolkit popular in cloud-native deployments; v5 module line, checked November 2026. <https://github.com/pion/turn>
- WebRTC for the Curious, "Connecting", a high-quality open-source book by the Pion maintainers explaining ICE/STUN/TURN with code examples. Used as a secondary reference per §4.3.2; the spec is always the source of truth. <https://webrtcforthecurious.com/docs/03-connecting/>
- Cloudflare Realtime TURN FAQ, Cloudflare developer documentation, updated July 2026, checked November 2026. TURN at $0.05 per GB after 1,000 free GB a month, billed on edge-to-client traffic; free, unlimited STUN at stun.cloudflare.com; credentials valid up to 48 hours; IPv4-only relay addresses, no RFC 6062 TCP relaying. <https://developers.cloudflare.com/realtime/turn/faq/>
- Cloudflare TURN service, Cloudflare developer documentation, updated September 2026. STUN on stun.cloudflare.com 3478/udp; TURN on turn.cloudflare.com 3478/udp (alt 443), 3478/tcp (alt 80), TLS 5349 (alt 443); anycast; free when used with Cloudflare Realtime SFU; per-allocation limits around 50–100 Mbps. <https://developers.cloudflare.com/realtime/turn/>
- Twilio Network Traversal Service pricing, checked November 2026. Free STUN; TURN $0.40 per GB in the US and Europe, $0.60–$0.80 per GB in Asia-Pacific and South America. <https://www.twilio.com/en-us/stun-turn/pricing>
- CloudZero, AWS Egress Costs, updated May 2026 (pricing verified April 2026). EC2 internet egress $0.09/GB for the first 10 TB, $0.085/GB for the next 40 TB, 100 GB free per month. <https://www.cloudzero.com/blog/aws-egress-costs>
- IETF draft-uberti-behave-turn-rest-00, A REST API For Access To TURN Services, J. Uberti, 2013. The origin of the timestamp-plus-HMAC short-lived TURN credential format used by coturn, eturnal and most managed services. <https://datatracker.ietf.org/doc/html/draft-uberti-behave-turn-rest-00>
Per §4.3.2, in any disagreement between sources, the article follows the controlling IETF specification and notes the discrepancy. Several popular vendor blog posts still describe TURN credentials as long-lived; we follow the long-term credential mechanism of RFC 8489 §9.2 with the time-limited TURN REST API scheme on top, and explicitly recommend short-lived HMAC-signed credentials.
