Mario Merlo
← Blog
25 June 2026

SRV records are cool

self-hosting, dns, minecraft

I am currently hosting a Minecraft server for my friends and I to play on, and I do (as you may be aware) own a domain. The issue is that I’m hosting it on a non-standard port—i.e., it is not reachable on 25565. This would mean that when my friends want to connect to my server, they’d have to enter something like subdomain.example.com:12345, which is annoying to remember.

That is, until I found out about SRV records, which I was completely unaware of. SRV records redirect traffic from a domain to a specific IP:Port combination, and they solve exactly this kind of problem.

Working example

Let’s assume your domain is minecraft.yourname.com and you host a Minecraft server on IP 123.123.123.1:12345. In order have your friends connect solely through minecraft.yourname.com, you’d have to create two DNS records:

  • an A record which points to 123.123.123.1;
  • an SRV record which redirects minecraft.yourname.com to your A record on port 12345.

Further assuming you have Cloudflare as your DNS provider, you can easily create your A record from the DNS records settings. In this case:

  • in the Name field, input your subdomain minecraft;
  • in the IPv4 address field, input 123.123.123.1;
  • disable Cloudflare’s proxy (the orange cloud).

Disabling the proxy is not necessary, but adding an SRV record would still expose your IP. You’d get a warning saying exactly this if you didn’t.

Now add the SRV record:

  • in the Name field, write _minecraft._tcp.minecraft:
    1. _minecraft specifies which application the record redirects to;
    2. _tcp indicates that it uses TCP as a transport protocol;
    3. minecraft is the subdomain which hosts this service;
  • in the Priority field, write 0 (the highest priority);
  • in the Weight field, write 5;
  • in the Port field, write 12345, the port for your Minecraft server;
  • in the Target field, write minecraft.yourname.com.

Note that if you only have a single server (which you probably do), priority and weight mean nothing: priority is used to select the preferred host, while weight is used as a tie breaker among hosts with the same priority. It’s a load balancing feature which becomes irrelevant with a single service.

And there you go, you now can connect to your Minecraft server through minecraft.yourname.com! You can check that this went through correctly with dig:

dig minecraft.yourname.com +short
dig _minecraft._tcp.minecraft.yourname.com SRV +short

You should see the following two answers:

123.123.123.1
0 5 12345 minecraft.yourname.com.