Setting Up Minecraft SRV Records on Cloudflare: Connect via your domain name

Background:

SRV Records can be used to allow people to connect nicely to your minecraft server by simply entering your website name. SRV records can also be used to make players connect on alternative ports, instead of the default 25565, without having to input it. Below is a guide on how you can setup a SRV record so players can connect by entering your domain name.

Prerequisites
  • If you want people worldwide to be able to connect, your server must be on a Public IP Address. If you’re paying a host, they should just give you the IP. If you’re self-hosting at home, this usually means port forwarding. If your IP is 192.168.x.x or 10.x.x.x, this is a Private IP and only you will be able to connect. If you don’t know how to port forward or get your IP, there is plenty of tutorials for minecraft online.

  • This is only for Java. Only Java Edition follows SRV Records. For Bedrock edition, you need to point an unproxied A record at your server, on a subdomain with no other records.

  • Have an active and setup website in Cloudflare. Transfer your website to Cloudflare today, or use the Cloudflare Registrar to register a new domain.

  • I will be using example.com in place of your real domain. Anytime this used, please replace it with your own domain.


Guide:

  1. Navigate to your website in Cloudflare, and then to DNS → Records. Magic link.
    image

  2. Add an unproxied :grey: A Record pointing to the minecraft server, on a subdomain you aren’t using. For example, play, or mc. In the IPv4 Address field, enter your server’s public IP address. Players will also be able to connect via this subdomain.


    Make sure to click Save

  3. Create a SRV record. The name should be _minecraft._tcp. The priority and weight should be 0, the TTL should be auto. The default port for Minecraft is 25565 but this may be different with your host. The target will be the hostname of your subdomain, for example: play.example.com. Replace example.com with your own domain.

  • If you wanted to use a subdomain, you would just append it to the end of the name, for example: _minecraft._tcp.pvp
  1. You can check your setup by using sites such as https://mcstatus.io/ or https://mcsrvstat.us/ and entering your domain name. Of course, also by trying to connect inside of Minecraft itself.

Troubleshooting:

  • Please note that due to DNS Cache, you may not be able to instantly connect to your server. It may take an hour or so. Your Default DNS Resolver, usually operated by your Internet Service Provider, may cache for longer. Consider switching to Cloudflare’s 1.1.1.1 DNS Resolver today, for fast and privacy respecting DNS. Setup instructions: 1.1.1.1 — the Internet’s Fastest, Privacy-First DNS Resolver

  • If you would like to provide any feedback on this tutorial, please post in the #Meta category, tag your post #TutorialFeedback.

Extra

Java Minecraft Clients will automatically look up the SRV record (_minecraft._tcp.domain) for the domain you specify in the connect screen. Then, they will look up the A/IPv4 for the target. Therefor, you have a mapping between the SRV record and the target, and you can create SRV record on top of existing hostnames you are using for web or other use cases. You can also have mutiple minecraft servers on the same Public IP by taking advantage of the port part of the SRV record, and having each one run on seperate ports.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.