STUN server in ejabberd

ejabberd has gained a STUN server, helping Jingle communications.

STUN stands for Simple Traversal Utilities for NAT. And NAT stands for Network Address Translation.

NAT devices, such as routers and firewalls, translate a private IP address into a public IP address. When you are not directly connected to the internet, but you are in a LAN behind a NAT, you can only know your private LAN address. Thus a Jingle contact of yours may not be able to join you.

STUN is a protocol designed to discover the mapping between your public and private address. A STUN server is located on the public internet, thus knowing the public addresses. Then if you are behind a NAT and want to initiate a Jingle session with a contact, you can discover and send your public address to this contact.

ejabberd’s STUN server will help Jingle communications to happen when parties are separated by a NAT, by providing a public service for IP addresses and ports discovery.

You can get it at:

svn co

The documentation is here:

Example configuration:

{{3478, udp}, ejabberd_stun, []},
{3478, ejabberd_stun, []},
{5349, ejabberd_stun, [{certfile, "/etc/ejabberd/server.pem"}]},

Example DNS SRV configuration:

_stun._udp   IN SRV  0 0 3478
_stun._tcp IN SRV 0 0 3478
_stuns._tcp IN SRV 0 0 5349

Let us know what you think 💬

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.