STUN

Business PBX Solutions
Provider Solution Details
Intuitive Technology
  • Simple and powerful
  • Integrated Multisite Administration
  • Complete System for $1299
Details
3CX Software PBX for Windows
  • Windows Software Solution
  • Easy to Install and Manage
  • Auto Configures Phones & Trunks
  • Android, iOS, Windows & Mac clients
Details
Bicom VoIP Become an ITSP Now!
  • Become a serious competitor in VoIP Immediately
  • FULL Consultancy, Installation, Training & Support
  • Sell Hosted IP PBXs, Biz Lines, Call Centre
  • Turnkey Provisioning at your data center
Details
Contact Center 4PSA's VoipNow Cloud Communications Platform
  • 30 Day Free Trial - Pay-As-You-Grow!
  • Your fastest go-to-market solution - from deployment to billing.
  • Professional support, training and knowledge base to help you grow your business
  • On your infrastructure or cloud-based, it's up to you.
Details
STUN (Simple Traversal of UDP through NATs (Network Address Translation)) is a protocol for assisting devices behind a NAT firewall or router with their packet routing. RFC 5389 redefines the term STUN as 'Session Traversal Utilities for NAT'.

Note: The STUN RFC states: This protocol is not a cure-all for the problems associated with NAT.


  • STUN enables a device to find out its public IP address and the type of NAT service its sitting behind.
  • STUN operates on TCP and UDP port 3478.
  • STUN is not widely supported by VOIP devices yet.
  • STUN may use DNS SRV records to find STUN servers attached to a domain. The service name is _stun._udp or _stun._tcp

Definitions (from the RFC)

  • STUN Client: A STUN client (also just referred to as a client) is an entity that generates STUN requests. A STUN client can execute on an end system, such as a user's PC, or can run in a network element, such as a conferencing server.
  • STUN Server: A STUN Server (also just referred to as a server) is an entity that receives STUN requests, and sends STUN responses. STUN servers are generally attached to the public Internet.

Various types of NAT (still according to the RFC)
  • Full Cone: A full cone NAT is one where all requests from the same internal IP address and port are mapped to the same external IP address and port. Furthermore, any external host can send a packet to the internal host, by sending a packet to the mapped external address.
  • Restricted Cone: A restricted cone NAT is one where all requests from the same internal IP address and port are mapped to the same external IP address and port. Unlike a full cone NAT, an external host (with IP address X) can send a packet to the internal host only if the internal host had previously sent a packet to IP address X.
  • Port Restricted Cone: A port restricted cone NAT is like a restricted cone NAT, but the restriction includes port numbers. Specifically, an external host can send a packet, with source IP address X and source port P, to the internal host only if the internal host had previously sent a packet to IP address X and port P.
  • Symmetric: A symmetric NAT is one where all requests from the same internal IP address and port, to a specific destination IP address and port, are mapped to the same external IP address and port. If the same host sends a packet with the same source address and port, but to a different destination, a different mapping is used. Furthermore, only the external host that receives a packet can send a UDP packet back to the internal host.



Closing words (also from the obsolete RFC 3489)

14.6 In Closing

The problems with STUN are not design flaws in STUN. The problems in STUN have to do with the lack of standardized behaviors and controls in NATs. The result of this lack of standardization has been a proliferation of devices whose behavior is highly unpredictable, extremely variable, and uncontrollable. STUN does the best it can in such a hostile environment. Ultimately, the solution is to make the environment less hostile, and to introduce controls and standardized behaviors into NAT. However, until such time as that happens, STUN provides a good short term solution given the terrible conditions under which it is forced to operate.





Standard documents

STUN RFC RFC 3489, now obsolete (Oct 2008)
STUN RFC RFC 5389 (Current as per October 2008)

Update to STUN protocol

STUN standard is currently has been rewritten with RFC 5389. See details in STUN-bis

Extensions to STUN protocol

RFC 5780 defines a STUN extension to support the NAT Behavior Discovery procedure. It borrows some details from the original RFC 3489 STUN specs.
RFC 5769 defines test vectors for STUN implementation validation.

Software

  • STUNTMAN - is an open source STUN server and client library
  • STUN & TURN Server - is an open source STUN & TURN Server (and client library), for UNIX/Linux platforms.
  • vovida.org has an open source STUN server: vovida.org STUN server
  • a Linux open source STUN server is also available here myStun
  • a Java STUN library (includes a STUN client): JSTUN
  • a Microsoft windows based simple STUN server: miniSipServer
  • PJNATH library from pjsip.org project is an Open Source NAT traversal library supporting STUN, TURN, and ICE.


Public STUN servers

  • provserver.televolution.net (out of service)
  • sip1.lakedestiny.cordiaip.com (out of service)
  • stun1.voiceeclipse.net
  • stun01.sipphone.com (out of service)
  • stun.callwithus.com
  • stun.counterpath.net
  • stun.endigovoip.com (out of service)
  • stun.ekiga.net (alias for stun01.sipphone.com)
  • stun.ideasip.com (no XOR_MAPPED_ADDRESS support)
  • stun.internetcalls.com
  • stun.ipns.com (out of service)
  • stun.noc.ams-ix.net
  • stun.phonepower.com (out of service)
  • stun.phoneserve.com
  • stun.rnktel.com (out of service)
  • stun.softjoys.com (no DNS SRV record) (no XOR_MAPPED_ADDRESS support)
  • stunserver.org see their usage policy
  • stun.sipgate.net
  • stun.sipgate.net:10000
  • stun.stunprotocol.org
  • stun.voip.aebc.com
  • stun.voipbuster.com (no DNS SRV record) (no XOR_MAPPED_ADDRESS support)
  • stun.voxalot.com (out of service)
  • stun.voxgratia.org (no DNS SRV record) (no XOR_MAPPED_ADDRESS support)
  • stun.xten.com (out of service)
  • numb.viagenie.ca (http://numb.viagenie.ca) (XOR_MAPPED_ADDRESS only with rfc3489bis magic number in transaction ID)
  • stun.ipshka.com inside UA-IX zone russsian explanation at http://www.ipshka.com/main/help/hlp_stun.php

List of 267 public STUN servers from EmerCoin project: http://emc.cc.st/public-stun.txt. Tested 2014-08-23.

See also



Note: XOR_MAPPED_ADDRESS support on STUN Servers

Some home routers (namely Linksys routers whose firmware is based on the Linux kernel) have a tendency to alter the STUN reply packets from the STUN server. It changes the MAPPED_ADDRESS from the public IP address derived by the server to the IP address of the router's WAN port. If the router's WAN port is not assigned a public IP address (as in the case of Internet Service Providers like AT&T Uverse), then the application using STUN to discover its public IP address will get the wrong info.

STUN provides a work-around to this problem via XOR_MAPPED_ADDRESS. A STUN client can request an XOR_MAPPED_ADDRESS as well as the standard MAPPED_ADDRESS. While the router may alter the MAPPED_ADDRESS, it shouldn't change the XOR_MAPPED_ADDRESS.

Unfortunately, not all STUN servers support XOR_MAPPED_ADDRESS. The public STUN servers listed on this wiki have been updated with info about lack of support for XOR_MAPPED_ADDRESS.


Additional reading

STUN sits along side a number of techniques to achieving NAT traversal, these include TURN, ICE UPnP and Session Border controllers. ICE provides a framework pulls together a number of different techniques: STUN, TURN, RSIP, to allow a client to investigate its environment, however, this flexibility comes at a cost - additional client complexity.
Created by: jht2, Last modification: Sun 24 of Aug, 2014 (00:59 UTC) by olegh


Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+

Page Changes | Comments

 

Featured -

Search: