Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

What Is a DNS SRV Record? Syntax, Setup, and Testing

See how an SRV record tells compatible apps which hostname and port to use, then add and verify one with dig or nslookup.

Table of Contents

A DNS SRV record tells a compatible application which hostname and port to use for a named service. For example, a SIP client can look up _sip._tcp.example.com to find the SIP server for example.com. The client must support SRV discovery for that service.

What is SRV Record? Structure and how to create SRV Record Picture 1
What is an SRV record?

SRV record syntax and example

_sip._tcp.example.com. 3600 IN SRV 10 0 5060 sip1.example.com.
  • Name: _sip._tcp.example.com. combines the service, transport protocol, and domain. Both service and protocol have leading underscores.
  • TTL: 3600 is the cache lifetime in seconds. IN is the Internet DNS class.
  • Priority: 10 is tried before a higher number such as 20.
  • Weight: 0 works when there is one target at that priority. For multiple targets at the same priority, larger weights make a target more likely to be selected. Use separate priorities for primary and backup hosts.
  • Port: 5060 is the port the client should connect to in this example.
  • Target: sip1.example.com. is a hostname with its own A or AAAA record. Use neither an IP literal nor a CNAME alias as the target.

SRV supplies the endpoint name and port. Address records supply the IP address. See the DNS basics lesson for how that separate lookup works.

Add the record in your DNS control panel

  1. Open the DNS zone at the provider that hosts your authoritative nameservers and create an SRV record.
  2. Enter the service, protocol, and domain name supplied by your service provider. Some panels want _sip._tcp as the record name and append the zone automatically. Others have separate fields or ask for the full name.
  3. Enter the documented priority, weight, port, and target. Make sure the target has the correct address record and the server is listening on the specified port.
  4. Save and test the exact name your application queries.

Verify the result

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

The first command should return the priority, weight, port, and target in that order. For more Windows examples, see how to use nslookup for DNS troubleshooting.

If the answer is empty, check the service and protocol prefixes and look for a duplicated zone name. Query an authoritative nameserver directly if you need to distinguish a DNS configuration error from an older cached answer. If the SRV result is correct but the application fails to connect, resolve the target hostname and check whether the application supports SRV and can reach the published port.

For the record format and target selection rules, see RFC 2782.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.