How to Set Up a Minecraft SRV Record (Hide the Port)
If your server runs on a port other than 25565, players have to type something like 203.0.113.10:25570. An SRV record lets them type play.example.com instead, and Minecraft Java Edition finds the port by itself. It takes two DNS records and a few minutes.
What an SRV record does
Since Java Edition 1.3.1, the game looks up a DNS record called _minecraft._tcp in front of the address a player types. For play.example.com it asks for _minecraft._tcp.play.example.com. If that record exists, it holds a target host and a port, and the game connects there. If it does not exist, the game connects to play.example.com on port 25565, so a server on the default port does not need one.
An SRV record changes what players type, not what is reachable. It does not hide your IP address: anyone can look up the target host. It only hides the port.
What you need first
- A domain whose DNS you can edit, at your registrar or a DNS provider such as Cloudflare.
- The address and port your server really runs on. On a rented server host this is shown in the panel, for example node3.host.net:25570. On a home server it is your public IP and the port set in server.properties.
- A hostname for that address. The SRV target must be a name with an A or AAAA record, not a raw IP and not a CNAME. If your host gives you a hostname such as node3.host.net, you can use it directly. If you only have an IP, create an A record for it first.
Step 1: the A record
Skip this if your host gave you a hostname. Otherwise create an A record (AAAA for IPv6) with the name mc and your server's IP as the value, so mc.example.com points to the machine. Do not put the port in it: A records hold only an address.
On Cloudflare, set this record to DNS only (grey cloud). The orange-cloud proxy is built for web traffic, and Cloudflare recommends DNS only for records that serve non-HTTP services. Minecraft is not web traffic.
Step 2: the SRV record
Create a new record of type SRV. Most DNS panels split it into fields:
- Service: _minecraft
- Protocol: _tcp (TCP)
- Name: the part players type before your domain, for example play. Use @ to let players join with example.com itself.
- Priority: 0
- Weight: 5
- Port: the real server port, for example 25570
- Target: mc.example.com, or the hostname your host gave you
The finished record is named _minecraft._tcp.play.example.com. If your panel has only one Name field, type _minecraft._tcp.play there. Some panels add the domain for you, so check that it does not end up as _minecraft._tcp.play.example.com.example.com.
Step 3: test it
Enter play.example.com in the SRV record lookup. It shows the target and port Minecraft will use, and the address that target resolves to. Then check the server itself with the status checker.
From a terminal you can run nslookup -q=srv _minecraft._tcp.play.example.com on Windows or dig _minecraft._tcp.play.example.com srv on macOS and Linux. New records usually appear within minutes, but the Minecraft Wiki notes that DNS changes can take up to a day.
Mistakes that break it
- An IP address in the Target field. The target must be a hostname.
- A CNAME as the target. RFC 2782 says the target must not be an alias.
- The target record set to proxied (orange cloud) on Cloudflare.
- The wrong port: the SRV port must match server-port in server.properties, or the port your host assigned.
- Testing too soon, or with a cached result. Wait a few minutes and try again.
- Expecting it to work on Bedrock. See below.
Bedrock Edition
The SRV setup above is for Java Edition. The Bedrock client has its own port field, and Mojang does not document SRV lookups for it, so give Bedrock players the address and the port (19132 by default) separately. The Bedrock status checker confirms the server answers on that port.
Frequently asked questions
Do I need an SRV record on port 25565?
No. Without an SRV record, Java Edition connects to the address on 25565 anyway.
Does an SRV record hide my server IP?
No. The target host is public and anyone can look up its address. An SRV record only removes the port from what players type.
What do priority and weight do?
With several SRV records, clients try the lowest priority first, and among records with the same priority a higher weight is chosen more often. With one server, use priority 0 and any weight.
Can I use SRV for several servers on one domain?
Yes. Give each server its own name, such as _minecraft._tcp.survival and _minecraft._tcp.creative, each pointing to its own port.