dns SRV records service discovery DNS configuration network services domain management DNS records

How to Use DNS SRV Records for Service Discovery (SIP, XMPP, LDAP, and More)

James Chen 14 views
How to Use DNS SRV Records for Service Discovery (SIP, XMPP, LDAP, and More)

What Are DNS SRV Records?

DNS SRV records (Service records) are a type of DNS resource record that specifies the location of a particular service on a network. While A and AAAA records map a domain to an IP address, SRV records go a step further: they tell clients which hostname and port to use for a specific protocol or service. This makes them indispensable for service discovery in modern applications.

Originally defined in RFC 2782, SRV records let you decouple service endpoints from domain structure. For example, you can run your company’s SIP server on sip.example.com port 5060, but have all SIP clients discover it automatically by querying _sip._tcp.example.com. The record also supports priority and weight fields, enabling failover and simple load balancing.

SRV Record Format

Understanding the anatomy of an SRV record is essential for correct configuration. Here’s the standard format:

_service._proto.name TTL class SRV priority weight port target
  • _service – The symbolic name of the service (e.g., _sip, _xmpp, _ldap).
  • _proto – The transport protocol, typically _tcp or _udp.
  • name – The domain where the service resides (e.g., example.com).
  • TTL – Time to live in seconds.
  • class – Usually IN for Internet.
  • priority – Lower value means higher priority. Clients try the lowest priority first.
  • weight – Used for load balancing among same-priority records. Higher weight = more likely to be chosen.
  • port – The TCP or UDP port the service listens on.
  • target – The canonical hostname of the server providing the service (must have an A/AAAA record).

Example SRV record for SIP over TCP:

_sip._tcp.example.com. 3600 IN SRV 10 5 5060 sip-server.example.com.

This tells clients to connect to sip-server.example.com on port 5060. If that server fails, they can try the next highest priority record.

Real-World Use Cases

SIP – Voice and Video Calling

SIP (Session Initiation Protocol) is the backbone of VoIP. SRV records allow SIP clients to discover the correct registrar or proxy server without hardcoding IP addresses. For example:

  • _sip._tcp.example.com for TCP connections
  • _sip._udp.example.com for UDP connections

Many enterprise PBX systems use SRV records to fall over to backup servers automatically. If your primary SIP server goes down, clients will retry the next priority record — seamless failover without manual intervention.

XMPP – Instant Messaging and Chat

XMPP (Jabber) relies heavily on SRV records for server-to-server federation. The familiar address [email protected] works because the XMPP server queries _xmpp-server._tcp.domain.com to find another server’s hostname and port. Client-to-server connections use _xmpp-client._tcp. Without SRV records, XMPP would require every user to know the specific server URL.

LDAP – Directory Services

Lightweight Directory Access Protocol servers (e.g., Active Directory, OpenLDAP) often use SRV records to let clients locate domain controllers or global catalog servers. For an Active Directory domain ad.example.com, you’ll find records like:

_ldap._tcp.ad.example.com. 600 IN SRV 0 100 389 dc01.ad.example.com.

This is how Windows domain-joined machines automatically discover the nearest domain controller using DNS, even across sites.

More Services: Kerberos, Minecraft, and CalDAV

  • Kerberos – KDC discovery via _kerberos._tcp.YOUR.REALM.
  • Minecraft – Server discovery uses _minecraft._tcp.your-server.com (Java Edition).
  • CalDAV / CardDAV – Apple devices use _caldav._tcp and _carddav._tcp to find calendars and contacts.

The pattern is universal: prefix an underscore with the service name and protocol, point to your server, and any compatible client can find it.

How to Set Up SRV Records

Adding SRV records is done through your DNS provider’s control panel. Here’s a step-by-step guide:

  1. Decide on your service and protocol. For example, if you run an XMPP chat server for chat.example.com on port 5222 (TCP).
  2. Create the SRV record. In your DNS zone, add a new record of type SRV with:
    • Name: _xmpp-client._tcp.chat.example.com (some providers let you put the full service name directly).
    • TTL: 3600 (or lower if you anticipate changes).
    • Priority: 10 for primary, 20 for backup.
    • Weight: evenly distribute (e.g., 100 for each equal-priority server).
    • Port: 5222.
    • Target: xmpp1.chat.example.com.
  3. Ensure the target hostname has an A or AAAA record – otherwise the SRV record is useless.
  4. Test the record using a DNS lookup tool like the Whose.Domains DNS Analyzer. It will resolve the SRV query and show you the response, including priority, weight, and the final IP address.

Common Pitfalls and Best Practices

  • Trailing dot missing – In many DNS providers, target names must end with a dot (absolute FQDN). Forgetting it can cause unexpected resolution failures.
  • Overlapping with other records – Don’t create wildcard SRV records unless you know what you’re doing; they can interfere with specific service lookups.
  • Ignoring priority vs. weight – Priority determines the order of attempt; weight only matters among servers of the same priority. Use different priorities for primary/backup, not weight.
  • Not updating TTL before changes – If you plan to move a service, lower the TTL a day in advance so cached records expire quickly.
  • Forgetting to add reverse lookup – Not strictly required, but some implementations may rely on PTR records for verification.

Checking Your SRV Records

After configuration, always verify your SRV records are correctly published. You can use command-line tools like dig or nslookup:

dig _sip._tcp.example.com SRV

For a user-friendly interface, the DNS Analyzer tool on Whose.Domains can perform SRV lookups and display all returned records in a clean table. Just enter your domain and select the record type. It’s especially handy when debugging multi-record setups or checking whether your changes have propagated.

Conclusion

DNS SRV records are a lightweight yet powerful method for service discovery. From VoIP services like SIP to directory services like LDAP and modern gaming servers, SRV records enable failover, load balancing, and centralized control. By mastering the format and following best practices, you can make your network services more resilient and easier to manage.

Start by auditing your existing DNS zone for missing SRV entries, or configure a new service today. And don’t forget to test with a reliable tool – the DNS Analyzer on Whose.Domains is free and works for any public domain.

Tags: SRV records service discovery DNS configuration network services domain management DNS records

Related Posts

How to Use Reverse DNS (PTR Records) to Improve Email Deliverability and Network Security
Jul 1, 2026
DNS Anycast Explained: How It Enhances Domain Resolution Speed and Reliability
Jun 25, 2026
DNS TTL Optimization: How to Choose the Right Time-to-Live Values for Performance and Reliability
Jun 22, 2026