Bridge CDN
On this page

Quick facts

Record type SRV, RR type 33
Defined in RFC 2782
What it holds Priority, weight, port and target hostname
Owner name format _service._protocol.name, for example _sip._tcp.example.com
Target A hostname with its own A or AAAA record. Never a CNAME, never an IP
Supported in Bridge DNS Yes: hand-edited, imported by Cloudflare OAuth and zone file
Typical TTL Bridge Auto: 120 seconds

What is a SRV record used for?

Most answers in DNS say where a name lives. Service records go further. They say which machine runs a particular service, and on which port. The client never has to guess, and you never have to hard-code a port into an app.

You'll meet SRV in a handful of places:

  • VoIP and SIP. Phones look up _sip._udp or _sip._tcp to find the call server.
  • Chat over XMPP. Clients query _xmpp-client._tcp (usually port 5222). Servers query _xmpp-server._tcp (port 5269).
  • Game servers. Minecraft Java Edition checks _minecraft._tcp, so players can join play.example.com even when the server runs on a non-default port.
  • Mail client setup. Some Microsoft clients look up _autodiscover._tcp to find the Autodiscover endpoint.
  • Active Directory. Domain controllers publish _ldap._tcp and _kerberos._tcp SRV records. Those live in the internal AD zone, not usually in public DNS.

Web browsers are the big exception. They don't use SRV to find websites. For HTTP, the newer HTTPS and SVCB record types do that job.

SRV record format

Every entry follows the same layout from RFC 2782:

_service._proto.name.  TTL  IN  SRV  priority  weight  port  target.
_sip._tcp.example.com. 120  IN  SRV  10        60      5060  sip1.example.com.

Here's what each field does:

  • _service: the service name, with a leading underscore: _sip, _xmpp-client, _minecraft.
  • _proto: the transport, almost always _tcp or _udp. SIP over TLS uses _sips._tcp.
  • name: the domain the service belongs to.
  • priority: lower wins. Clients try the lowest priority first and fall back to higher numbers only if those fail.
  • weight: shares load between targets with the same priority. A target with weight 60 gets roughly three times the traffic of one with weight 20. Use 0 when there's only one target.
  • port: the TCP or UDP port the service listens on, from 0 to 65535.
  • target: the hostname of the server, ending with a dot in zone-file notation.

A target of a single dot (.) has a special meaning. It says the service is deliberately not offered at this domain, and clients should stop looking.

A DNS SRV record example with failover

Say example.com runs SIP on two servers. You want most calls on the first two hosts, split 75/25, and a third host only as a backup:

_sip._udp.example.com. 120 IN SRV 10 75 5060 sip1.example.com.
_sip._udp.example.com. 120 IN SRV 10 25 5060 sip2.example.com.
_sip._udp.example.com. 120 IN SRV 20  0 5060 sip-backup.example.net.
sip1.example.com.       60 IN A   203.0.113.21
sip2.example.com.       60 IN A   203.0.113.22

Clients pick between sip1 and sip2 by weight. They move to sip-backup only when neither priority-10 target answers. That's failover handled by the client, not by DNS. Bridge DNS returns the same SRV records to everyone. The clients do the choosing.

For a Minecraft server on port 25570:

_minecraft._tcp.example.com. 120 IN SRV 0 5 25570 mc.example.com.

How to add an SRV record in Bridge DNS

To create an SRV record:

  1. Open the zone and choose Add record, then pick SRV.
  2. Enter the name with the service and protocol labels, for example _sip._tcp. Bridge appends your domain.
  3. Fill in priority, weight and port.
  4. Enter the target hostname. Make sure that hostname already has an A or AAAA record.
  5. Keep TTL on Auto (120 seconds), or set your own.
  6. Save. Our nameservers serve the record within seconds.

Keep SRV targets DNS-only. The Bridge proxy handles HTTP and HTTPS. If the target's A record is proxied, SIP, XMPP or game traffic would arrive at the edge instead of your server. Leave the switch off on any hostname used as a target.

Moving from another provider? SRV records come across with the Cloudflare OAuth import and with a pasted zone file, so you rarely need to retype them.

How to check SRV records

Query the full owner name, underscores included:

dig _sip._tcp.example.com SRV +short
10 60 5060 sip1.example.com.

To see exactly what Bridge serves before or after a change, ask our nameserver directly:

dig @ns1.bb-ns.com _sip._tcp.example.com SRV

On Windows, a DNS SRV lookup with nslookup looks like this:

nslookup -type=SRV _sip._tcp.example.com

An empty answer usually means the name is wrong, not the record. The most common slip is a missing underscore or the wrong protocol label.

Common SRV mistakes

  • Pointing the target at a CNAME. RFC 2782 says the target must be a name with address records. Some clients follow the alias anyway, many don't.
  • Putting an IP address in the target. The field takes a hostname. An address there is invalid.
  • Forgetting the underscores. sip.tcp.example.com is a different name from _sip._tcp.example.com.
  • Swapping priority and weight. Priority picks the tier. Weight splits load inside a tier. Mixing them up sends all traffic to your backup.
  • No address record for the target. The SRV answer resolves, then the client fails on the next lookup.
  • Proxying the target hostname. Non-web traffic can't pass through the HTTP proxy.

SRV vs MX, A and HTTPS records

Record Gives the client Port included? Used by
SRV Host, port, priority, weight Yes SIP, XMPP, Minecraft, LDAP, Autodiscover
MX Mail host and priority No (SMTP is always 25) Mail servers
A / AAAA An IP address No Almost everything
HTTPS / SVCB Endpoint and protocol hints Optional Modern browsers

MX is the older, mail-only cousin of SRV: priority without weight or port. A and AAAA records answer "which address", nothing more. If you're publishing a website, SRV isn't the record you need.

Limits and edge cases

  • One owner name can hold many SRV records. Clients sort them by priority, then pick by weight.
  • SRV only works when the client software asks for it. A service that doesn't look up SRV records will ignore them completely.
  • Ports in SRV records don't open firewalls. The service must actually listen on that port.
  • Moving a service to a new host? Add the new target first and give it the same priority. Remove the old one only after its TTL has passed. Clients that cached the old answer will still find a working server.
  • Active Directory SRV records are usually managed by the domain controllers in internal DNS. Copying them into a public zone exposes internal hostnames for no benefit.

For other record types and how they fit together, go back to DNS record types and setup.

Questions about SRV in DNS

What is a SRV record?

It's a DNS record that points a named service, such as _sip._tcp, to a target host and port. It also carries a priority for failover and a weight for load sharing. It's defined in RFC 2782 as resource record type 33.

What are SRV records used for?

SRV records let clients find services without hard-coded hosts or ports. Common uses are SIP and VoIP, XMPP chat, Minecraft Java servers, Microsoft Autodiscover, and LDAP and Kerberos lookups inside Active Directory.

How to check SRV records?

Run dig _service._proto.example.com SRV, or nslookup -type=SRV _service._proto.example.com on Windows. To see the source answer, query the authoritative nameserver directly, for example dig @ns1.bb-ns.com.

How do I add an SRV record in DNS?

Create a record of type SRV with the name _service._proto. Then set priority, weight, port and a target hostname that has its own A or AAAA record. In Bridge DNS, the new record is live on our nameservers within seconds.

Can an SRV target be a CNAME?

It shouldn't. RFC 2782 requires the target to be a hostname with address records, not an alias. Point the SRV target at a name with an A or AAAA record.

Does Bridge DNS proxy SRV records?

No. The proxy switch exists only on A and AAAA records and carries HTTP and HTTPS traffic. Keep the hostnames your SRV records target DNS-only.