SRV Records

Service Discovery: Defining the location, port, and priority of specific services.

What is an SRV Record?

An SRV record (Service record) specifies the location (hostname and port number) of specific services, such as VoIP, instant messaging (XMPP), or directory services (LDAP). Unlike most other DNS records, an SRV record includes port information, allowing different services to run on the same server but on different ports.

Structure of an SRV Record

_sip._tcp.example.com. 3600 IN SRV 10 60 5060 sipserver.example.com.

Components of an SRV Record

  • Service: The symbolic name of the service (e.g., _sip, _ldap, _xmpp-client).
  • Protocol: The transport protocol (usually _tcp or _udp).
  • Domain: The domain name this record belongs to.
  • Priority: Lower values are tried first. This works exactly like MX priority.
  • Weight: A relative weight for records with the same priority (higher values get more traffic). This allows for load balancing.
  • Port: The TCP or UDP port number where the service is running.
  • Target: The hostname of the server providing the service.

Common Use Case: SIP & VoIP

SRV records are widely used in VoIP (Voice over IP) systems to help phones and software clients find the SIP server for a domain automatically. This makes configuration much easier for end-users.

SRV Load Balancing

By using Priority and Weight, SRV records provide a powerful way to handle failover and load balancing natively in the DNS:

  • If you have two servers with different Priority, the one with the lower number is the primary, and the other is a backup.
  • If you have two servers with the same Priority but different Weights (e.g., 75 and 25), the first server will receive roughly 75% of the traffic.