What is a DNS SRV record?

What an SRV record says

A DNS SRV record tells clients where to find a service, not just where to find a host. A normal address lookup answers "what IP address belongs to this name?" An SRV lookup answers a more specific question: "which host and port should I use for this named service and protocol?"

SRV records are most common outside ordinary web browsing. They are used by protocols such as SIP, XMPP, LDAP, Kerberos, Minecraft servers, some mail-adjacent services, and private service-discovery designs. The record lets a domain publish service endpoints without forcing every client to know the port number or hostname in advance.

The owner name usually follows this pattern:

_service._protocol.example.com. 3600 IN SRV 10 20 5060 sip1.example.net.

The leading underscores are intentional. They separate service labels from normal hostnames and reduce the chance of colliding with real names. The fields after SRV are priority, weight, port, and target. In the example, clients looking for the SIP service over the selected protocol should connect to sip1.example.net on port 5060, subject to the priority and weight rules.

Priority, weight, port, and target

The priority field is a failover control. Lower numbers are preferred. If two records have priorities 10 and 20, clients should try the priority 10 targets first and only use priority 20 when the lower-priority set is unavailable. This makes SRV useful for planned fallback between primary and secondary service locations.

The weight field distributes traffic across records with the same priority. A higher weight receives a larger share of client selections, assuming the client implements the algorithm correctly. Weight is not a precise load balancer: recursive resolvers, application caches, retry behavior, and uneven client populations can all skew the real result.

The port field is one of the main reasons SRV exists. It allows the service to run on a port that is defined in DNS rather than hard-coded into every client. For an available service, the target must be a hostname with its own A or AAAA records. It cannot be a CNAME alias. See RFC 2782.

A service can be marked unavailable with a target of .. That is different from deleting the record, because it explicitly tells SRV-aware clients that the named service is not provided for that domain.

Where SRV helps in practice

SRV records are useful when a service has to move independently from the main website. A domain might serve its website from www.example.com, receive mail through separate MX records, and publish collaboration or voice services through SRV records. The service endpoint can be changed without changing user-facing names or application configuration.

They are also useful for multi-site operations. A service can publish local endpoints first and remote endpoints second, or put multiple equivalent targets at the same priority with different weights. During a migration, operators can add a new target at low weight, watch connection success and application metrics, then shift more traffic once the service behaves as expected.

SRV is not a universal service-discovery layer. Many modern web clients do not perform SRV lookups for HTTPS websites. If a browser, library, or mobile SDK does not support SRV for a protocol, publishing the record will not change its behavior. Always confirm that the actual client software understands SRV before relying on it for production routing.

Configuration details to check

Start by confirming the exact service and protocol labels expected by the client. _sip._tcp and _sip._udp are different names. _xmpp-client._tcp and _xmpp-server._tcp serve different roles. A record can be technically valid and still useless if the labels do not match the protocol specification.

Check that each target hostname resolves correctly and is not a CNAME in places where the consuming protocol or operational policy forbids it. In practice, a target should be stable, monitored, and owned by the team responsible for the service. Avoid pointing SRV targets at temporary hostnames or provider names without a clear ownership record.

Set TTLs according to the expected rate of change. A very long TTL can make emergency failover slow because recursive resolvers and clients may keep old answers. A very short TTL can increase query load and still may not produce instant changes, because application-level caching may ignore DNS TTLs. For active migrations, a moderate temporary TTL is often safer than trying to tune during the incident.

Validate both positive and negative answers. Operators often test the happy path but forget what happens when one target fails, returns a firewall timeout, presents the wrong certificate, or accepts TCP but fails at the application layer.

Common failure modes

The most common SRV mistakes are label mistakes, wrong ports, stale targets, and misunderstanding priority versus weight. A priority value is not a percentage. A weight value does not matter across different priorities. If the intent is active-active distribution, the relevant records need the same priority. If the intent is standby failover, the standby target needs a higher priority number.

Another failure mode is partial client support. One client implementation may respect priority and weight, while another may only use the first record it sees. Some software performs SRV lookups during startup and never refreshes them until restart. This can turn an apparently clean DNS change into a slow, uneven migration.

Security failures are also possible. An exposed SRV record can reveal internal service names, ports, and architecture choices. That is not always a problem, but it is useful reconnaissance for attackers. Publishing SRV records for administrative services deserves the same review as opening a firewall rule or publishing an address record.

Safe rollout and monitoring

Before adding or changing SRV records, write down the expected client behavior: the lookup name, selected protocol, target hostnames, port, fallback behavior, and success signal. Test from more than one resolver and more than one network. Use tools such as dig to inspect the DNS answer, then use the actual client or protocol tool to verify that the service connection succeeds.

During rollout, monitor DNS query volume, connection attempts per target, authentication failures, timeout rates, TLS errors if the service uses TLS, and application-level success. If the change is part of a migration, keep the old target healthy until the longest realistic client cache has expired.

After rollout, keep SRV records in the same inventory process as other production DNS. Review ownership, contact details, target lifecycle, certificate coverage, and decommission plans. SRV records are easy to forget because they are less visible than website A records, but a stale SRV target can still break login, messaging, voice, directory, or internal service flows.

Related learning

© PEAKHOUR.IO PTY LTD 2026   ABN 76 619 930 826    All rights reserved.