Have a Question?

If you have any question you can ask below or enter what you are looking for!

Understanding SRV Record and The Need for One

There are several types of DNS records. One of the most uncommon is SRV record.

Services Resource Record links a service with a hostname. Applications that need to detect the location of a particular service initiate a query for the applicable SRV record. The data returned by the query includes the following:

  • One or multiple hostnames
  • Port that the service works on
  • Two values to determine relative priority and service performance

After obtaining the hostname (A or AAAA record), the query will also obtain pertinent IP addresses. SRV records are supported and utilised by services like LDAP, SIP, MS Outlook, and XMPP.

Common Syntax of an SRV Record

Service

Protocol

Priority

Weight

Port

Host

Target

TTL

_sip

TCP / UDP / TLS

0

1

2000

[optional]

www.sip.domain.com.

15min/1hour/1day/1week

Below are the meanings of each field:

Service – defines the symbolic service name that starts with the underscore symbol. The standard services are maintained by IANA: http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml.com

Protocol – defines protocol name with common values (tcp and _udp).

Priority – lower numbers mean higher priority ranging from 0 to 65535.

Weight – is used when there are more than one service listed with the same priority. For example, you have two SRV records with 0 (zero) priority but one has a weight of 1 and the other has a weight of 4. The record with weight 4 will be delivered 4 times out of 5 by nameservers. The range of weight values is between 0 and 65535.

Port – defines the port number that delivers the service on target server. For example, you can use port 2000 instead of the more common port 80.

Host – defines the target external domain.

Target – defines the name of the host that provides the service and requires a proper A or AAAA record. If the ‘Host’ entry is left out, the target is considered as internal. A value of ‘.’ on the target blocks a service on your host.

TTL – indicates time-to-live value defining how long caching nameservers must cache the SRV record before querying your DNS server for the new value.

Examples

  1. Describes LDAP service available at ldap.domain.com:
  2. A (Host record)

    ldap   192.168.1.66   1Day

    SRV (Service record)

    _ldap   TCP   0   5   389   ldap   1Week
  3. Simple load balancing. The .51 server gets two times more connections than .50:

A (Host records)

www   192.168.1.51   1Day
192.168.1.50   1Day
backup   192.168.1.55   1Day

SRV (Service record)

_http   TCP   0   2   80   www.domain.com.   1Week
_http   TCP   0   1   80   www2.domain.com.   1Week
_http   TCP   1   1   2000   backup.domain.com.   1Week

Should a client not ‘understand’ SRV records, it will use Round-Robin switching listed in the A records. With .50 and .51 servers not accessible, use backup.domain.com server (.55).

Leave a Reply

You must be logged in to post a comment.