🌐 SRV Record Generator – Build RFC 2782 DNS Service Records
DNS SRV (Service) records are a powerful mechanism defined in RFC 2782 that let clients discover the host and port for a specific network service automatically — without hardcoding server addresses. They are the backbone of VoIP dial plans (SIP), instant messaging federation (XMPP), enterprise directory services (LDAP), Kerberos authentication, Minecraft multiplayer, CalDAV calendaring, and dozens of other protocols. This generator assembles perfectly formatted SRV records, complete with the correct underscore prefixes and trailing dots, so you can paste them directly into a BIND zone file or DNS control panel.
📐 SRV Record Anatomy
Every SRV record follows the zone-file format defined in RFC 2782:
_service._protocol.domain. TTL IN SRV priority weight port target.For example, a SIP server record looks like:
_sip._tcp.example.com. 3600 IN SRV 10 20 5060 sipserver.example.com.| Field | Example | Purpose |
|---|---|---|
| _service | _sip | Service symbolic name with underscore prefix |
| _protocol | _tcp | Transport protocol (TCP, UDP, TLS, SCTP) |
| domain. | example.com. | Zone name with trailing dot (FQDN) |
| TTL | 3600 | Cache lifetime in seconds (3600 = 1 hour) |
| IN SRV | IN SRV | Internet class, Service record type |
| priority | 10 | Lower = higher preference; try smallest first |
| weight | 20 | Load share among same-priority targets |
| port | 5060 | TCP/UDP port where service listens |
| target. | sipserver.example.com. | FQDN of the target server |
⚖️ Priority and Weight – How Client Selection Works
Priority determines which server group clients try first. Clients must attempt all servers with the lowest priority value before falling back to higher priority values. A primary server with priority 10 is always tried before a failover server with priority 20.
Weight controls load distribution within a priority tier. Clients use weighted random selection so that a server with weight 60 receives approximately 60% of connections while a sibling at weight 40 handles the remaining 40%. Setting weight to 0 signals that this server should only receive connections when all higher-weight peers are unavailable.
📊 Traffic share formula
Traffic % = (server weight / sum of weights at same priority) × 100🔁 Failover Configuration
Configuring failover with SRV records is straightforward — assign your primary servers priority 10 and backup servers priority 20. RFC 2782-compliant clients will never contact the priority-20 servers unless all priority-10 entries are unreachable. This multi-priority approach is used by enterprise LDAP, SIP trunks, and Kerberos KDC discovery.
🏷️ Zone File vs. Registrar Format
When entering records directly into a DNS server's zone file (BIND, PowerDNS, NSD), use zone file format: the record name includes the full domain with a trailing dot, and the target is also a fully qualified domain with a trailing dot. The trailing dot tells the DNS server the name is absolute and should not have the zone name appended.
Most DNS registrar control panels and cloud DNS consoles (Cloudflare, Route 53, Namecheap) handle trailing dots for you. Switch to registrar format in the generator to produce shortened record names like _sip._tcp instead of _sip._tcp.example.com.
⏱️ Choosing the Right TTL
TTL (Time To Live) controls how long resolvers cache your SRV record. A low TTL (e.g., 300 = 5 minutes) enables quick DNS changes during migrations or incident response but increases query load on your authoritative name servers. A high TTL (e.g., 86400 = 24 hours) reduces query volume but means changes propagate slowly. For active services, 3600 (1 hour) is a common balance.
🌍 Common SRV Use Cases
| Protocol | SRV Name | Default Port | Use Case |
|---|---|---|---|
| SIP (VoIP) | _sip._tcp / _sip._udp | 5060 | Voice & video calls |
| SIP Secure | _sips._tcp | 5061 | Encrypted VoIP over TLS |
| XMPP Client | _xmpp-client._tcp | 5222 | Chat client connections |
| XMPP Server | _xmpp-server._tcp | 5269 | XMPP server federation |
| LDAP | _ldap._tcp | 389 | Directory service queries |
| LDAPS | _ldaps._tcp | 636 | Secure LDAP |
| Kerberos | _kerberos._tcp/_udp | 88 | Authentication tickets |
| Minecraft | _minecraft._tcp | 25565 | Game server discovery |
| CalDAV | _caldav._tcp | 8443 | Calendar sync |
✅ Validation Tips
The generator warns you about common misconfigurations in real time. Key rules to keep in mind:
- Service name — alphanumeric characters and hyphens only; no leading or trailing hyphens; the underscore prefix is added automatically.
- Target host — must be a valid FQDN. The tool appends a trailing dot in zone file mode. Do not set the target to the bare domain root
.unless you intentionally want to disable the service (RFC 2782 null target). - Port range — must be between
1and65535. Port0is not valid for SRV. - TTL — a value below 60 seconds is technically valid but operationally unusual and will trigger a warning.
🛠️ Tips for Network Admins
- Use the well-known service template buttons to auto-populate the correct service name, protocol, and default port for common protocols — then only fill in your domain and target host.
- For load balancing across multiple data centers, add targets with the same priority but different weights that reflect your server capacities.
- For a hot standby, set your standby server to priority
20with weight100— it receives no traffic until all priority-10 targets fail. - Always test your SRV records after publishing with
dig:dig SRV _sip._tcp.example.com