One of the major drawbacks of NAT is its applicability in many applications. To overcome this problem in VoIP applications there are several mechanisms. Session Traversal of User Datagram Protocol through Network address translator(STUN) is a protocol used by VoIP utilities for communication between the machines hidden behind a NAT gateways. STUN is a client server protocol.

A STUN client which is behind a NAT gateway sends a binding request to a STUN server, which may be behind another NAT gateway. “Binding request” provides a way of knowing about the NAT and providing a mechanism for client to send “shared secret request” to server. The server response contains parameters like gateway IP/port and STUN server’s local IP/port. These messages provide mapping between local and NAT gateway IP addresses and ports. There could be a number of exchanges between client and server to understand the NAT geometry.

STUN message header contains various type of request and response messages including error detection. While exchanging binding message and/or shared secret message “Transaction Ids” are used to recognize different packets from each other. STUN servers can detect anomalies and respond with error messages. These servers can masquerade IP address or Port in response packet as requested by client in order to gain information about NAT configuration.

STUN client uses DNS records to reach STUN servers. For reliability reasons the client keeps a timer to resend the binding request in case a response is not received within the timeout period. The response from the server determines next course of action. If an error response is returned client sends the error information to end user. Client keeps track of lifetime information about STUN session. In case of any changes in network configuration clients need to update the information. STUN does not deal with TCP packets and works only for control part of communication(e.g. SIP). It won’t work for all kinds of NAT, which is due to the inconsistent nature of NAT configuration.