What is an SRV record?
A service record (SRV record) is a specification of servers in the Domain Name System by hostname and port number. With an SRV record, it is possible to make a server discoverable and designate high priority and high availability servers using a single domain without having to know the exact address of the servers.
SRV record format
A typical SRV record looks like the following in standard BIND format:
$ORIGIN example.com.
_sip._udp 3600 IN SRV 10 5 5060 siphost.com.
An anatomy of the SRV Record
looks like the below:
Host Label | TTL | Record Class | Record Type | Priority | Weight | Port | Target Host |
---|---|---|---|---|---|---|---|
_sip._udp.example.com. | 3600 | IN | SRV | 10 | 5 | 5060 | siphost.com. |
This field of an SRV record is composed of three parts separated by periods (.). These parts are Service, Proto, and Name in the format of _service._proto.name.
- Service is the symbolic name of the desired service, an underscore (_) is added to the service identifier to avoid confusion with DNS labels.
- Proto is the symbolic name of the desired protocol, with an underscore (_) added to prevent collisions with DNS labels that occur in nature.
- Name is the domain or subdomain this record refers to.
The time-to-live in seconds. It specifies how long a resolver is supposed to cache or remember the DNS query before the query expires and a new one needs to be done.
Record Class
Mainly 3 classes of DNS records exist:
- IN (Internet) – default and generally what internet uses.
- CH (Chaosnet) – used for querying DNS server versions.
- HS (Hesiod) – uses DNS functionality to provide access to databases of information that change infrequently.
The record format is defined using this field. Common record types are A, AAAA, CNAME, CAA, TXT etc. In the case of an SRV record, the record type is SRV.
Priority
An integer that decides the priority of this target host. Much like the priority in MX record, the lower the number in the priority field, the more desirable the associated target.
Weight
This field specifies a relative weight for entries with the same priority. Larger weights are given a higher priority. This value is a number between 0 - 65535. If you have only a single SRV record, use 0 as the weight.
Port
TCP or UDP port where the specified service can be found. This is often as specified in Assigned Numbers but this is not a requirement, for instance, you are allowed to define a _http service with a port number of 81 rather than the default port 80.
Target Host
The domain name of the target host that will be providing this service. Does not have to be in the same zone (domain).
How to add an SRV record?
For instructions on how to add an SRV record with us, you may refer to the tutorial here.
SRV record glossary
Service
Service is the symbolic service name prepended with a '_' (underscore) and it is case insensitive. Common values are _http for Web Service, _ftp for File Transfer Protocol, _imap for IMAP, _sip - Session Initiation Protocol etc.
Proto
Proto is the protocol name prepended with a '_' (underscore) and it is case insensitive. Common values are _tcp for TCP protocol and _udp for UDP protocol.
BIND
Berkeley Internet Name Daemon - is the most commonly used DNS software on the Internet and Dynu observes BIND format.