Skip to main content

Home STUN server

STUN server

(also STUN)

STUN server definition

A STUN (Session Traversal Utilities for NAT) server is a software program that runs on a server or other computing device and answers incoming requests. The answers that it sends out also include the public IP address from which the request was sent. Therefore, a STUN server automatically tells you what your public IP address is.

With a STUN server, NAT clients can set up phone calls to a VoIP provider that is hosted outside of the local network. Clients can also find out the type of NAT they are behind. In addition, they can discover the internet side port associated by the NAT with a particular local port. With this information, you can set up UDP communication between the VoIP provider and the client and make calls.

See also: public IP, VoIP

STUN server message types

  • Binding requests. A client sends a binding request to a STUN server to ask the server what their public IP address is and to request identification of their NAT type. Clients use this type of message when they want to establish a peer-to-peer connection.
  • Binding response. In this case, the roles are reversed, and the STUN server sends a message to the client to respond to their binding request. A binding request includes the client’s public IP address and NAT type.
  • Binding error response. A STUN server sends a binding error response to clients when an error occurs while the server processes the request. It includes an error code and a reason phrase.