Skip to content
Webmaster Tools

SRV record

How DNS SRV records work: the _service._proto naming, priority, weight, port and target fields from RFC 2782, real examples, and how to look one up with dig.

What it is

An SRV (service) record tells a client which host and port provide a given service for a domain. Instead of hard-coding xmpp.example.com:5222, a chat client asks for _xmpp-client._tcp.example.com and gets back the server, the port and a preference order. SRV is defined in RFC 2782. The record name is always _service._proto.name: the service and the transport protocol, each with a leading underscore, in front of the domain.

; name                          TTL   class type prio weight port target
_xmpp-client._tcp.example.com.  3600  IN    SRV  10   60     5222 chat1.example.com.
_xmpp-client._tcp.example.com.  3600  IN    SRV  10   40     5222 chat2.example.com.
_xmpp-client._tcp.example.com.  3600  IN    SRV  20   0      5222 backup.example.com.

The fields

Field Meaning
_service Symbolic service name, such as _sip, _xmpp-client, _ldap, _imaps
_proto Transport, almost always _tcp or _udp (_tls appears in some vendor setups)
Priority Lower wins. Clients try every target at the lowest priority before moving to the next
Weight Load sharing among targets with the same priority. 60 and 40 send roughly 60% and 40% of clients to each; 0 means no preference
Port TCP or UDP port the service listens on
Target Host name of the server, which must have A or AAAA records

In the example, clients split between chat1 and chat2 (both priority 10) and only fall back to backup when neither answers. A target of a single dot (.) means "this service is deliberately not offered here".

Common setups

  • XMPP: _xmpp-client._tcp (port 5222) for clients and _xmpp-server._tcp (5269) for federation.
  • SIP and VoIP: _sip._udp, _sip._tcp and _sips._tcp point phones at the registrar.
  • Active Directory: domain controllers publish _ldap._tcp.dc._msdcs.<domain> and _kerberos._tcp.<domain>; Windows clients find their domain controller this way.
  • Email clients: RFC 6186 defines _imaps._tcp, _submission._tcp and friends for automatic account setup.
  • CalDAV and CardDAV: _caldavs._tcp and _carddavs._tcp (RFC 6764).
  • Minecraft: _minecraft._tcp.example.com lets players connect to example.com while the server runs on another host or port.

Web browsers do not use SRV for HTTP. For that, look at the newer HTTPS/SVCB record type (RFC 9460).

How to check it

Use the DNS Lookup with the full SRV name, underscores included. From a terminal:

dig +short SRV _xmpp-client._tcp.example.com
nslookup -type=SRV _xmpp-client._tcp.example.com

dig +short prints priority, weight, port and target in that order. Then check that each target resolves with an A record lookup.

Common mistakes

  • Querying the bare domain. An SRV lookup for example.com finds nothing; the record lives at _service._proto.example.com.
  • Target is a CNAME or an IP. RFC 2782 says the target must be a host name with its own address records, not an alias and not a literal IP.
  • Forgetting the trailing dot in a zone file, which turns sip.example.com into sip.example.com.example.com.. Most DNS dashboards add it for you.
  • Wrong protocol label. _sip._tcp and _sip._udp are separate records; publish the ones your clients actually ask for.
  • Expecting instant change. Resolvers cache the answer for the TTL; see DNS TTL.
  • Unsupported by the client. SRV only helps if the software looks it up. Many apps ignore it and need the host and port typed in.
  • A record and AAAA record: what each SRV target must resolve to.
  • CNAME record: why it can't be an SRV target.
  • MX record: the older, mail-only form of the same idea, with priority but no port.
  • TXT record: often published alongside SRV for service verification.