Difference between revisions of "SRV Records"

From XMPP WIKI
Jump to navigation Jump to search
m
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
A Service record ('''SRV record''') is a specification of data in the Domain Name System ('''DNS''') defining the location (i.e. the hostname and port number) of servers for specified services. It is defined in [http://tools.ietf.org/html/rfc2782 RFC 2782].
A Service record ('''SRV record''') is a specification of data in the Domain Name System ('''DNS''') defining the location (i.e. the hostname and port number) of servers for specified services. It is defined in [https://datatracker.ietf.org/doc/html/rfc2782 RFC2782].


== Default Ports ==
== Default Ports ==
=== XMPP ===
=== XMPP ===


For TCP connections ([http://xmpp.org/rfcs/rfc6120.html RFC 6120])
For TCP connections ([https://datatracker.ietf.org/doc/html/rfc6120 RFC6120])


* Server 2 Server ('''S2S''') - 5269
* Server 2 Server ('''S2S''') - 5269
* Client 2 Server ('''C2S''') - 5222 ('''START TLS''') / 5223 ('''DIRECT TLS''')
* Client 2 Server ('''C2S''') - 5222 ('''START TLS''') / 5223 ('''DIRECT TLS''')
=== STUN/TURN ===
* STUN uses 3478 port in TCP/UDP and STUNS (STUN over TLS) uses 5349 port in TCP only ([http://tools.ietf.org/html/rfc5389 RFC 5389]).
* TURN uses 3478 port in TCP/UDP and TURNS (TURN over TLS) uses 5349 port in TCP only ([http://tools.ietf.org/html/rfc5766 RFC 5766], [http://tools.ietf.org/html/rfc5928 RFC 5928]).


== Record format ==
== Record format ==
Line 28: Line 24:


== XMPP SRV records ==
== XMPP SRV records ==
  _xmpp-client._tcp.example.net. TTL IN SRV priority weight port target
  _xmpp-client._tcp.domain.tld. TTL IN SRV priority weight port target
  _xmpps-client._tcp.example.net. TTL IN SRV priority weight port target
  _xmpps-client._tcp.domain.tld. TTL IN SRV priority weight port target
  _xmpp-server._tcp.example.net. TTL IN SRV priority weight port target
  _xmpp-server._tcp.domain.tld. TTL IN SRV priority weight port target
  _xmpps-server._tcp.example.net. TTL IN SRV priority weight port target
  _xmpps-server._tcp.domain.tld. TTL IN SRV priority weight port target


=== Example 1 ===
=== Example 1 ===
  _xmpp-client._tcp.example.net. 86400 IN SRV 5 0 5222 example.net.
  _xmpp-client._tcp.domain.tld. 86400 IN SRV 5 0 5222 domain.tld.
  _xmpps-client._tcp.example.net. 86400 IN SRV 5 0 5223 example.net.
  _xmpps-client._tcp.domain.tld. 86400 IN SRV 5 0 5223 domain.tld.
  _xmpp-server._tcp.example.net. 86400 IN SRV 5 0 5269 example.net.
  _xmpp-server._tcp.domain.tld. 86400 IN SRV 5 0 5269 domain.tld.


The XMPP domain is example.net and the server is example.net.
The XMPP domain is domain.tld and the server is domain.tld.


=== Example 2 ===
=== Example 2 ===
  _xmpp-client._tcp.example.net. 86400 IN SRV 5 0 5222 server.example.net.
  _xmpp-client._tcp.domain.tld. 86400 IN SRV 5 0 5222 server.domain.tld.
  _xmpps-client._tcp.example.net. 86400 IN SRV 5 0 5223 server.example.net.
  _xmpps-client._tcp.domain.tld. 86400 IN SRV 5 0 5223 server.domain.tld.
  _xmpp-server._tcp.example.net. 86400 IN SRV 5 0 5269 server.example.net.
  _xmpp-server._tcp.domain.tld. 86400 IN SRV 5 0 5269 server.domain.tld.


The XMPP domain is example.net and the server is server.example.net.
The XMPP domain is domain.tld and the server is server.domain.tld.


=== Example 3 ===
=== Example 3 ===
  _xmpp-client._tcp.example.net. 86400 IN SRV 5 50 5222 server1.example.net.
  _xmpp-client._tcp.domain.tld. 86400 IN SRV 5 50 5222 server1.domain.tld.
  _xmpp-client._tcp.example.net. 86400 IN SRV 10 30 5222 server2.example.net.
  _xmpp-client._tcp.domain.tld. 86400 IN SRV 10 30 5222 server2.domain.tld.
  _xmpp-client._tcp.example.net. 86400 IN SRV 10 10 5222 server3.example.net.
  _xmpp-client._tcp.domain.tld. 86400 IN SRV 10 10 5222 server3.domain.tld.
  _xmpp-client._tcp.example.net. 86400 IN SRV 10 10 5222 server4.example.net.
  _xmpp-client._tcp.domain.tld. 86400 IN SRV 10 10 5222 server4.domain.tld.
  _xmpp-client._tcp.example.net. 86400 IN SRV 15 0 5222 backup.example.net.
  _xmpp-client._tcp.domain.tld. 86400 IN SRV 15 0 5222 backup.domain.tld.
  _xmpp-server._tcp.example.net. 86400 IN SRV 5 50 5269 server1.example.net.
  _xmpp-server._tcp.domain.tld. 86400 IN SRV 5 50 5269 server1.domain.tld.
  _xmpp-server._tcp.example.net. 86400 IN SRV 10 30 5269 server2.example.net.
  _xmpp-server._tcp.domain.tld. 86400 IN SRV 10 30 5269 server2.domain.tld.
  _xmpp-server._tcp.example.net. 86400 IN SRV 10 10 5269 server3.example.net.
  _xmpp-server._tcp.domain.tld. 86400 IN SRV 10 10 5269 server3.domain.tld.
  _xmpp-server._tcp.example.net. 86400 IN SRV 10 10 5269 server4.example.net.
  _xmpp-server._tcp.domain.tld. 86400 IN SRV 10 10 5269 server4.domain.tld.
  _xmpp-server._tcp.example.net. 86400 IN SRV 15 0 5269 backup.example.net.
  _xmpp-server._tcp.domain.tld. 86400 IN SRV 15 0 5269 backup.domain.tld.


The XMPP domain is example.net and the principal server is server1.example.net which used 50% after server2.example.net 30%, server3.example.net 10%, server4.example.net 10% too, if server1 is down, server2, server3 and server4 will work, if servers 1/2/3/4 are down, backup will work.
The XMPP domain is domain.tld and the principal server is server1.domain.tld which used 50% after server2.domain.tld 30%, server3.domain.tld 10%, server4.domain.tld 10% too, if server1 is down, server2, server3 and server4 will work, if servers 1/2/3/4 are down, backup will work.


=== Retrieving XMPP SRV records ===
=== Retrieving XMPP SRV records ===
  $ dig SRV _xmpp-client._tcp.example.net
  $ dig SRV _xmpp-client._tcp.domain.tld
  $ dig SRV _xmpp-server._tcp.example.net
  $ dig SRV _xmpp-server._tcp.domain.tld
 
 
== STUN SRV records ==
_stun._tcp.example.net. TTL IN SRV priority weight port target
_stun._udp.example.net. TTL IN SRV priority weight port target
_stuns._tcp.example.net. TTL IN SRV priority weight port target
 
=== Example 1 ===
_stun._tcp.example.net. 86400 IN SRV 5 0 3478 example.net.
_stun._udp.example.net. 86400 IN SRV 5 0 3478 example.net.
_stuns._tcp.example.net. 86400 IN SRV 5 0 5349 example.net.
 
The STUN domain is example.net and the server is example.net.
 
=== Example 2 ===
_stun._tcp.example.net. 86400 IN SRV 5 0 3478 server.example.net.
_stun._udp.example.net. 86400 IN SRV 5 0 3478 server.example.net.
_stuns._tcp.example.net. 86400 IN SRV 5 0 5349 server.example.net.
 
The STUN domain is example.net and the server is server.example.net.
 
=== Example 3 ===
_stun._tcp.example.net. 86400 IN SRV 5 50 3478 server1.example.net.
_stun._tcp.example.net. 86400 IN SRV 10 30 3478 server2.example.net.
_stun._tcp.example.net. 86400 IN SRV 10 10 3478 server3.example.net.
_stun._tcp.example.net. 86400 IN SRV 10 10 3478 server4.example.net.
_stun._tcp.example.net. 86400 IN SRV 15 0 3478 backup.example.net.
_stun._udp.example.net. 86400 IN SRV 5 50 3478 server1.example.net.
_stun._udp.example.net. 86400 IN SRV 10 30 3478 server2.example.net.
_stun._udp.example.net. 86400 IN SRV 10 10 3478 server3.example.net.
_stun._udp.example.net. 86400 IN SRV 10 10 3478 server4.example.net.
_stun._udp.example.net. 86400 IN SRV 15 0 3478 backup.example.net.
_stuns._tcp.example.net. 86400 IN SRV 5 50 5349 server1.example.net.
_stuns._tcp.example.net. 86400 IN SRV 10 30 5349 server2.example.net.
_stuns._tcp.example.net. 86400 IN SRV 10 10 5349 server3.example.net.
_stuns._tcp.example.net. 86400 IN SRV 10 10 5349 server4.example.net.
_stuns._tcp.example.net. 86400 IN SRV 15 0 5349 backup.example.net.
 
The XMPP domain is example.net and the principal server is server1.example.net which used 50% after server2.example.net 30%, server3.example.net 10%, server4.example.net 10% too, if server1 is down, server2, server3 and server4 will work, if servers 1/2/3/4 are down, backup will work.
 
=== Retrieving STUN SRV records ===
$ dig SRV _stun._tcp.example.net
$ dig SRV _stun._udp.example.net
$ dig SRV _stuns._tcp.example.net
 
== TURN SRV records ==
_turn._tcp.example.net. TTL IN SRV priority weight port target
_turn._udp.example.net. TTL IN SRV priority weight port target
_turns._tcp.example.net. TTL IN SRV priority weight port target
 
=== Example 1 ===
_turn._tcp.example.net. 86400 IN SRV 5 0 3478 example.net.
_turn._udp.example.net. 86400 IN SRV 5 0 3478 example.net.
_turns._tcp.example.net. 86400 IN SRV 5 0 5349 example.net.
 
The TURN domain is example.net and the server is example.net.
 
=== Example 2 ===
_turn._tcp.example.net. 86400 IN SRV 5 0 3478 server.example.net.
_turn._udp.example.net. 86400 IN SRV 5 0 3478 server.example.net.
_turns._tcp.example.net. 86400 IN SRV 5 0 5349 server.example.net.
 
The TURN domain is example.net and the server is server.example.net.
 
=== Example 3 ===
_turn._tcp.example.net. 86400 IN SRV 5 50 3478 server1.example.net.
_turn._tcp.example.net. 86400 IN SRV 10 30 3478 server2.example.net.
_turn._tcp.example.net. 86400 IN SRV 10 10 3478 server3.example.net.
_turn._tcp.example.net. 86400 IN SRV 10 10 3478 server4.example.net.
_turn._tcp.example.net. 86400 IN SRV 15 0 3478 backup.example.net.
_turn._udp.example.net. 86400 IN SRV 5 50 3478 server1.example.net.
_turn._udp.example.net. 86400 IN SRV 10 30 3478 server2.example.net.
_turn._udp.example.net. 86400 IN SRV 10 10 3478 server3.example.net.
_turn._udp.example.net. 86400 IN SRV 10 10 3478 server4.example.net.
_turn._udp.example.net. 86400 IN SRV 15 0 3478 backup.example.net.
_turns._tcp.example.net. 86400 IN SRV 5 50 5349 server1.example.net.
_turns._tcp.example.net. 86400 IN SRV 10 30 5349 server2.example.net.
_turns._tcp.example.net. 86400 IN SRV 10 10 5349 server3.example.net.
_turns._tcp.example.net. 86400 IN SRV 10 10 5349 server4.example.net.
_turns._tcp.example.net. 86400 IN SRV 15 0 5349 backup.example.net.
 
The XMPP domain is example.net and the principal server is server1.example.net which used 50% after server2.example.net 30%, server3.example.net 10%, server4.example.net 10% too, if server1 is down, server2, server3 and server4 will work, if servers 1/2/3/4 are down, backup will work.
 
=== Retrieving TURN SRV records ===
$ dig SRV _turn._tcp.example.net
$ dig SRV _turn._udp.example.net
$ dig SRV _turns._tcp.example.net


== External links ==
== External links ==
* [https://wiki.xmpp.org/web/Tech_pages/XEP-0368: XEP-0368: SRV records for XMPP over TLS]
* [https://wiki.xmpp.org/web/Tech_pages/XEP-0368 XEP-0368: SRV records for XMPP over TLS]
* [http://tools.ietf.org/html/rfc2782 RFC 2782: A DNS RR for specifying the location of services (DNS SRV)]
* [https://datatracker.ietf.org/doc/html/rfc2782 RFC2782: A DNS RR for specifying the location of services (DNS SRV)]
* [http://xmpp.org/rfcs/rfc6120.html RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core]
* [https://datatracker.ietf.org/doc/html/rfc6120 RFC6120: Extensible Messaging and Presence Protocol (XMPP): Core]
* [http://tools.ietf.org/html/rfc5389 RFC 5389: Session Traversal Utilities for NAT (STUN)]
* [http://tools.ietf.org/html/rfc5766 RFC 5766: Traversal Using Relays around NAT (TURN): Relay Extensions to Session Traversal Utilities for NAT (STUN)]
* [http://tools.ietf.org/html/rfc5928 RFC 5928: Traversal Using Relays around NAT (TURN) Resolution Mechanism]

Latest revision as of 16:42, 26 December 2023

A Service record (SRV record) is a specification of data in the Domain Name System (DNS) defining the location (i.e. the hostname and port number) of servers for specified services. It is defined in RFC2782.

Default Ports

XMPP

For TCP connections (RFC6120)

  • Server 2 Server (S2S) - 5269
  • Client 2 Server (C2S) - 5222 (START TLS) / 5223 (DIRECT TLS)

Record format

An SRV record has the form:

_service._proto.name TTL class SRV priority weight port target
  • service: the symbolic name of the desired service.
  • proto: the transport protocol of the desired service; this is usually either TCP or UDP.
  • name: the domain name for which this record is valid.
  • TTL: standard DNS time to live field.
  • class: standard DNS class field (this is always IN).
  • priority: the priority of the target host, lower value means more preferred.
  • weight: A relative weight for records with the same priority.
  • port: the TCP or UDP port on which the service is to be found.
  • target: the canonical hostname of the machine providing the service.

XMPP SRV records

_xmpp-client._tcp.domain.tld. TTL IN SRV priority weight port target
_xmpps-client._tcp.domain.tld. TTL IN SRV priority weight port target
_xmpp-server._tcp.domain.tld. TTL IN SRV priority weight port target
_xmpps-server._tcp.domain.tld. TTL IN SRV priority weight port target

Example 1

_xmpp-client._tcp.domain.tld. 86400 IN SRV 5 0 5222 domain.tld.
_xmpps-client._tcp.domain.tld. 86400 IN SRV 5 0 5223 domain.tld.
_xmpp-server._tcp.domain.tld. 86400 IN SRV 5 0 5269 domain.tld.

The XMPP domain is domain.tld and the server is domain.tld.

Example 2

_xmpp-client._tcp.domain.tld. 86400 IN SRV 5 0 5222 server.domain.tld.
_xmpps-client._tcp.domain.tld. 86400 IN SRV 5 0 5223 server.domain.tld.
_xmpp-server._tcp.domain.tld. 86400 IN SRV 5 0 5269 server.domain.tld.

The XMPP domain is domain.tld and the server is server.domain.tld.

Example 3

_xmpp-client._tcp.domain.tld. 86400 IN SRV 5 50 5222 server1.domain.tld.
_xmpp-client._tcp.domain.tld. 86400 IN SRV 10 30 5222 server2.domain.tld.
_xmpp-client._tcp.domain.tld. 86400 IN SRV 10 10 5222 server3.domain.tld.
_xmpp-client._tcp.domain.tld. 86400 IN SRV 10 10 5222 server4.domain.tld.
_xmpp-client._tcp.domain.tld. 86400 IN SRV 15 0 5222 backup.domain.tld.
_xmpp-server._tcp.domain.tld. 86400 IN SRV 5 50 5269 server1.domain.tld.
_xmpp-server._tcp.domain.tld. 86400 IN SRV 10 30 5269 server2.domain.tld.
_xmpp-server._tcp.domain.tld. 86400 IN SRV 10 10 5269 server3.domain.tld.
_xmpp-server._tcp.domain.tld. 86400 IN SRV 10 10 5269 server4.domain.tld.
_xmpp-server._tcp.domain.tld. 86400 IN SRV 15 0 5269 backup.domain.tld.

The XMPP domain is domain.tld and the principal server is server1.domain.tld which used 50% after server2.domain.tld 30%, server3.domain.tld 10%, server4.domain.tld 10% too, if server1 is down, server2, server3 and server4 will work, if servers 1/2/3/4 are down, backup will work.

Retrieving XMPP SRV records

$ dig SRV _xmpp-client._tcp.domain.tld
$ dig SRV _xmpp-server._tcp.domain.tld

External links