SRV Records Explained
4 min read
## SRV Records Explained
An SRV Record (Service record) is a DNS record that points to a specific server and port for a given service and protocol. Unlike A or MX records that map hostnames to IP addresses, SRV records encode connection parameters — including port numbers — directly in DNS.
Applications use SRV records to discover where a service lives without hardcoding server addresses or ports into clients.
## Why SRV Records Exist
Standard DNS records answer "what IP address is `mail.example.com`?" but they cannot answer "what port does the XMPP service run on for `example.com`?" SRV records solve this by encoding service name, protocol, priority, weight, port, and target hostname into a single record.
This makes service discovery automatic: a SIP phone client, XMPP client, or game server can query DNS and learn exactly where and how to connect — no manual configuration needed.
## SRV Record Format
SRV records use a special naming convention:
```
_service._protocol.name TTL IN SRV priority weight port target
```
Example:
```
_xmpp-client._tcp.example.com. 3600 IN SRV 10 50 5222 chat.example.com.
```
Breaking this down:
| Field | Value | Meaning |
|-------|-------|---------|
| Name | `_xmpp-client._tcp.example.com` | Service + protocol + domain |
| Priority | `10` | Lower = preferred (like MX) |
| Weight | `50` | Load-balancing within same priority |
| Port | `5222` | TCP port to connect to |
| Target | `chat.example.com` | Hostname of the server |
### Service and Protocol Labels
The `_service` prefix uses standardized names from the IANA Service Name Registry. Common values:
| Service | Protocol | Meaning |
|---------|---------|---------|
| `_sip` | `_tcp` or `_udp` | VoIP/SIP |
| `_xmpp-client` | `_tcp` | XMPP client connections |
| `_xmpp-server` | `_tcp` | XMPP server-to-server |
| `_autodiscover` | `_tcp` | Outlook/Exchange autodiscover |
| `_imaps` | `_tcp` | IMAP over SSL |
| `_submission` | `_tcp` | SMTP email submission |
| `_minecraft` | `_tcp` | Minecraft Java Edition |
| `_stun` | `_udp` | STUN (VoIP NAT traversal) |
| `_turn` | `_tcp` | TURN (media relay) |
## Priority and Weight
**Priority** works identically to MX record priority: lower number = higher preference. Clients try the lowest-priority SRV target first.
**Weight** is used for load distribution among records with the *same* priority. Clients pick targets proportionally by weight:
```
_sip._tcp.example.com. SRV 10 70 5060 sip1.example.com.
_sip._tcp.example.com. SRV 10 30 5060 sip2.example.com.
```
Here both have priority 10. `sip1` gets ~70% of connections, `sip2` gets ~30%. This is weighted round-robin load balancing via DNS.
If all SRV records in a priority group are unreachable, clients fall back to the next priority group.
## Microsoft 365 / Skype for Business SRV Records
Microsoft 365 requires SRV records for Skype for Business and Teams autodiscover:
```
_sip._tls.example.com. SRV 100 1 443 sipdir.online.lync.com.
_sipfederationtls._tcp.example.com. SRV 100 1 5061 sipfed.online.lync.com.
```
These values are provided in the Microsoft 365 admin center under Domains and must be added exactly as shown.
## Autodiscover for Outlook (Exchange)
Exchange and Office 365 use both CNAME and SRV records for autodiscover:
```
; Preferred: CNAME approach
autodiscover.example.com. CNAME autodiscover.outlook.com.
; Fallback: SRV approach
_autodiscover._tcp.example.com. SRV 10 10 443 autodiscover.outlook.com.
```
Outlook clients first try the CNAME; if that fails, they fall back to the SRV record.
## Minecraft Java Edition
Minecraft servers can use SRV records so players connect using a clean domain name without specifying a port:
```
_minecraft._tcp.play.example.com. SRV 0 5 25565 mc.example.com.
```
Players connect to `play.example.com` and the Minecraft client resolves the SRV record to find the actual server and port. Without SRV, players would need to type `mc.example.com:25565`.
## XMPP / Jabber
```
_xmpp-client._tcp.example.com. SRV 5 0 5222 xmpp.example.com.
_xmpp-server._tcp.example.com. SRV 5 0 5269 xmpp.example.com.
```
Two records are needed: one for client connections (port 5222) and one for server-to-server federation (port 5269).
## SIP / VoIP
```
_sip._udp.example.com. SRV 10 10 5060 sip.example.com.
_sip._tcp.example.com. SRV 10 10 5060 sip.example.com.
_sips._tcp.example.com. SRV 10 10 5061 sip.example.com.
```
Both UDP and TCP variants are common. `_sips` uses TLS (port 5061).
## The Target Hostname Must Have an A Record
Like MX records, SRV targets must be hostnames that resolve to IP addresses — not IP addresses directly. Always ensure `chat.example.com`, `sip.example.com`, or whatever hostname you use has a corresponding A Record.
## Disabling a Service
A SRV record with a period (`.`) as the target and `0` for port signals that the service is explicitly not available:
```
_sip._tcp.example.com. SRV 0 0 0 .
```
This prevents clients from searching further or timing out — they immediately know the service is unsupported.
## Verifying SRV Records
```bash
dig _xmpp-client._tcp.example.com SRV
dig _sip._tcp.example.com SRV
```
Use the DNS Record Helper tool to verify SRV records are visible globally and contain the correct port and target values.
## Next Steps
- Setting Up DNS for Your Domain — full DNS configuration walkthrough
- A Record vs CNAME: When to Use Each — how to handle the A records that SRV targets point to
- MX Records: Setting Up Email for Your Domain — email routing, conceptually similar to SRV priority/weight