Skip to main content

Minecraft server setup

How to connect a domain to your Minecraft server

Giving your server a name like play.yourdomain.com instead of an IP and a port makes it easier to share and easier to remember. Which DNS records you need depends on one thing: whether your server has its own IP or shares one.

  • Minecraft guides
  • Updated
  • 7 min read
  • Dedicated and shared IP
  • Cloudflare DNS
  • SRV records explained
SRV RECORDTypeSRVName_minecraft._tcp.playPriority0Weight0Port28017Targetplay.yourdomain.comThe name field is the part people get wrong. The service and protocol prefix is required.

The short answer

Add an A record pointing your subdomain at the server IP, with the Cloudflare proxy set to DNS Only (grey cloud). If your server runs on a port other than 25565, add an SRV record named _minecraft._tcp.play with priority 0, weight 0, your port, and your subdomain as the target.

Key points

  • Dedicated IP on the default port: an A record is all you need.
  • Shared IP or a custom port: A record plus an SRV record.
  • The Cloudflare proxy must be off. Minecraft is not HTTP traffic.
  • The A record takes the IP only, never the port.
  • Bedrock does not read SRV records. It needs the port entered separately.

Which setup do you have

Everything below branches on a single question: does your server have its own IP address, or does it share one with other servers on a distinct port?

Dedicated IP
Your server has an IP to itself and can run on Minecraft's default port, 25565. One A record and you are done.
Shared IP
Your server shares an IP and is distinguished by its port, for example 28017. You need an A record and an SRV record, because the domain alone cannot carry a port.

If you are not sure, look at the connection address in your control panel. If it ends in :25565 or has no port at all, you are in the first case. Any other number and you are in the second.

Dedicated IP: an A record

  1. Log in to the Cloudflare dashboard

    Sign in to your Cloudflare account and select the domain you want to use.

  2. Add an A record

    Create a new DNS record of type A with these values:

    • Name: the subdomain. Use play to get play.yourdomain.com.
    • IPv4 address: your server's IP address, with no port number.
    • Proxy status: turn this off. The cloud must be grey and read DNS Only.
    • TTL: Auto.
  3. Save

    That is the whole job. Players can now enter play.yourdomain.com into the Minecraft client and connect.

Cloudflare DNS record editor showing an A record named play with the proxy status set to DNS Only
The A record in Cloudflare. Note the proxy status: it has to read DNS Only.

Shared IP: A record plus SRV

On a shared IP the port is what identifies your server, and a domain name has nowhere to put a port. The SRV record is how DNS solves that: it carries the port separately, and the Minecraft client knows to go looking for one.

  1. Create the A record first

    Exactly as above: type A, name play, your server IP with no port, proxy set to DNS Only, TTL Auto. The SRV record needs something to point at, and this is it.

  2. Create the SRV record

    Add a second record, this time of type SRV:

    • Name: the service and protocol followed by your subdomain, for example _minecraft._tcp.play.
    • Priority: 0
    • Weight: 0
    • TTL: Auto
    • Port: your Minecraft server's port, for example 28017.
    • Target: your domain, for example play.yourdomain.com.
  3. Save both records

    Players can now connect with just play.yourdomain.com, and the client finds the port on its own.

Cloudflare DNS record editor showing an SRV record with the service and protocol prefix, priority zero, weight zero and a port
The SRV record. The name field carries the service and protocol prefix, not just the subdomain.

What the SRV record actually does

An A record answers "what IP is this name". An SRV record answers a more specific question: "for this service, on this protocol, at this name, what host and port should I use".

That is why the name looks strange. _minecraft._tcp.play breaks down as:

_minecraft
The service. Minecraft's client looks for exactly this.
_tcp
The protocol. Minecraft Java uses TCP.
play
Your subdomain, the part players actually type.

Both underscores are required. They are not decoration and they are not optional, and leaving one out is the most common reason an otherwise correct SRV record does nothing at all.

Why the proxy must be off

Cloudflare's orange cloud proxies traffic through their network, which is genuinely useful for websites. It handles HTTP and HTTPS.

Minecraft is neither. It is its own protocol over TCP, so a proxied record hands your players' connections to a system that does not know what to do with them. The symptom is a domain that resolves but never connects, which reads like a server problem and is not one.

Set the proxy status to DNS Only so the cloud icon is grey, not orange. If you already have a working website on the same domain, leave those records proxied and change only the Minecraft subdomain. The setting is per record, not per domain.

The Bedrock caveat

Everything above about SRV records applies to Minecraft Java Edition. Bedrock does not read SRV records the same way, so a Bedrock player pointed at play.yourdomain.com will not be sent to your custom port.

Two ways round it:

  • Have Bedrock players enter the port in the port field when they add the server, with the domain in the address field. The A record still does its job, the SRV record just is not consulted.
  • Get a dedicated IP for the server so it can run on the default port, and no port needs specifying at all.

Checking it worked

DNS changes with a TTL of Auto usually take effect within a few minutes, but propagation is not instant everywhere at once. Before you conclude something is wrong:

  • Try the domain from a device on a different network, such as a phone off wifi. If it works there and not at home, that is local DNS caching, not your record.
  • Confirm the A record has an IP and only an IP. Pasting the full connection string with the port into an A record is a common slip and it silently fails.
  • Recheck the proxy status. It is easy to create the record correctly and have Cloudflare default the proxy back on.
  • For SRV, recheck both underscores and that the target is the domain, not the IP.

If the domain resolves to the right IP but the connection times out, the problem has moved from DNS to the server itself, and the place to look next is whether the server is running and reachable on the port you specified.

More guides for people running their own Minecraft server.

Quick answers

Common questions

Add an A record in your DNS pointing your chosen subdomain at the server IP, with the proxy turned off. If your server uses a non-standard port, add an SRV record as well so players do not have to type the port. Then they connect using just the domain.

The most common cause is the Cloudflare proxy being left on. The orange cloud proxies HTTP traffic only, and Minecraft is not HTTP, so a proxied record breaks the connection. Set the record to DNS Only, which shows as a grey cloud.

An SRV record tells the Minecraft client which port to use for a given domain, so players can type play.yourdomain.com instead of play.yourdomain.com:28017. You need one when your server runs on any port other than the default 25565.

The service and protocol prefix followed by your subdomain, for example _minecraft._tcp.play for play.yourdomain.com. Both underscores are required and the prefix is not optional. Priority and weight are both 0.

Not the SRV part. Bedrock does not read SRV records the way Java does, so a Bedrock player has to enter the port separately in the server entry, or you need a dedicated IP so the server runs on the default port.

Usually within a few minutes when the TTL is set to Auto, but DNS changes can take longer to reach everyone. If it works for you and not for a friend, that is propagation rather than a mistake in the record.

Minecraft hosting on our own UK hardware

Paper, Purpur, Forge and Fabric supported, with the connection details and IP options you need to set a domain up properly.

  • UK data centre
  • DDoS protection included
  • Dedicated IP available