How to use your own domain for a Minecraft server with an SRV record

A Minecraft server address is usually a hostname plus a port number, which is hard to remember. Add an SRV record to your own domain and players connect with play.yourdomain.com. If you move hosts later, you only change DNS.

Updated 3 min read vProxy Cloud team

Top of the vPanel console: server address mc.example.com:25565 with a copy button, server ID and node, and CPU, memory, disk and network usage

A records and SRV records

How A records and SRV records differ for a Minecraft server
ComparedA or CNAME recordSRV record
Points toAn IP address (A) or a hostname (CNAME)A hostname and a port
Players typeplay.example.com:25566play.example.com
Java EditionWorksWorks
Bedrock EditionWorks, port entered separatelyNot supported

If the server uses the default port 25565, an A or CNAME record also lets players skip the port. Rented servers often use a different port, though, and that is where an SRV record comes in.

Java Edition looks up the SRV record first

  1. play.​example.​com Server address the player enters
  2. SRV lookup _minecraft.​_tcp.​play.​example.​com SRV record name
  3. Returns mc.​example.​com Target, port 25565, priority 0, weight 0

Then the target's IP

  1. mc.​example.​com SRV target
  2. A / CNAME lookup 203.0.113.10 IP of mc.example.com
  3. TCP 25565 203.0.113.10:​25565 Connects to the server

Bedrock Edition skips SRV

  1. play.​example.​com Address and port go in separate fields
  2. A / CNAME lookup 203.0.113.10 Uses the port the player entered
Players type only the domain, and the game gets the hostname and port from the SRV record.

Set up SRV in Cloudflare

  1. Find your server address

    It is at the top of the vPanel console and on the Network tab, for example mc.example.com:25565. The part before the colon is the hostname, and the number after it is the port.

  2. Open Cloudflare DNS

    In the Cloudflare dashboard, select your domain, go to DNS and then Records, click Add record, and set the type to SRV.

  3. Fill in the fields and save

    The subdomain in the name is up to you. With play, players connect to play.yourdomain.com.

Cloudflare SRV record fields for a Minecraft server
FieldWhat to enterExample
Type SRV SRV
Name _minecraft._tcp. followed by your subdomain _minecraft._tcp.play
Priority 0 0
Weight 0 0
Port The number after the colon in the server address 25565
Target The hostname before the colon in the server address mc.example.com
The port list on the vPanel Network tab, with mc.example.com:25565, the note “game connection” and the primary label
For the SRV record, enter mc.example.com as the target and 25565 as the port, the entry marked as primary on the Network tab. Screenshot from vPanel (Chinese interface). The menu in the top-right corner switches vPanel to English.

The SRV target must be a hostname, not an IP. A self-hosted server usually has only an IP, so add an A record first (for example mc.example.com pointing to your IP) with the proxy status set to DNS only, then use mc.example.com as the SRV target. Cloudflare's orange-cloud proxy cannot carry Minecraft traffic.

Test the connection

In Minecraft, open Multiplayer, add a server and enter only play.example.com as the address. If you can join, the record works.

If you can't get in, look up the SRV record from Command Prompt on Windows and check that the target and port in the result are right.

nslookup -type=SRV _minecraft._tcp.play.example.com

A record you just changed may not show up yet. Cloudflare usually takes 2 to 5 minutes, and other DNS providers can take a few hours.

Bedrock Edition

Bedrock servers do not support SRV records. Point play.yourdomain.com at the server's hostname with a CNAME record (or at the IP with an A record for a self-hosted server), and set the proxy status to DNS only as well. When players add the server, they enter play.yourdomain.com as the address and fill in the port separately.

References

FAQ

Do I have to use Cloudflare?
No. Most DNS providers support SRV records. The field names may differ. Some split Service, Protocol and Name into separate fields, in which case Service is _minecraft and Protocol is _tcp.
I set it up but still cannot connect. What now?
Check that the name starts with _minecraft._tcp., that the target is a hostname and not an IP, and that the port matches the server. If you only just made the change, wait for DNS to update and try again.
If I move to another host, do players need a new address?
No. Update the target and port in the SRV record, and players keep using the same domain.
Can I use the root domain, like example.com?
Yes. Enter only _minecraft._tcp as the name, with no subdomain, and players can connect with example.com.

Start a Minecraft server

Taiwan from NT$99/mo, Singapore from NT$120Billed every 30 days