NETWORK ENGINEER, WEB DEVELOPER, CONTENT CREATOR & BLOGGER

Kong Vichka, Hello everyone welcome to my website!

Follow Me

What is a DNS SRV Record?

A DNS SRV (Service) record is a type of DNS record used to define the location of servers or services within a domain. It specifies details like the hostname, port, priority, and weight for a service, enabling clients to discover the network endpoints for specific services automatically.

Structure of an SRV Record

An SRV record includes the following components:

  1. Service: The symbolic name of the desired service (e.g., _sip, _ldap).
  2. Protocol: The transport protocol used by the service, typically _tcp or _udp.
  3. Name: The domain name for which the SRV record is valid.
  4. Priority: A preference level for the service. Lower numbers indicate higher priority.
  5. Weight: A load-balancing mechanism among records with the same priority. Higher weight means higher preference.
  6. Port: The port number on which the service is running.
  7. Target: The hostname of the machine providing the service.

Example SRV Record

For a SIP (Session Initiation Protocol) service:

_sip._tcp.example.com. 86400 IN SRV 10 60 5060 sipserver1.example.com.
_sip._tcp.example.com. 86400 IN SRV 20 40 5060 sipserver2.example.com.

Here’s how to interpret this:

  • Service: _sip (SIP service)
  • Protocol: _tcp (TCP protocol)
  • Domain: example.com
  • Priority: 10 (sipserver1 is preferred over sipserver2)
  • Weight: 60 for sipserver1, 40 for sipserver2 (sipserver1 gets 60% of requests if the priority is the same)
  • Port: 5060 (port where the service is available)
  • Target: sipserver1.example.com and sipserver2.example.com (hostnames of the servers)

Use Cases for SRV Records

  1. VoIP and SIP Services:
    • SRV records are commonly used for VoIP systems to discover SIP servers.
  2. Microsoft Services:
    • Active Directory uses SRV records to locate domain controllers for authentication and other directory services.
  3. XMPP (Jabber):
    • Instant messaging and chat systems like XMPP use SRV records to locate servers.
  4. Load Balancing:
    • SRV records help distribute network traffic across multiple servers by using priority and weight.

Benefits of SRV Records

  • Service Discovery: Allows clients to discover services dynamically without hardcoding server details.
  • Scalability: Facilitates load balancing and failover by defining multiple records with different priorities and weights.
  • Flexibility: Makes it easier to change the backend server or infrastructure without affecting the client configuration.

How to Create an SRV Record

You can create an SRV record in your domain’s DNS management tool. You’ll need to specify the service, protocol, priority, weight, port, target, and TTL (time to live). Proper configuration ensures clients can seamlessly connect to the required services.