SRV record: what it is and how to check it

Says which host and port provide a specific service, such as SIP, XMPP or LDAP.

Check with the DNS Lookup

What it is

An SRV record (service) tells clients which host and port provide a particular service for a domain. Instead of hard-coding “the chat server is xmpp.example.com on port 5222”, a client can ask DNS: “where is the XMPP service for example.com?” and get the host, the port and an order of preference in one answer.

SRV is defined in RFC 2782. Service names are registered with IANA, and RFC 6335 describes how.

How it works

The name of an SRV record is built from three parts: _service._protocol.domain. For example, _sip._tcp.example.com holds the SIP-over-TCP service for example.com.

A client that wants the service:

  1. Looks up SRV for _service._protocol.example.com.
  2. Sorts the answers by priority, lowest first. It must try all targets of one priority before moving to the next.
  3. Among records with the same priority, it chooses randomly but in proportion to weight, so a record with weight 60 is picked about three times as often as one with weight 20.
  4. Looks up the A and AAAA records of the chosen target and connects on the given port.

This gives failover (through priority) and load sharing (through weight) without any extra infrastructure.

Common uses include SIP for VoIP (_sip._udp, _sip._tcp, _sips._tcp), XMPP chat (_xmpp-client._tcp, _xmpp-server._tcp), Microsoft Active Directory (_ldap._tcp.dc._msdcs, _kerberos._tcp), email client autoconfiguration (_imaps._tcp, _submission._tcp, RFC 6186), CalDAV and CardDAV (_caldavs._tcp, _carddavs._tcp) and some games, such as Minecraft (_minecraft._tcp).

Syntax and fields

Field Example Meaning
Name _sip._tcp.example.com. _service._protocol followed by the domain.
TTL 3600 Cache lifetime in seconds.
Class IN Internet.
Type SRV The record type.
Priority 10 0 to 65535. Lower values are tried first.
Weight 60 0 to 65535. Relative share among records of the same priority. 0 means “no preference” when used alone.
Port 5060 TCP or UDP port of the service.
Target sip1.example.com. Host name providing the service. Must have A or AAAA records; must not be a CNAME. . means “no service”.

Choosing priority and weight

Think of priority as tiers and weight as shares within a tier. All servers in the lowest tier are used first; the next tier is used only if every server above it is unreachable. Within a tier, the client picks a server at random, with each server’s chance proportional to its weight. Weights of 60 and 40 therefore send roughly 60% and 40% of new connections to each server. If every record in a tier has weight 0, the client simply chooses at random. A weight of 0 next to non-zero weights makes that server very unlikely to be chosen.

Examples

SIP over TCP with two servers sharing the load and one backup:

_sip._tcp.example.com.  3600  IN  SRV  10 60 5060 sip1.example.com.
_sip._tcp.example.com.  3600  IN  SRV  10 40 5060 sip2.example.com.
_sip._tcp.example.com.  3600  IN  SRV  20 0  5060 sip-backup.example.net.
sip1.example.com.       3600  IN  A    192.0.2.61
sip2.example.com.       3600  IN  A    192.0.2.62

XMPP client and server-to-server endpoints:

_xmpp-client._tcp.example.com.  3600  IN  SRV  5 0 5222 xmpp.example.com.
_xmpp-server._tcp.example.com.  3600  IN  SRV  5 0 5269 xmpp.example.com.

Mail client autoconfiguration for IMAP over TLS and message submission (RFC 6186, updated by RFC 8314):

_imaps._tcp.example.com.       3600  IN  SRV  0 1 993 mail.example.com.
_submissions._tcp.example.com. 3600  IN  SRV  0 1 465 mail.example.com.

Explicitly stating that a service is not offered:

_imap._tcp.example.com.  3600  IN  SRV  0 0 0 .

Common mistakes

  • Wrong name structure. The underscores and the order matter: _sip._tcp.example.com, not sip.tcp.example.com or _tcp._sip.example.com. In DNS panels that append the domain automatically, enter only _sip._tcp.
  • Putting an IP address in the target. The target must be a host name with its own address records.
  • Target is a CNAME. RFC 2782 says the target must not be an alias. Some clients tolerate it; others fail.
  • Mixing up priority and weight. Priority decides the order of tries; weight only shares load within a priority. A backup server needs a higher priority number, not a lower weight.
  • Wrong protocol label. Some services exist over both UDP and TCP and need a separate record for each (_sip._udp and _sip._tcp).
  • Expecting browsers to use SRV. Websites cannot be moved to another port with SRV. Use the web server configuration, or an HTTPS record for clients that support it.

How to check it

Use the DNS lookup tool with type SRV and the full service name, for example _sip._tcp.example.com. The result lists each target with its priority, weight and port. Then look up the A and AAAA records of each target to make sure they resolve.

SRV records are not included in the “all records” view because they need a service name; always query them by their full name.

  • A and AAAA: every SRV target needs them.
  • HTTPS / SVCB: a newer, more flexible way to describe service endpoints, including port and protocol.
  • MX: a much older, mail-only record built on the same idea of priority-ordered targets.

Frequently asked questions

Why does the SRV name start with underscores?

The _service._protocol labels (for example _sip._tcp) keep service records separate from ordinary host names. Host names cannot start with an underscore, so there is no risk of a clash.

Can browsers use SRV records to find a website?

No. Web browsers do not use SRV for HTTP. The modern equivalent for the web is the HTTPS record (RFC 9460), which browsers are adopting for things like protocol and port hints.

What does a target of '.' mean?

A single SRV record with target '.' means the service is decidedly not available at this domain (RFC 2782). Clients should stop looking rather than try other methods.

Why doesn't the 'all records' lookup show my SRV records?

SRV records live under a service-specific name such as _sip._tcp.example.com, not on the domain itself. To see them, look up that full name with type SRV.