A domain for a Minecraft server lets players type mc.example.com instead of an IP address and port. Java Edition has supported SRV records since version 1.3.1, released on August 1, 2012, so the address alone, without a port, can lead to a server even on a non-standard port. We'll show you when a plain A record is enough, how to set up an SRV record, how to configure Cloudflare, and what about Bedrock players.

  • Server on the default port 25565: an A or AAAA record for the domain is enough.
  • Server on a different port: add an SRV record (_minecraft._tcp) with the port and target hostname.
  • The target of the SRV record must have its own A or AAAA record and cannot be a CNAME alias.
  • Bedrock doesn't support SRV, so Bedrock players enter the address with an A record and the port separately.

When an A record is enough, and when you need an SRV record

The Java server listens by default on TCP port 25565, set in server.properties as server-port. As the server.properties entry on Minecraft Wiki explains, if your server runs at home behind a router, you need to forward that port, and it's best to leave server-ip blank. We cover the other options in our server.properties configuration guide.

If the server runs on port 25565, an A record pointing to the server's IP address is enough, for example mc.example.com leading to 203.0.113.10. The game will add the default port automatically. An SRV record becomes useful when the hosting provider assigned a different port, say 25570, or when multiple servers run on a single IP address.

According to the 1.3.1 changelog, different subdomains of one domain can then point to different servers on different ports, with the service called minecraft, meaning the record takes the form _minecraft._tcp.example.com. The player just types the name, and the game reads the correct host and port from DNS on its own.

How to set up an SRV record step by step

  1. Add an A record for the server's hostname, for example node1.example.com pointing to 203.0.113.10.
  2. Add an SRV record with the service _minecraft, protocol _tcp, and name mc.
  3. Set priority 0, weight 5, the server's port (for example 25570), and target node1.example.com.
  4. Save the changes and wait out the TTL until the new records propagate.
  5. Type mc.example.com in the game without a port and check that the server responds.

In a DNS zone file, such a record looks like this: _minecraft._tcp.mc.example.com. 3600 IN SRV 0 5 25570 node1.example.com. The field order is described in RFC 2782: service name, TTL, class, type, priority, weight, port, and target. The client picks the record with the lowest priority, and the weight distributes traffic among records with the same priority, so with a single server these values don't matter.

The most common mistake involves the target. RFC 2782 requires that the name in the target field have its own address records and not be an alias, so don't put an IP address or a name with a CNAME record there. You can check whether your domain works using our check server tool.

Domain in Cloudflare

In Cloudflare, records can have proxying enabled, marked with an orange cloud icon. As Cloudflare's documentation explains, only A, AAAA, and CNAME records can go through the proxy, and services other than HTTP should run in DNS-only mode, since they're not compatible with HTTP proxying. A game server is exactly that kind of service.

So set the server's hostname A record to DNS-only, the gray cloud icon. The SRV record can't be proxied anyway, so you add it in the DNS panel as a regular entry with the same fields as above. If you're still choosing where to host your server, check out our Minecraft server hosting section.

Bedrock players and Geyser

Bedrock Edition doesn't use SRV records. According to Geyser's list of common issues, the "Invalid IP address!" message appears on Bedrock when the entered domain only resolves to an SRV record. The solution is an IPv4 address or a name with an A record, plus the port entered in a separate field, which defaults to 19132 in Geyser.

The simplest fix is to also add an A record for the plain name mc.example.com. Java will then find the SRV record with its port, and Bedrock will use the A record and the port entered by the player. We cover crossplay configuration in our crossplay with Geyser guide, and issues with the new network transport in Bedrock 26.60 won't connect to servers. You'll find the full process of setting up a server from scratch in our how to create a Minecraft server guide.

Sources