Connecting a domain to a Minecraft server
Set up A and SRV records at any DNS provider so players join your server by domain, without an IP address or port.
With your own domain, players add the server as play.myserver.com instead of an IP address with a port. You connect the domain where you manage its DNS, so these steps work the same at any registrar and in Cloudflare.
If you don't have a domain, you can use a free .hsrv.pl subdomain that you create in the client panel. The Connecting to the server section shows how.
The client panel is available in Polish only, so this article gives its labels in Polish with a translation the first time they appear.
Before you start
- A domain bought from any registrar.
- Access to the domain's DNS management. It's usually the registrar's panel, or the Cloudflare dashboard if the domain uses Cloudflare name servers.
- The server's IP address and port from the Przegląd (Overview) tab, in the Adres IP (IP address) field, such as
203.0.113.10:25570.
Which records you need
Players reach the server through two DNS records:
- The A record turns the name
play.myserver.cominto the server's IP address. - The SRV record tells the game the port. Without it, Minecraft connects to the default port
25565, and a Hostero server usually has a different one, so players would have to add the port to the address.
The SRV record only works in Minecraft Java Edition. Bedrock Edition players enter the domain in the address field and the port in a separate field.
Records for your server
Enter your domain and the address from the panel. The tool shows the values to copy into your DNS provider's form.
The domain you bought from a registrar, without http:// or www.
Leave it empty for players to join on the bare domain.
From the client panel. You can paste the address with its port.
The server's port from the client panel.
Adding the records
Open the domain's DNS zone
Log in to your DNS provider and open the domain's settings. The section with records is usually called DNS Zone, DNS Records or DNS Management. If the zone already has an A or CNAME record with the same name, change or delete it.
Add the A record
Choose the A type. In the name field, enter the subdomain, such as
play, and in the value field, the server's IP address without the port. Leave the TTL at its default. If the provider shows a proxy switch next to the record, such as the orange cloud in Cloudflare, turn it off so the record is set to DNS only.Add the SRV record
Choose the SRV type and copy the values from the tool above. In the name field, enter
_minecraft._tcp.play, and in the target field, the name from the A record, such asplay.myserver.com, not the IP address. If the form has separate Service and Protocol fields, enter_minecraftandTCPin them, and justplayin the name field.Save the changes
New records usually start working within a few minutes. Sometimes it takes up to a few hours, because DNS servers remember old answers for as long as the TTL says.
SRV record forms name their fields differently at each provider, but they ask for the same data:
| Field | Value |
|---|---|
| Name, Host | _minecraft._tcp.play or _minecraft._tcp.play.myserver.com |
| Priority | 0 |
| Weight | 5 |
| Port | the server's port from the panel |
| Target, Value | play.myserver.com |
Some providers add the domain to the name themselves. If after saving you see the name _minecraft._tcp.play.myserver.com.myserver.com, enter only _minecraft._tcp.play in the name field.
Domain without a subdomain
Players can also join on the bare domain, such as myserver.com. Don't change the domain's A record (@) for this: it leads to your website and email, so if you set it to the game server's address, the website stops working.
Instead, add an A record for a subdomain, such as play, as in the steps above, and an SRV record named _minecraft._tcp (or @ in the name field if the form has separate service and protocol fields) with the target play.myserver.com. The game uses the SRV record to reach the server, and the website keeps working.
Only set the @ A record if there's no website on the domain and you don't plan to add one.
Checking
In the game, click Multiplayer → Add Server and enter just the domain, such as play.myserver.com, without the port. If the server shows up in the list with its description and player count, the records work.
You can also check the records with nslookup in a terminal or the Windows command prompt:
nslookup play.myserver.com
nslookup -type=SRV _minecraft._tcp.play.myserver.comThe first command should show the server's IP address, and the second the port and target from the SRV record.
Common problems
Can't resolve hostname
The game didn't find the domain. The records may not work yet, so wait a few minutes. Then check
with nslookup that the A record exists and that the name doesn't have the domain twice, such
as play.myserver.com.myserver.com.
The server works with the port in the address, but not without it
The A record works, but the game doesn't see the SRV record. Check that the name starts with
_minecraft._tcp, that the port matches the panel and that the target is a domain name, not an
IP address.
Connection timed out with records set up in Cloudflare
The A record has the proxy on (orange cloud). The Cloudflare proxy only passes website traffic, so the game connects to a Cloudflare server instead of yours. Click the cloud next to the A record to change it to DNS only.
Players still reach the old server after an IP change
Players' computers remember the old DNS answer for as long as the TTL says. Wait for it to pass, or ask players to restart the game.