A Service record (SRV record) is a specification of data in the Domain Name System defining the location, i.e., the hostname and port number, of servers for specified services. It is defined in RFC 2782, and its type code is 33. Some Internet protocols such as the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP) often require SRV support by network elements.
A SRV record has the form:
_service._proto.name. TTL class SRV priority weight port target.
- service: the symbolic name of the desired service.
- proto: the transport protocol of the desired service; this is usually either TCP or UDP.
- name: the domain name for which this record is valid, ending in a dot.
- TTL: standard DNS time to live field.
- class: standard DNS class field (this is always IN).
- SRV: Type of Record (this is always SRV).
- priority: the priority of the target host, lower value means more preferred.
- weight: A relative weight for records with the same priority, higher value means higher chance of getting picked.
- port: the TCP or UDP port on which the service is to be found.
- target: the canonical hostname of the machine providing the service, ending in a dot.
An example SRV record in textual form that might be found in a zone file might be the following:
_sip._tcp.example.com. 86400 IN SRV 0 5 5060 sipserver.example.com.
This points to a server named sipserver.example.com listening on TCP port 5060 for Session Initiation Protocol (SIP) protocol services. The priority given here is 0, and the weight is 5.
Provisioning for high service availabilityEdit
The priority field determines the precedence of use of the record's data. Clients should use the SRV records with the lowest-numbered priority value first, and fall back to records of higher value if the connection fails. If a service has multiple SRV records with the same priority value, clients should load balance them in proportion to the values of their weight fields. In the following example, both the priority and weight fields are used to provide a combination of load balancing and backup service.
# _service._proto.name. TTL class SRV priority weight port target. _sip._tcp.example.com. 86400 IN SRV 10 60 5060 bigbox.example.com. _sip._tcp.example.com. 86400 IN SRV 10 20 5060 smallbox1.example.com. _sip._tcp.example.com. 86400 IN SRV 10 20 5060 smallbox2.example.com. _sip._tcp.example.com. 86400 IN SRV 20 0 5060 backupbox.example.com.
The first three records share a priority of 10, so the weight field's value will be used by clients to determine which server (host and port combination) to contact. The sum of all three values is 100, so bigbox.example.com will be used 60% of the time. The two hosts, smallbox1 and smallbox2 will be used for 40% of requests total, with half of them sent to smallbox1, and the other half to smallbox2. If bigbox is unavailable, these two remaining machines will share the load equally, since they will each be selected 50% of the time.
If all three servers with priority 10 are unavailable, the record with the next lowest priority value will be chosen, which is backupbox.example.com. This might be a machine in another physical location, presumably not vulnerable to anything that would cause the first three hosts to become unavailable.
The load balancing provided by SRV records is inherently limited, since the information is essentially static. Current load of servers is not taken into account, unless TTL values are low enough (around a minute or lower) that the priority (or weight) values can be quickly updated.
- CalDAV and CardDAV
- DNS Service Discovery (DNS-SD)
- Host Identity Protocol
- SMTP submission, POP, and IMAP
- Session Initiation Protocol
- Teamspeak 3
In Microsoft Windows 2000 clients query for SRV records to determine the domain controller for a given service. SRV records are also used by Outlook 2007, 2010 and Macintosh 10.6 mail to locate the Exchange Autodiscover service. In Microsoft Windows networks domain controllers register their network service types for Active Directory in the DNS.
- "DNS SRV record support in apt". Debian. 4 May 2018. Archived from the original on 17 November 2019. Retrieved 17 November 2019.
- "Looking up Monitors through DNS – Ceph Documentation". Ceph Documentation. Archived from the original on 5 December 2017. Retrieved 4 December 2017.
- "Hostnames for the Master and Slave KDCs". Massachusetts Institute of Technology. Archived from the original on 21 October 2012. Retrieved 23 May 2012.
- Zeilenga, K. (April 2001). OpenLDAP Root Service - An experimental LDAP referral service. IETF. doi:10.17487/RFC3088. RFC 3088. Retrieved 5 July 2020.
- Daboo, C. (March 2011). Use of SRV Records for Locating Email Submission/Access Services. IETF. doi:10.17487/RFC6186. RFC 6186. Retrieved 17 April 2013.
- "Federation API". Matrix.org. Archived from the original on 5 July 2020. Retrieved 5 January 2018.
- "Java Edition 1.3.1". Minecraft Wiki. Archived from the original on 5 July 2020. Retrieved 5 July 2020.
- "Add DNS SRV record support - mumble-voip/mumble". GitHub. Archived from the original on 5 July 2020. Retrieved 5 July 2020.
- "Baraza - Userguide". Archived from the original on 22 August 2008.
- "Puppet Docs: Scaling Puppet with compile masters, Using DNS SRV Records". Puppet Labs. Archived from the original on 11 October 2019. Retrieved 17 December 2019.
- "[Suggestion] TS DNS". Teamspeak Forum. Archived from the original on 14 November 2016. Retrieved 25 October 2013.
- "TeamSpeak 3 Client Version 3.0.8 Released". Teamspeak Forum. Archived from the original on 27 September 2016. Retrieved 5 July 2020.
- "XEP-0156: Discovering Alternative XMPP Connection Methods". XMPP.org. Archived from the original on 7 May 2012. Retrieved 23 May 2012.
- "A new feature is available that enables Outlook 2007 to use DNS Service Location (SRV) records to locate the Exchange Autodiscover service". Microsoft Support. 13 May 2010. Archived from the original on 20 April 2012. Retrieved 23 May 2012.
- Cotton, M.; Eggert, L.; Touch, J.; Westerlund, M.; Cheshire, S. (August 2011). Internet Assigned Numbers Authority (IANA) Procedures for the Management of the Service Name and Transport Protocol Port Number Registry. IETF. doi:10.17487/RFC6335. RFC 6335. Retrieved 6 July 2020.
- RFC 2782 – Definition of the SRV resource record - Archived 6 July 2020 at the Wayback Machine
- RFC 6186 – Use of SRV Records for Locating Email Submission/Access Services - Archived 6 July 2020 at the Wayback Machine
- Using DNS SRV records to locate whois servers (Internet-Draft) - Archived 6 July 2020 at the Wayback Machine
- Use of SRV records in conjunction with HTTP and URIs (Internet-Draft) - Archived 6 July 2020 at the Wayback Machine
- Service Name and Transport Protocol Port Number Registry - Archived 6 July 2020 at the Wayback Machine