Module 5 · 5.1
SRV records
Module 5: Other records · Reading time: 6 minutes
Learning objective: After this lesson, you'll be able to read an SRV record and fill in the fields correctly.
Key concepts: SRV, name structure _service._proto, priority, weight, port, target
What's an SRV record for?
An A record tells you where a name lives. An MX record tells you where mail for a domain should go. But how does a programme for telephony, chat or calendars know on which server and which port the service for your domain runs? That's what the SRV record (from service) is for, described in RFC 2782.
You'll mainly come across SRV records with:
- business telephony and chat (SIP, and older setups of Microsoft Teams and Skype for Business with
_sip._tlsand_sipfederationtls._tcp), - email programmes that automatically look for settings (
_imaps._tcp,_submission._tcp,_autodiscover._tcp), - calendars and contacts (
_caldavs._tcp,_carddavs._tcp), - game servers such as Minecraft (
_minecraft._tcp).
Usually you'll get the exact values from the service. You don't need to work them out yourself, but you do need to copy them correctly.
What an SRV record looks like
_sip._tls.example.com. 3600 IN SRV 100 1 443 sipdir.provider.example.The name consists of three parts:
| Part | Meaning |
|---|---|
_sip | the service, always with an underscore in front |
_tls | the protocol: usually _tcp or _udp, sometimes _tls |
example.com. | your domain |
The value consists of four parts, always in this order:
| Field | Example | Meaning |
|---|---|---|
| Priority | 100 | Which server goes first. Just like with MX: the lowest number first. |
| Weight | 1 | Distribution between servers with the same priority. A higher weight gets proportionally more traffic. |
| Port | 443 | Which port the service runs on. |
| Target | sipdir.provider.example. | The name of the server, with a dot at the end. |
The target must be a name with its own A or AAAA record, not an IP address, and according to the standard, not a CNAME either. A target of just a dot (.) means: "this service is explicitly unavailable here".
Multiple servers
Just as with MX, you can create multiple SRV records for the same service:
_imaps._tcp.example.com. 3600 IN SRV 10 60 993 imap1.example.com.
_imaps._tcp.example.com. 3600 IN SRV 10 40 993 imap2.example.com.
_imaps._tcp.example.com. 3600 IN SRV 20 0 993 reserve.example.com.Read this as: try the two servers with priority 10 first, where imap1 gets roughly 60% of connections and imap2 gets 40%. If neither is reachable, try reserve.
How control panels show the fields
The SRV record is the record where control panels differ most from each other. Some panels have separate fields for service, protocol, priority, weight, port and target. Others have a single name field and a single value field. Three things often go wrong:
- The domain name appearing twice in the name. If you enter
_sip._tls.example.comas the name, while the panel adds your domain name itself afterwards, you end up with_sip._tls.example.com.example.com. In that case, only enter_sip._tls. - Forgetting the underscores.
sip.tlsis a regular subdomain name and won't be found by any programme. - The fields in the wrong order in a value field. The order is always priority, weight, port, target.
After saving, always check with a lookup tool (lesson 8.2) that the record is listed under exactly the right name.
In practice: what it looks like in a control panel
As an example, we'll use the DNS screen in My WebOké, which has a help window for SRV records. In DirectAdmin, cPanel, Cloudflare and most registrars, you fill in the same six pieces of information, sometimes on a single line.
- Click Add Record and choose SRV.
- Enter the service (
_sip) and choose the protocol (_tls). - Enter the priority, weight and port as specified by the service.
- For the target, enter the server name, with a dot at the end.
- Save.
Summary
- An SRV record tells you where and on which port a particular service for your domain runs.
- The name is
_service._proto.name, with underscores. - The value is always: priority, weight, port, target.
- Lowest priority first; with equal priority, the weight distributes the traffic.
- Copy the values from the service exactly, and check that the name hasn't been duplicated.
Quiz
Exercise
Exercise Z5.1: Looking up an SRV record. Gmail publishes an SRV record that lets email programmes find the IMAP server. Look up the SRV record for _imaps._tcp.gmail.com and fill in the port and target.
Exercise O5.1: Setting it up yourself in your practice zone. Create two records in your practice zone:
- an A record
sipwith the value192.0.2.50(the "server" for the service); - an SRV record for the service
_sip, protocol_tls, with priority100, weight1, port443and targetsip.(your own practice zone, with the dot at the end).<code>.dnspractice.eu.
In the practice zone, the SRV record points to a fake server in your own zone; for your real domain, enter the target that the real service specifies. Then click Check.
Exercise O5.1
You'll do this exercise in your own practice zone: a real DNS zone on WebOké's nameservers, just for you. Sign up with your email address. You'll get a login link by email and then come back to this lesson. We only use your address for the course.
Further reading
This article describes the steps in the WebOké panel; it works similarly in other panels.
