SRV Record: DNS Service Discovery

Use SRV records for automatic network service location.

SRV (Service) records allow applications to automatically discover servers providing a specific service. Instead of hardcoding a server address, applications query DNS to find where to connect. This is how many modern protocols work: VoIP, instant messaging, Microsoft 365, and many more.

Unlike A records that simply associate a name with an IP, SRV records contain rich information: the service port, priority (which server to try first), and weight (load distribution among same-priority servers). This DNS-integrated intelligence greatly simplifies client configuration.

SRVs are particularly useful for services that need to run on non-standard ports, architectures with multiple servers, or automatic failover configurations. If you use Microsoft 365, Skype for Business, SIP, XMPP, or Minecraft, you're probably already using SRV records without knowing it.

What is an SRV Record?

SRVs have a specific syntax that encodes several pieces of information:

  • Name format: The name follows _service._protocol.domain format. Example: _sip._tcp.example.com for SIP service over TCP in the example.com domain.
  • Priority: A number indicating preference order. Servers with lowest priority are tried first. Use for failover.
  • Weight: For same-priority servers, weight determines distribution. A server with weight 60 receives twice as much traffic as one with weight 30.
  • Port and target: SRV indicates which port to connect to and which server (FQDN). Allows non-standard ports without client configuration.

SRV Record Use Cases

SRVs are used by many services and protocols:

  • Microsoft 365 / Teams: Outlook and Teams clients use SRVs to find Exchange servers and federation endpoints. Without correct SRVs, autodiscovery fails.
  • VoIP / SIP: SIP phones and softphones use SRVs (_sip._udp, _sip._tcp) to locate the PBX server. Essential for business telephony.
  • Instant messaging: XMPP (Jabber), Matrix and other chat protocols use SRVs for federation between servers and client-server discovery.
  • Multiplayer games: Minecraft uses SRVs (_minecraft._tcp) to allow servers to run on non-standard ports while using a simple name.

Configure an SRV Record

Follow these steps to properly create an SRV:

  1. Identify the service: Determine the standardized service name (consult RFCs or service documentation). Examples: _sip, _xmpp-client, _minecraft, _autodiscover.
  2. Choose the protocol: Most services use _tcp or _udp. Some services like SIP require both. Check the documentation.
  3. Set priority and weight: For a single server, use priority=0, weight=1. For failover, use different priorities. For load-balancing, same priority but different weights.
  4. Create the record: In your DNS interface, create the SRV with _service._proto format as name, then configure priority, weight, port and target.

SRV Record Examples

Here are common SRV configurations for different services:

; Format: _service._proto.domain TTL IN SRV priority weight port target

; Microsoft 365 - Autodiscover
_autodiscover._tcp.example.com. 3600 IN SRV 0 0 443 autodiscover.outlook.com.

; SIP VoIP with failover
_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.com.
; Priority 10 = primary (60/40 load balance), priority 20 = backup

; XMPP Messaging
_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.

; Minecraft on non-standard port
_minecraft._tcp.example.com. 3600 IN SRV 0 5 25566 mc.example.com.

; Verification with dig
$ dig SRV _sip._tcp.example.com +short
10 60 5060 sip1.example.com.
10 40 5060 sip2.example.com.
20 0 5060 sip-backup.example.com.

The SIP example shows failover and load-balancing: sip1 and sip2 have the same priority (10) but different weights (60/40), so sip1 receives 60% of traffic. If both fail, sip-backup (priority 20) takes over.

SRV Best Practices

Optimize your SRV records for resilience and performance:

  • Always have a backup: Configure at least two SRVs with different priorities. The client will automatically failover if the primary server fails.
  • Appropriate TTL: Use short TTLs (300-900s) if you need fast failover. For stable configurations, longer TTLs (3600s) reduce DNS traffic.
  • Targets with A records: SRV targets must be FQDNs with their own A/AAAA records. Don't point directly to IPs.
  • Client testing: Test that your clients correctly interpret SRVs. Some clients have incomplete implementations or ignore weights.

SRV Configuration Checklist

  • Correct service name and protocol (_service._proto)
  • Priority configured for failover
  • Weights set for load-balancing
  • Correct port for the service
  • Target is FQDN with A/AAAA record
  • TTL adapted to failover needs

FAQ - SRV Records

Do all clients support SRVs?

No, SRV support depends on the application. Modern clients (Teams, SIP phones, XMPP clients) support them, but some applications require manual configuration.

What happens if no SRV exists?

Behavior depends on the client. Some attempt direct connection to the domain on the default port, others fail. Consult service documentation.

Can I point an SRV to a CNAME?

Technically no, the RFC states the target must be an A/AAAA. In practice, some resolvers follow the CNAME, but avoid it for compatibility.

How do I disable a service via SRV?

Create an SRV with target "." (dot) and port 0. This explicitly indicates the service is unavailable, rather than SRV absence.

Do SRVs work with IPv6?

Yes, SRVs point to names that can have A (IPv4) and/or AAAA (IPv6) records. The client then chooses the IP version.

Does MoniTao monitor SRVs?

Yes, MoniTao can monitor your SRV records and alert you if configuration changes or target servers become unreachable.

Automate Service Discovery

SRV records bring intelligence and flexibility to your DNS infrastructure. Load-balancing, automatic failover, custom ports - all without complex client configuration.

Configure your SRVs carefully, test client behavior, and monitor your services. MoniTao can alert you if your SRVs change or if target servers go down.

Ready to Sleep Soundly?

Start free, no credit card required.