Black Friday: 60% off yearly plans with code BF2026, until November 30. See the deal

Learn

SRV record: how to point a service to a host and port

An SRV (service) record tells a client which hostname and port provide a named service for a domain, with priority and weight fields for failover and load sharing. Its format is _service._proto.name TTL IN SRV priority weight port target, as defined in RFC 2782.

The short answer
  • The record name starts with an underscored service and protocol, such as _sip._tcp.example.com.
  • The target must be a hostname with A or AAAA records, never a CNAME.
  • Only clients that implement SRV use it; web browsers do not look up SRV for HTTP.

What do the SRV fields mean?

SRV RDATA and owner name (RFC 2782)
FieldExampleMeaning
_service_sipSymbolic service name, prefixed with an underscore
_proto_tcpTransport protocol, usually _tcp or _udp
Priority10Lower is tried first; a client must try the lowest priority it can reach
Weight60Share of traffic among targets with the same priority; use 0 when no choice is needed
Port5060Port on the target host, 16-bit number
Targetsip1.example.com.Host that provides the service; needs A/AAAA records, not a CNAME

What does a working SRV set look like?

Two primary hosts sharing load 3:1, one fallback
_sip._tcp.example.com.  3600 IN SRV 10 60 5060 sip1.example.com.
_sip._tcp.example.com.  3600 IN SRV 10 20 5060 sip2.example.com.
_sip._tcp.example.com.  3600 IN SRV 20  0 5060 backup.example.com.
; target "." means the service is not available here
_ldap._tcp.example.com. 3600 IN SRV  0  0    0 .

RFC 2782 explains that a lone SRV record with target "." means the service is decidedly not available at that domain.

How do you add an SRV record in a DNS panel?

  1. 01

    Get the values from the service vendor

    Service name, protocol, priority, weight, port and target are vendor-specific. Providers that rely on SRV publish theirs in their setup guides.

  2. 02

    Enter the service and protocol

    Many panels have separate Service and Protocol fields and add the underscores for you. Others want the full name _service._proto in the Name field. Check the panel hint.

  3. 03

    Enter priority, weight, port and target

    Use a fully qualified target. Make sure the target host has an address record.

  4. 04

    Verify

    Run nslookup -type=SRV _sip._tcp.example.com 1.1.1.1 and confirm all four values.

What mistakes break SRV records?

Missing underscores

The service and protocol labels must start with an underscore, such as _sip._tcp. Without them clients never find the record.

CNAME as the target

RFC 2782 forbids an alias as the target. Point it at a name with A or AAAA records.

Wrong port

The port is part of the record. If the service moves to another port, the SRV record must change too.

No fallback

With one record and a dead host, clients have nowhere to go. Add a second record with a higher priority number.

How do you test an SRV record?

  • Query the full name, for example nslookup -type=SRV _sip._tcp.example.com
  • Confirm priority, weight, port and target match the vendor documentation
  • Resolve the target with nslookup to confirm it returns an A or AAAA record
  • Test the client application itself, since only SRV-aware clients use the record

Common questions

What is an SRV record used for?

An SRV record lets a client discover where a service runs, including host and port, without hard-coding them. Clients for protocols such as SIP and LDAP can use SRV lookups; RFC 2782 itself uses LDAP in its examples.

What is the difference between priority and weight in an SRV record?

Priority decides order: clients try the lowest number first and use higher numbers only as fallback. Weight splits traffic among targets that share a priority, so weight 60 and 20 give roughly a 3 to 1 split.

Can an SRV record point to a CNAME?

No. RFC 2782 requires the target to be a hostname with direct address records and says it must not be an alias. Point the SRV at a name that has A or AAAA records.

Do websites use SRV records?

Not for ordinary HTTP. Browsers use A, AAAA and CNAME records to find a website and always use the standard port from the URL. SRV only works with clients written to look it up.

Does an SRV record need a matching A record?

The target hostname in the SRV record needs its own A or AAAA record, because clients resolve it in a second step. The SRV record name itself, such as _sip._tcp.example.com, does not need an address record.

Watch your domains automatically

Aepto monitors expiry, DNS, SSL and uptime for every domain you own and alerts you when something changes. Free for 3 domains.