SRV Record — Service Location
Learn how DNS SRV records specify the location of services like SIP, XMPP, and LDAP. Understand priority, weight, port fields, and service discovery patterns.
Zone File Entry
_sip._tcp.example.com. IN SRV 10 60 5060 sipserver.example.com.
Detailed Explanation
What Is an SRV Record?
An SRV record (Service record) specifies the hostname and port for a specific service on your domain. Unlike A or CNAME records, SRV records include priority, weight, and port information, enabling sophisticated service discovery and load balancing.
BIND Zone File Syntax
; Format: _service._protocol.domain. TTL IN SRV priority weight port target
_sip._tcp.example.com. 3600 IN SRV 10 60 5060 sipserver.example.com.
_sip._tcp.example.com. 3600 IN SRV 10 40 5060 sipbackup.example.com.
_xmpp-server._tcp.example.com. 3600 IN SRV 5 0 5269 xmpp.example.com.
_ldap._tcp.example.com. 3600 IN SRV 0 100 389 ldap.example.com.
Field Breakdown
| Field | Description |
|---|---|
_service |
Service name preceded by underscore (e.g., _sip, _xmpp-server, _ldap) |
_protocol |
Transport protocol: _tcp or _udp |
priority |
Lower values are tried first (like MX priority) |
weight |
Relative weight for load balancing among same-priority records |
port |
TCP or UDP port number the service listens on |
target |
Hostname providing the service (must not be a CNAME) |
Priority and Weight
Priority works like MX records — clients connect to the lowest-priority servers first and fail over to higher-priority servers.
Weight distributes traffic among servers with the same priority. In the SIP example above, both servers have priority 10. The server with weight 60 receives approximately 60% of the traffic, while the server with weight 40 receives approximately 40%.
To disable a service, set the target to . (a single dot):
_sip._tcp.example.com. IN SRV 0 0 0 .
Common SRV Record Uses
- SIP (Voice over IP):
_sip._tcpand_sip._udp - XMPP (Jabber messaging):
_xmpp-client._tcpand_xmpp-server._tcp - LDAP (Directory services):
_ldap._tcp - Kerberos authentication:
_kerberos._tcpand_kerberos._udp - CalDAV/CardDAV:
_caldavs._tcpand_carddavs._tcp - Minecraft servers:
_minecraft._tcp
Microsoft Active Directory
Active Directory relies heavily on SRV records for service discovery. Domain controllers register SRV records for LDAP, Kerberos, and Global Catalog services, allowing domain-joined machines to automatically locate the nearest domain controller:
_ldap._tcp.dc._msdcs.example.com. IN SRV 0 100 389 dc1.example.com.
_kerberos._tcp.example.com. IN SRV 0 100 88 dc1.example.com.
Limitations
SRV records are only useful for protocols and applications that explicitly support SRV lookups. Standard HTTP web browsers do not query SRV records to find web servers — they use A and AAAA records. The HTTPSSVC (HTTPS) record type is an emerging alternative for HTTP-based service discovery.
Use Case
Configure SRV records to enable automatic service discovery for protocols like SIP, XMPP, LDAP, and Kerberos, allowing clients to find the correct server and port without manual configuration.