# SRV record

An SRV (service) record tells software which host and port run a particular service for a domain, with priorities and weights for backups and load sharing. Calendar and contacts apps, SIP phones, XMPP chat, Minecraft, Microsoft Teams and email client autoconfiguration all use SRV records.

- Record type: SRV
- Type number: 33
- Used for: Services
- How common: Common
- Defined in: RFC 2782

## Format

```
_<service>._<protocol>.<name> <ttl> IN SRV <priority> <weight> <port> <target>
```

| Field | What it means | Accepted values |
| --- | --- | --- |
| Service and protocol | The name says which service and transport this is for. | `_sip._tcp`, `_imaps._tcp`, `_minecraft._tcp`, `_xmpp-client._tcp`. |
| Priority | Lower is tried first, as with MX. | 0 to 65535. |
| Weight | Among targets with the same priority, the share of traffic each gets. | 0 to 65535. 0 means no preference. |
| Port | The port the service listens on. | 0 to 65535. |
| Target | The host running the service. `.` means not available here. | A host name with an A or AAAA record, not a CNAME. |

## Examples

### Microsoft Teams (SIP)

```
_sip._tls 3600 IN SRV 100 1 443 sipdir.online.lync.com.
```

One of the records Microsoft 365 asks for.

### Minecraft server on a custom port

```
_minecraft._tcp.play 3600 IN SRV 0 5 25566 mc.example.com.
```

Players type play.example.com and the game finds port 25566.

### Two servers sharing load

```
_xmpp-client._tcp 3600 IN SRV 10 60 5222 a.example.com.
_xmpp-client._tcp 3600 IN SRV 10 40 5222 b.example.com.
```

Same priority, so roughly 60% of clients go to a and 40% to b.

### Service not offered

```
_imap._tcp 3600 IN SRV 0 0 0 .
```

Clients shouldn't try plain IMAP here.

## TTL

3600.

## Common mistakes

- Leaving out the underscores or the protocol label: it's _sip._tcp, not sip.
- Pointing the target at a CNAME or an IP address.
- Some dashboards have separate Service, Protocol and Name fields; filling the whole name into Name as well gives _sip._tcp._sip._tcp.

## At your DNS host

- Cloudflare: separate fields for service, protocol, name, priority, weight, port and target.
- Route 53: one value: 10 60 5060 sip.example.com.
- GoDaddy: Service and Protocol fields take the underscore names, such as _sip and _tcp.

## Questions

### What's the difference between priority and weight?

Priority picks which group of servers is used first (lowest wins). Weight shares traffic within that group.

### Do browsers use SRV records?

No. Websites use A, AAAA and HTTPS records. SRV is for other protocols.

## Related

- [URI record](https://lemon.domains/dns-records/uri.md)
- [NAPTR record](https://lemon.domains/dns-records/naptr.md)
- [SVCB record](https://lemon.domains/dns-records/svcb.md)
- [MX record](https://lemon.domains/dns-records/mx.md)

Interactive version with a record checker and live lookup: https://lemon.domains/dns-records/srv
