A Service record (SRV record) is a specification of data in the
Domain Name System
The Domain Name System (DNS) is a hierarchical and distributed name service that provides a naming system for computers, services, and other resources on the Internet or other Internet Protocol (IP) networks. It associates various information ...
defining the location, i.e., the hostname and port number, of servers for specified services. It is defined in , and its type code is 33. Some Internet protocols such as the
Session Initiation Protocol
The Session Initiation Protocol (SIP) is a signaling protocol used for initiating, maintaining, and terminating communication sessions that include voice, video and messaging applications. SIP is used in Internet telephony, in private IP telepho ...
(SIP) and the
Extensible Messaging and Presence Protocol
Extensible Messaging and Presence Protocol (abbreviation XMPP, originally named Jabber) is an open communication protocol designed for instant messaging (IM), presence information, and contact list maintenance. Based on XML (Extensible Marku ...
(XMPP) often require SRV support by network elements.
Record format
A SRV record has the form:
* ''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
Time to live (TTL) or hop limit is a mechanism which limits the lifespan or lifetime of data in a computer or network. TTL may be implemented as a counter (digital), counter or timestamp attached to or embedded in the data. Once the prescribed ev ...
field.
* ''IN'': 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
A Domain Name System (DNS) zone file is a text file that describes a DNS zone. A DNS zone is a subset, often a single domain, of the hierarchical domain name structure of the DNS. The zone file contains mappings between domain names and IP add ...
might be the following:
This points to a server named
sipserver.example.com
listening on TCP port 5060 for
Session Initiation Protocol
The Session Initiation Protocol (SIP) is a signaling protocol used for initiating, maintaining, and terminating communication sessions that include voice, video and messaging applications. SIP is used in Internet telephony, in private IP telepho ...
(SIP) protocol services. The priority given here is 0, and the weight is 5.
As in
MX record
A mail exchanger record (MX record) specifies the mail server responsible for accepting email messages on behalf of a domain name. It is a resource record in the Domain Name System (DNS). It is possible to configure several MX records, typically ...
s, the target in SRV records must point to hostname with an address record (
A or
AAAA record
This list of DNS record types is an overview of resource records (RRs) permissible in zone files of the Domain Name System
The Domain Name System (DNS) is a hierarchical and distributed name service that provides a naming system for comput ...
). Pointing to a hostname with a
CNAME record is not a valid configuration.
Provisioning for high service availability
The ''priority'' field determines the precedence of the 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.
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 weight 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. The 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.
Usage
SRV records are common in conjunction with the following
standardized
Standardization (American English) or standardisation (British English) is the process of implementing and developing technical standards based on the consensus of different parties that include firms, users, interest groups, standards organiza ...
communications protocol
A communication protocol is a system of rules that allows two or more entities of a communications system to transmit information via any variation of a physical quantity. The protocol defines the rules, syntax, semantics (computer science), sem ...
s:
*
APT
*
CalDAV
Calendaring Extensions to WebDAV, or CalDAV, is an Internet standard allowing a client to access and manage calendar data along with the ability to schedule meetings with users on the same or on remote servers. It lets multiple users in differe ...
and
CardDAV
vCard Extensions to WebDAV (CardDAV) is an address book client/server protocol designed to allow users to access and share contact data on a server.
The CardDAV protocol was developed by the IETF and was published as in August 2011. CardDAV is ...
*
Ceph
*
DANE
*
DNS Service Discovery (DNS-SD)
*
Factorio
*
Host Identity Protocol
The Host Identity Protocol (HIP) is a host identification technology for use on Internet Protocol (IP) networks, such as the Internet. The Internet has two main name spaces, IP addresses and the Domain Name System. HIP separates the end-point ide ...
*
Kerberos
*
LDAP
The Lightweight Directory Access Protocol (LDAP ) is an open, vendor-neutral, industry standard application protocol for accessing and maintaining distributed Directory service, directory information services over an Internet Protocol (IP) networ ...
*
SMTP
The Simple Mail Transfer Protocol (SMTP) is an Internet standard communication protocol for electronic mail transmission. Mail servers and other message transfer agents use SMTP to send and receive mail messages. User-level email clients typi ...
submission
Deference (also called submission or passivity) is the condition of submitting to the espoused, legitimate influence of one's superior or superiors. Deference implies a yielding or submitting to the judgment of a recognized superior, out of re ...
,
POP, and
IMAP
In computing, the Internet Message Access Protocol (IMAP) is an Internet standard protocol used by email clients to retrieve email messages from a mail server over a TCP/IP connection. IMAP is defined by .
IMAP was designed with the goal of per ...
*
Matrix.org
*
Minecraft
''Minecraft'' is a 2011 sandbox game developed and published by the Swedish video game developer Mojang Studios. Originally created by Markus Persson, Markus "Notch" Persson using the Java (programming language), Java programming language, the ...
*
MongoDB
MongoDB is a source-available, cross-platform, document-oriented database program. Classified as a NoSQL database product, MongoDB uses JSON-like documents with optional database schema, schemas. Released in February 2009 by 10gen (now MongoDB ...
*
Mumble
*
IMPS
IMP or imp may refer to:
* Imp, a fantasy creature
Arts and entertainment
Music
* IMP (band) a Japanese boy band
Fictional characters
* Imp (She-Ra), a character in ''She-Ra: Princess of Power''
* Imp a character in ''Artemis Fowl: The Lost ...
*
Puppet
A puppet is an object, often resembling a human, animal or Legendary creature, mythical figure, that is animated or manipulated by a person called a puppeteer. Puppetry is an ancient form of theatre which dates back to the 5th century BC in anci ...
*
Rust
Rust is an iron oxide, a usually reddish-brown oxide formed by the reaction of iron and oxygen in the catalytic presence of water or air moisture. Rust consists of hydrous iron(III) oxides (Fe2O3·nH2O) and iron(III) oxide-hydroxide (FeO(OH) ...
*
Session Initiation Protocol
The Session Initiation Protocol (SIP) is a signaling protocol used for initiating, maintaining, and terminating communication sessions that include voice, video and messaging applications. SIP is used in Internet telephony, in private IP telepho ...
*
STUN
*
Teamspeak 3
*
XMPP
Extensible Messaging and Presence Protocol (abbreviation XMPP, originally named Jabber) is an Open standard, open communication protocol designed for instant messaging (IM), presence information, and contact list maintenance. Based on XML (Ext ...
In
Microsoft
Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
Windows 2000
Windows 2000 is a major release of the Windows NT operating system developed by Microsoft, targeting the server and business markets. It is the direct successor to Windows NT 4.0, and was Software release life cycle#Release to manufacturing (RT ...
clients query for SRV records to determine the
domain controller
A domain controller (DC) is a Server (computing), server that responds to security authentication requests within a computer network domain. It is a Network (computing), network server that is responsible for allowing Host (network), host access to ...
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
Active Directory (AD) is a directory service developed by Microsoft for Windows domain networks. Windows Server operating systems include it as a set of processes and services. Originally, only centralized domain management used Active Direct ...
in the DNS.
An older version of the
Internet Draft for
OpenPGP
Pretty Good Privacy (PGP) is an encryption program that provides cryptographic privacy and authentication for data communication. PGP is used for signing, encrypting, and decrypting texts, e-mails, files, directories, and whole disk partit ...
Web Key Directory uses SRV records for discovering OpenPGP keys through web servers. Usages of SRV records are no longer part of the Internet Draft in later versions.
A registry of service names for SRV records & protocols is maintained by the
Internet Assigned Numbers Authority
The Internet Assigned Numbers Authority (IANA) is a standards organization that oversees global IP address allocation, Autonomous system (Internet), autonomous system number allocation, DNS root zone, root zone management in the Domain Name Syste ...
(IANA) as defined in RFC 6335.
See also
*
List of DNS record types
This list of DNS record types is an overview of resource records (RRs) permissible in zone files of the Domain Name System
The Domain Name System (DNS) is a hierarchical and distributed name service that provides a naming system for compu ...
References
External links
RFC 2782 – Definition of the SRV resource record-
RFC 6186 – Use of SRV Records for Locating Email Submission/Access Services-
Using DNS SRV records to locate whois servers (Internet-Draft)-
Use of SRV records in conjunction with HTTP and URIs (Internet-Draft)-
Service Name and Transport Protocol Port Number Registry- {{webarchive , url=https://web.archive.org/web/20200706003543/https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml , date=6 July 2020
DNS record types