An SRV (Service) record is a DNS record that defines the location of services on a domain, such as SIP (Session Initiation Protocol), XMPP (Extensible Messaging and Presence Protocol), or game servers. Unlike other DNS records like A records (which map domain names to IP addresses), SRV records help identify a service’s hostname, port, and priority on a domain, allowing different services to be hosted on separate servers.
An SRV record has the following components:
- Service: The name of the service (e.g., _sip for SIP or _xmpp for XMPP).
- Protocol: Either TCP (Transmission Control Protocol) or UDP (User Datagram Protocol), which defines the protocol used by the service.
- Priority: Similar to MX records, the priority dictates which server should be used first when multiple are available (lower numbers represent higher priority).
- Weight: Specifies the relative weight for records with the same priority. It helps in load balancing, where a higher weight means more traffic should be directed to that server.
- Port: The port number through which the service is accessible (e.g., 5060 for SIP).
- Target: The hostname of the server providing the service (e.g., server.example.com).
For instance, an SRV record might be used to define that a particular service (e.g., SIP) should be resolved to a specific hostname on a particular port, while also specifying which server should be tried first (via priority).
Why You Might Use an SRV Record
- VoIP (Voice over IP): SRV records are frequently used to direct voice traffic for services like SIP to the correct server.
- XMPP/Jabber: To direct instant messaging traffic via XMPP servers.
- Load Balancing: Distribute network traffic across multiple servers with the same priority and weight.
- Game Servers: To resolve different game servers to different addresses or ports.
How To Create An SRV Record On cPanel?
If you’re hosting your website or services with cPanel, you can easily create an SRV record to help route traffic to specific services on your domain.
Follow these steps to create an SRV record in cPanel:
Step-1 Log into cPanel
Access your cPanel control panel using your login credentials. Typically, the URL is yourdomain.com/cpanel
.
Step-2 Go to the Zone Editor
Find and click on Zone Editor in the Domains section of the cPanel dashboard. This is where you manage DNS records for your domain.
Step-3 Select the Domain
Once you’re in the Zone Editor, you’ll see a list of your domains. Find the domain where you want to create the SRV record and click Manage.
Step-4 Add SRV Record
In the Manage section, click on + Add Record (usually near the top of the page). From the dropdown, select SRV Record.
Step-5 Fill in the SRV Record Details:
- Service: Enter the name of the service, starting with an underscore (e.g., _sip or _xmpp).
- Protocol: Enter the protocol, also with an underscore (e.g., _tcp or _udp).
- Priority: Choose a priority number (e.g., 1 for the highest priority).
- Weight: If you want load balancing between multiple servers, set a weight (e.g., 5). If you’re not load balancing, you can set this to 0.
- Port: Enter the port number on which the service is hosted (e.g., 5060 for SIP).
- Target: Enter the hostname of the server (e.g., sip.example.com) where the service is running.
Step-6 Set the Time-to-Live (TTL)
TTL determines how long the SRV record is cached. The default value is usually fine, but you can set it lower (e.g., 300 seconds) if you want updates to propagate quickly.
Step-7 Save the Record
Once you’ve filled in all the necessary details, click Save or Add Record to finalize the creation of your SRV record.
Step-8 Test Your SRV Record
After adding the SRV record, it may take a few minutes to propagate. You can test it using tools like DNS lookup services or the command line (e.g., nslookup
for Windows or dig
Linux/Mac).
Depending on the service you’re configuring (e.g., SIP server or XMPP), you may need to update the client or server settings to start using the new SRV record.
Finally, ensure the SRV record works correctly by monitoring the service traffic to the specified target and port. Double-check the values (especially protocol, port, and target) if there are issues.
This way, you can efficiently create an SRV record for your domain in cPanel, ensuring your services are properly routed and functioning smoothly.