Let’s investigate one more complicated DNS recourse record, the DNS SRV record. It is a very important one that points not only to the service, its location but also the exact port that it uses for communication. Let’s see the DNS SRV record in detail.
What is the DNS SRV record?
The DNS SRV record (service record) is a DNS record that is used to show the service’s port and hostname. What makes it different from other DNS records is that it specifies port too, and not the only hostname. That way, you can set through which port you want to be used a specified service.
It is a very useful DNS record for setting up a multi-host configuration. Now you can use multiple servers with different services with the same domain.
The DNS SRV record is very commonly used for APT, DANE, SMTP, POP, IMAP, SIP like Skype, Slack, etc.
DNS SRV record syntax:
_Service._Proto.Name TTL Class SRV Priority Weight Port Target
The components of the DNS SRV record are TYPE, TTL, NAME, PRIORITY, WEIGHT, PORT, TARGET.
What is a port?
When we are talking about computer networking, a port is the endpoint of communication. It is an identifier of a process or a type of network service. The ports have their specific number that is always related to IP addresses. It makes the origin or the destination complete.
Ports and ports’ numbers are digital, but if we want to make an analogy, let’s see an example with radio.
A particular radio frequency is dedicated to FM radio. Imagine the FM radio as the port, and the exact frequency of your favorite FM station, like 98.2 MHz, is the exact port number.
Common port numbers are 20 (FTP Data Transfer), 21 (FTP Command Control), 22 (SSH), 23 (Telnet), 25 (SMTP), 53 (DNS), 67 (DHCP), 68 (DHCP), 80 (HTTP), 110 (POP3), 119 (NNTP), 123 (NTP), 143 (IMAP), 161 (SNMP), 194 (IRC), 443 (HTTPS).
What’s inside the DNS SRV record?
SERVICE – The short name of the service for which we are using the SRV.
PROTOCOL (PROTO) – here, we specify the protocol that we want to use for the communication like UDP, TCP, HTTP, HTTPS, etc.
NAME – the domain name for which the DNS SRV record is valid.
TTL – standard TTL field for a DNS record.
TYPE – SRV.
CLASS – Standard DNS field. You will see it with “IN”.
PRIORITY – You can have multiple hosts (servers) for the same service. The lower the number is, the higher the priority of the host is. The value must be between 0 and 65535. In case there are two hosts with the same priority, the weight parameter will determine the order.
WEIGHT – The weight is a selection mechanism for servers. A larger weight means a higher chance of getting connected. You can put higher weight (lower number) to a more powerful server, so it gets more connections. Again the number is between 0 and 65535.
PORT – The exact port like 53, 23, etc. It is a number between 0 and 65535.
TARGET – The hostname of the server that provides the service and ends with a “.”.
Conclusion
You now know what the SRV record is, why it is used and what’s inside one. Go ahead and use your newly-obtained knowledge for your configurations.