Difference between revisions of "SRV Records"

From XMPP WIKI
Jump to navigation Jump to search
m
m
Line 45: Line 45:
  _xmpp-server._tcp.example.net. 86400 IN SRV 15 0 5269 backup.example.net.
  _xmpp-server._tcp.example.net. 86400 IN SRV 15 0 5269 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 server 1 is down, server2, server3 and server4 will work, if servers 1/2/3/4 are down, backup will work.
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 SRV records ==
== Retrieving SRV records ==
  $ dig SRV _xmpp-client._tcp.example.net
  $ dig SRV _xmpp-client._tcp.example.net
  $ dig SRV _xmpp-server._tcp.example.net
  $ dig SRV _xmpp-server._tcp.example.net

Revision as of 15:26, 25 August 2011

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 RFC 2782.

XMPP often require SRV support by network elements.

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.example.net. TTL IN SRV priority weight port target
_xmpp-server._tcp.example.net. TTL IN SRV priority weight port target

Example 1

_xmpp-client._tcp.example.net. 86400 IN SRV 5 0 5222 example.net.
_xmpp-server._tcp.example.net. 86400 IN SRV 5 0 5269 example.net.

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

Example 2

_xmpp-client._tcp.example.net. 86400 IN SRV 5 0 5222 server.example.net.
_xmpp-server._tcp.example.net. 86400 IN SRV 5 0 5269 server.example.net.

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

Example 3

_xmpp-client._tcp.example.net. 86400 IN SRV 5 50 5222 server1.example.net.
_xmpp-client._tcp.example.net. 86400 IN SRV 10 30 5222 server2.example.net.
_xmpp-client._tcp.example.net. 86400 IN SRV 10 10 5222 server3.example.net.
_xmpp-client._tcp.example.net. 86400 IN SRV 10 10 5222 server4.example.net.
_xmpp-client._tcp.example.net. 86400 IN SRV 15 0 5222 backup.example.net.
_xmpp-server._tcp.example.net. 86400 IN SRV 5 50 5269 server1.example.net.
_xmpp-server._tcp.example.net. 86400 IN SRV 10 30 5269 server2.example.net.
_xmpp-server._tcp.example.net. 86400 IN SRV 10 10 5269 server3.example.net.
_xmpp-server._tcp.example.net. 86400 IN SRV 10 10 5269 server4.example.net.
_xmpp-server._tcp.example.net. 86400 IN SRV 15 0 5269 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 SRV records

$ dig SRV _xmpp-client._tcp.example.net
$ dig SRV _xmpp-server._tcp.example.net