A STUN (Session Traversal of User Datagram Protocol [UDP] Through Network Address Translators [NATs]) server allows NAT clients (i.e. IP Phones behind a firewall) to set up phone calls to a VoIP provider hosted outside of the local network.

STUN Server Diagram
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. The STUN protocol is defined in RFC 3489.

The STUN server is contacted on UDP port 3478, however, the server will hint clients to perform tests on alternate IP and port number too (STUN servers have two IP addresses). The RFC states that this port and IP are arbitrary.

Stun functionality is seamlessly handled by 3CX - an easy to install PBX.



内网机器往 发送了一个 STUN Binding 的包,这是通过 UDP 传输的,所以这个请求会在运营商里面打开一个临时的 UDP 通道。

内网机器就是通过这个 临时的 UDP 通道 跟 STUN 服务器通信。所以这个 UDP 通道的信息,STUN 服务器是知道的。因此 STUN 服务器可以把这个 UDP 通道信息 放在 STUN Response 里面返回给 内网的机器。

标签: none