What is an SRV record?
An SRV or service record is a DNS record that holds information about the domain, such as the hostname, port number, and protocol details. The SRV record helps us identify the location of a particular server. One can use the SRV record to configure services like instant messaging, SMTP, or VoIP. An SRV record must always point to an A/AAAA record. The server name that they point to cannot be the CNAME of that domain.
Why you need DNS SRV?
Generally, the traffic that any website receives is distributed among various ports to balance the load. A port number is a virtual address similar to an IP address and it identifies the port to which the traffic should be diverted. With the website getting multiple requests simultaneously, each type of request is specified to be handled by a specific server.
Thus, the port number acts as a gateway to streamline and navigate the load to its specified server. An SRV record helps to connect a request to its related port by means of a port number. With the help of the SRV record, the content (audio, video, chat, etc.) is channelized and the traffic is distributed among different ports.
Example of an SRV record
An SRV record always has a service name and protocol name followed by its host/domain name. Some records may contain its TTL value, class, and type as well. Here is an example of an SRV record.
_sip: Denotes the service name. In general, service name and protocol name always start with an underscore.
_tcp: Denotes the type of protocol that is used for this particular service.
abc.com: Denotes the host/domain name.
How to perform an SRV lookup
In order to retrieve the SRV records for a particular domain, enter the domain/hostname in the toolbox provided. Zoho Toolkit helps you identify the priority, weight, port number, and target. For example, when you enter abc.com as your domain name, the result you'll get will consist of:
Components of an SRV record
Priority: As the name suggests, the port number helps prioritize which server needs to handle a request as compared with the other port numbers. The lower the priority, the higher the load it can receive.
Weight: Weight is a measure similar to priority and will be referred to when two servers work with the same priority. The higher the weight, the higher the preference of the server to receive more traffic.
Port number: The port number represents the type of port available for the servers to connect. TCP/UDP ports are used for this sort of communication.
Target: The target defines the host name of the machine.
When to use an SRV record
Consider handling different subdomains of abc.com, like blogs, videos, and chat, on the same IP. For enterprises, multiple servers usually run on the same IP. To ensure the connection is seamless and the load is balanced, different ports are used for different processes. In this scenario, the domain owner uses the SRV record to specify which port needs to be communicated for a particular request. Hence, the SRV record is used when the load to the server is high and needs to be balanced.
Frequently Asked Questions
What is the difference between CNAME and SRV record?The CNAME, or canonical name record, is used to map the host name of one domain to another domain, whereas an SRV record defines the host name to which a certain service is assigned.
What is the difference between an A record and a SRV record?An A record helps us point the domain name to its IP address, whereas an SRV record specifies the location of a specific service and how a domain can reach that server.
What happens when the weights of the servers are of same?Weights are considered only when the priorities are similar. If two servers hold the same weight, then the traffic is distributed equally between them.