Introduction: The Two-Way Mirror Problem
Network Address Translation (NAT) is great for hiding your home computers. But it creates a 'Two-Way Mirror'. You can see the internet, but the internet can't see you. So, how does a Peer-to-Peer service like a Zoom call or a Voice Chat actually connect to your computer? It uses NAT Traversal.
The Tools: STUN and TURN
To establish a connection, applications use special 'Helper' servers:
- STUN: The application asks the STUN server, "What does my Public IP and Port look like from the outside?" It then gives that public 'Address' to the other person on the call to connect to.
- TURN: If a router is extremely strict and blocks STUN, the application uses a TURN server. The TURN server acts as a giant 'Relay' in the cloud. Both users send their voice data to the TURN server, and it copies it to the other person.
Conclusion
Without NAT Traversal techniques like STUN and TURN, real-time peer-to-peer communication on the modern web would be nearly impossible. Check your WebRTC stun capability here.