How to Set Up an A or SRV Record for a Game Server
This guide walks you through pointing a custom domain (like play.example.com) at your game server using either an A record or an SRV record. An A record maps a hostname directly to the server’s IPv4 address, while an SRV record lets you specify the port and protocol, which is handy for games that don’t use the default port. You’ll need access to your domain’s DNS settings (usually through your domain registrar or hosting provider) and the public IP address and port of your game server.
What You’ll Need
- Domain name registered with a DNS provider that allows you to manage records (e.g., Namecheap, GoDaddy, Cloudflare, Route53).
- The public IPv4 address of your game server. If it’s behind a router, you must set up port forwarding to the server’s local IP.
- The port number your game server listens on (e.g., 25565 for Minecraft, 7777 for ARK).
- If using SRV, know the protocol prefix your game uses (e.g.,
_minecraft,_ark).
Step-by-Step
- Log in to your DNS provider’s control panel. This is the same place you manage your domain’s nameservers. Common providers include Cloudflare, Namecheap, GoDaddy, and Google Domains.
- Navigate to the DNS management page. Look for a tab or menu labeled “DNS,” “DNS Management,” “Advanced DNS,” or “Zone Editor.”
- Choose the domain you want to use. If you have multiple domains, select the one that will host the game server record.
- Add an A record (if you want a simple hostname).
- Click “Add Record” or “Add New Record.”
- Set the type to A.
- In the “Name” or “Host” field, enter the subdomain you want (e.g.,
playormc). Leave it blank or enter@if you want the root domain itself. - In the “Value” or “IP Address” field, enter your game server’s public IPv4 address (e.g.,
203.0.113.10). - Set TTL (Time to Live) to a low value like 300 seconds (5 minutes) during testing; you can increase it later.
- Save the record.
- Add an SRV record (if you need to specify a port).
- Click “Add Record” again.
- Set the type to SRV.
- In the “Name” field, enter the service and protocol in the format
_service._protocol. For example, for Minecraft Java Edition, use_minecraft._tcp. For ARK, it’s_ark._tcp(check your game’s documentation). - Enter the TTL (e.g., 300).
- In the “Priority” field, enter
0(or the lowest number if you have multiple SRV records). - In the “Weight” field, enter
0(used for load balancing; not needed for a single server). - In the “Port” field, enter the actual port your game server runs on (e.g.,
25565). - In the “Target” field, enter the hostname that resolves to your server’s IP. This is usually the A record you just created (e.g.,
play.example.com). Make sure it ends with a dot (e.g.,play.example.com.) in some DNS providers, but most accept it without. - Save the record.
- Wait for DNS propagation. Changes can take anywhere from a few minutes to 48 hours, though usually it’s under an hour. You can check using a tool like
nslookupor an online DNS checker. - Test the connection. In your game’s client, enter the domain (e.g.,
play.example.com) instead of the IP. If you used an SRV record, the game should automatically use the port you specified.
Common Mistakes
- Using the wrong IP address. Make sure it’s your public IP, not your local IP (like 192.168.x.x). You can find your public IP by searching “what is my IP” in a web browser.
- Forgetting to forward ports. If your server is behind a router, you must forward the game’s port (and sometimes the port+1 for some games) to the server’s local IP. Without this, external connections will fail.
- SRV target pointing to another SRV record. The target must be a hostname that resolves via an A or AAAA record, not another SRV.
- Missing the dot at the end of the target. Some DNS providers require a trailing dot (e.g.,
play.example.com.) to indicate it’s a fully qualified domain name. If you omit it, the provider may append your domain again, resulting inplay.example.com.example.com. - Using uppercase in SRV service name. Service names are case-sensitive and should be lowercase (e.g.,
_minecraft). - Setting TTL too high. If you need to change the IP later, a high TTL (like 86400) will cause clients to cache the old IP for a full day.
Tips
- Use a low TTL (300) during setup. This allows you to make changes and have them take effect quickly. Once everything works, you can raise it to 3600 or more.
- Create an A record first, then the SRV record. This ensures the target hostname exists before you reference it.
- If you have a dynamic IP, consider a dynamic DNS service. Many providers (like DuckDNS or No-IP) offer a hostname that updates automatically when your IP changes. Then you can point your A record to that hostname (via a CNAME) or use it directly.
- Document your server’s IP and port. Keep them in a safe place; you’ll need them when troubleshooting.
- For IPv6, use an AAAA record. If your server is reachable via IPv6, add an AAAA record with the IPv6 address. Some games still require IPv4, so check compatibility.
Troubleshooting
- Domain doesn’t resolve. Use
nslookup play.example.comordig play.example.comin a terminal. If it returns no answer, your A record is missing or incorrect. Check the spelling and IP. - SRV record not working. Test with
nslookup -type=SRV _minecraft._tcp.example.com. If it returns nothing, the record may be misconfigured. Verify the service name, protocol, and target. - Connection times out. This usually means the IP is reachable but the port is closed. Check your firewall and port forwarding. Try connecting directly to the IP:port to isolate the issue.
- Game says “Can’t resolve hostname.” The game may not support SRV records. In that case, you must use an A record and tell players to include the port manually (e.g.,
play.example.com:25565). - Changes not showing after 24 hours. Clear your DNS cache (on Windows:
ipconfig /flushdns; on macOS:sudo killall -HUP mDNSResponder). Also try a different network (e.g., mobile data) to rule out local caching.
Frequently Asked Questions
Do I need both an A record and an SRV record?
Not necessarily. An A record alone is enough if players can manually enter the port. An SRV record is only needed when you want players to use just the domain without specifying a port, and the game supports SRV lookups.
Can I use a CNAME instead of an A record?
Yes, if you have a dynamic DNS hostname or want to point to another domain. However, some DNS providers don’t allow CNAMEs on the root domain, and the target must be a hostname, not an IP.
What if my game server uses a non-standard port?
That’s exactly what SRV records are for. You specify the port in the SRV record, and clients that support SRV will use it automatically. Otherwise, players must type the port manually.
How long does DNS propagation take?
Typically under an hour, but it can take up to 48 hours in rare cases. Lower TTL values help speed up the process for those who already have the old record cached.
My server is on a dynamic IP. What should I do?
Use a dynamic DNS service that gives you a fixed hostname. Then create a CNAME record pointing your game subdomain to that hostname, or use the dynamic hostname directly. Some routers can update the dynamic DNS automatically.
Can I set up an SRV record for any game?
Only if the game client supports SRV lookups. Many popular games like Minecraft (Java Edition), ARK, and Factorio do. Others, especially older games, may not. Check your game’s documentation or community forums.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.