Introducing PostScale -- email API for transactional, inbound, and masked addresses. PostScale

    What Is an SRV Record

    Learn how SRV records enable service discovery by specifying host and port information for services. Includes examples for the DNScale dashboard and API.

    An SRV (Service) record specifies the location of servers for specific services. Unlike A records that simply map names to IPs, SRV records provide the hostname, port, priority, and weight for a service—enabling sophisticated service discovery and load balancing.

    How SRV Records Work

    SRV records use a special naming convention:

    _service._protocol.domain.    TTL    SRV    priority weight port target

    Example:

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

    This tells clients: "To reach the SIP service over TCP for example.com, connect to sipserver.example.com on port 5060."

    Record Components

    ComponentDescriptionExample
    ServiceService name (prefixed with _)_sip, _xmpp, _ldap
    ProtocolNetwork protocol (prefixed with _)_tcp, _udp
    PriorityLower values = higher priority10
    WeightLoad distribution among same priority60
    PortTCP/UDP port number5060
    TargetHostname of the serversipserver.example.com.

    Common Use Cases

    VoIP / SIP

    _sip._tcp.example.com.     3600    SRV    10 100 5060 sip1.example.com.
    _sip._tcp.example.com.     3600    SRV    20 100 5060 sip2.example.com.
    _sip._udp.example.com.     3600    SRV    10 100 5060 sip1.example.com.

    XMPP (Jabber) Messaging

    _xmpp-client._tcp.example.com.    3600    SRV    5 0 5222 xmpp.example.com.
    _xmpp-server._tcp.example.com.    3600    SRV    5 0 5269 xmpp.example.com.

    Microsoft 365 / Teams

    _sipfederationtls._tcp.example.com.    3600    SRV    100 1 5061 sipfed.online.lync.com.
    _sip._tls.example.com.                 3600    SRV    100 1 443 sipdir.online.lync.com.

    LDAP Directory Services

    _ldap._tcp.example.com.        3600    SRV    0 100 389 ldap.example.com.
    _ldaps._tcp.example.com.       3600    SRV    0 100 636 ldap.example.com.
    _ldap._tcp.dc._msdcs.example.com.  3600    SRV    0 100 389 dc1.example.com.

    CalDAV / CardDAV

    _caldav._tcp.example.com.      3600    SRV    0 0 80 calendar.example.com.
    _caldavs._tcp.example.com.     3600    SRV    0 0 443 calendar.example.com.
    _carddav._tcp.example.com.     3600    SRV    0 0 80 contacts.example.com.
    _carddavs._tcp.example.com.    3600    SRV    0 0 443 contacts.example.com.

    Minecraft Servers

    _minecraft._tcp.example.com.    3600    SRV    0 5 25565 mc.example.com.

    Matrix/Element Chat

    _matrix._tcp.example.com.    3600    SRV    10 0 8448 matrix.example.com.

    Priority and Weight Explained

    Priority (Preference)

    Lower values are tried first:

    _sip._tcp.example.com.    SRV    10 50 5060 primary.example.com.
    _sip._tcp.example.com.    SRV    20 50 5060 backup.example.com.

    Clients try primary.example.com first (priority 10), then backup.example.com (priority 20) if the primary fails.

    Weight (Load Distribution)

    Among servers with the same priority, weight determines distribution:

    _sip._tcp.example.com.    SRV    10 70 5060 server1.example.com.
    _sip._tcp.example.com.    SRV    10 30 5060 server2.example.com.

    Server1 receives ~70% of traffic, server2 receives ~30%.

    Record Format

    FieldDescriptionExample
    Name_service._protocol.domain_sip._tcp.example.com
    TypeRecord typeSRV
    PriorityServer preference (lower = preferred)10
    WeightLoad balancing weight50
    PortService port5060
    ContentTarget hostnamesipserver.example.com.
    TTLTime to live (seconds)3600

    Adding an SRV Record

    Using the Dashboard

    1. Navigate to your zone in the DNScale dashboard
    2. Click Add Record
    3. Configure the record:
      • Name: Enter _service._protocol (e.g., _sip._tcp)
      • Type: Select SRV
      • Priority: Set priority value (e.g., 10)
      • Weight: Set weight value (e.g., 50)
      • Port: Set the service port (e.g., 5060)
      • Value: Enter the target hostname
      • TTL: Set the cache duration (default: 3600)
    4. Click Create Record

    Using the API

    Create an SRV record:

    curl -X POST "https://api.dnscale.eu/v1/zones/{zone_id}/records" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "_sip._tcp",
        "type": "SRV",
        "content": "sipserver.example.com",
        "ttl": 3600,
        "priority": 10,
        "weight": 50,
        "port": 5060
      }'

    Set up XMPP records:

    # Client connections
    curl -X POST "https://api.dnscale.eu/v1/zones/{zone_id}/records" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "_xmpp-client._tcp",
        "type": "SRV",
        "content": "xmpp.example.com",
        "ttl": 3600,
        "priority": 5,
        "weight": 0,
        "port": 5222
      }'
     
    # Server-to-server federation
    curl -X POST "https://api.dnscale.eu/v1/zones/{zone_id}/records" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "_xmpp-server._tcp",
        "type": "SRV",
        "content": "xmpp.example.com",
        "ttl": 3600,
        "priority": 5,
        "weight": 0,
        "port": 5269
      }'

    API Response:

    {
      "status": "success",
      "data": {
        "message": "Record created successfully",
        "record": {
          "id": "encoded-record-id",
          "name": "_sip._tcp.example.com.",
          "type": "SRV",
          "content": "10 50 5060 sipserver.example.com.",
          "ttl": 3600,
          "disabled": false
        }
      }
    }

    Best Practices

    1. Use meaningful priorities - Keep gaps between priority values (10, 20, 30) for future flexibility

    2. Target must have A/AAAA records - SRV targets should resolve to IP addresses, not CNAMEs

    3. Use weight for load balancing - Distribute traffic among same-priority servers using weight

    4. Don't use port 0 - A weight of 0 means the server should be used as a last resort

    5. Test with applications - Not all applications respect SRV records; verify with your specific software

    Disabling a Service

    To indicate a service is not available, use a target of .:

    _sip._tcp.example.com.    3600    SRV    0 0 0 .

    Testing SRV Records

    Verify your SRV records with dig:

    dig SRV _sip._tcp.example.com
     
    # With full output
    dig SRV _xmpp-client._tcp.example.com +short
    • A - IPv4 address for the target server
    • AAAA - IPv6 address for the target server
    • HTTPS - Modern service binding for HTTPS
    • SVCB - General service binding

    Conclusion

    SRV records are essential for service discovery, enabling applications to automatically find the right servers, ports, and failover options. They're critical for VoIP, instant messaging, and many enterprise protocols. DNScale's support for SRV records lets you configure sophisticated service architectures with priority-based failover and weighted load balancing.