Back to Blog

How to Connect a Domain to a Minecraft Server: A and SRV Records

Minecraft server domain setup: an A record for play.example.com, an SRV record for a custom port, Cloudflare DNS only, Bedrock ports and checks with dig.

Nodesty Team7 min readGame servers
The words Minecraft Domain with A record, SRV and 25565 on a dark Nodesty background

Connecting a domain to a Minecraft server lets players join with an address like play.example.com instead of 203.0.113.10:25566. A domain is easier to remember, looks more professional on server lists and keeps working when you move the server to a new machine: you only update one DNS record, and players don't have to change anything.

In this guide we set up an A record for a subdomain, add an SRV record for servers on a non-default port, cover Cloudflare and Bedrock Edition, check the records with dig and go through the most common problems. If you don't have a server yet, start with our How to make a Minecraft server guide.

What you need

  • A domain name whose DNS records you can manage, at your registrar, your hosting panel or Cloudflare. See What is a domain name? for the basics.
  • The server's public IPv4 address and the port it listens on (server-port in server.properties, 25565 by default).
  • A subdomain for the game, such as play or mc. Using a subdomain leaves the root domain free for your website; we explain how this works in What is a subdomain?.

Which records do you need?

SituationRecords
Java server on port 25565A record only
Java server on another port (e.g. 25566)A record + SRV record
Bedrock server (any port)A record; players enter the port themselves
Velocity or BungeeCord networkA record (+ SRV if needed) for the proxy

The Java client first looks for an SRV record named _minecraft._tcp.<address>. If it finds one, it connects to the host and port in that record; if not, it connects to the A record of the address on port 25565.

Step 1: Create the A record

An A record maps a name to an IPv4 address. In your DNS panel, create:

Type:   A
Name:   play
Value:  203.0.113.10
TTL:    300 (or Auto)

Replace 203.0.113.10 with your server's IP address. If your server also has a public IPv6 address and Minecraft listens on it, you can add an AAAA record for play with the IPv6 address; this is optional.

If the server uses the default port 25565, you're done: players type play.example.com in the Server Address field and join.

Step 2: Add an SRV record for a custom port

When the server runs on another port, for example because several servers share one IP address, players would have to type play.example.com:25566. An SRV record hides the port. A common pattern is to point the SRV record at a separate hostname with its own A record:

Type:   A
Name:   mc
Value:  203.0.113.10

Type:     SRV
Service:  _minecraft
Protocol: _tcp
Name:     play
Priority: 0
Weight:   5
Port:     25566
Target:   mc.example.com
  • Service and protocol: Always _minecraft and _tcp for Java Edition.
  • Name: The address players will type, here play for play.example.com.
  • Priority and weight: Only matter when there are several SRV records for the same name; 0 and 5 are fine.
  • Port: The server-port value of your server.
  • Target: A hostname that has its own A record. An IP address is not allowed here.

In zone file notation, the same record looks like this:

_minecraft._tcp.play.example.com. 300 IN SRV 0 5 25566 mc.example.com.

The name play can have both an A record and an SRV record at the same time, so you can also use play.example.com itself as the target if its A record points to the right IP address.

How it looks in DNS panels and Cloudflare

DNS panels show SRV records in two ways: some have separate Service, Protocol and Name fields, others have a single name field where you enter _minecraft._tcp.play. Most panels add your domain automatically, so don't type the full _minecraft._tcp.play.example.com into the name field, or the record may end up as ...example.com.example.com.

On Cloudflare, pay attention to the proxy status:

  • The A record that Minecraft uses (play or mc) must be DNS only, the grey cloud. The orange cloud proxy only forwards HTTP and HTTPS traffic, so Minecraft connections to a proxied address fail.
  • SRV records are always DNS only on Cloudflare, but their target must also be a DNS only record. An SRV record that points at a proxied name doesn't work.
  • Your website can stay proxied; only the game records need the grey cloud.

Bedrock Edition: A record and port

Bedrock Edition doesn't use SRV records. Create an A record (for example bedrock.example.com or the same play name) pointing to your server, and tell players to enter the domain in the Server Address field and the port, 19132 UDP by default, in the Port field. If you run Geyser on a Java server, the same rule applies to Bedrock players. Details are in our How to make a Minecraft Bedrock server guide.

Check the records

Install dig if it's missing (sudo apt install dnsutils on Ubuntu/Debian, sudo dnf install bind-utils on AlmaLinux) and query the records:

dig +short play.example.com A
dig +short _minecraft._tcp.play.example.com SRV

The first command should print your server's IP address, the second something like 0 5 25566 mc.example.com.. On Windows, use nslookup:

nslookup play.example.com
nslookup -type=SRV _minecraft._tcp.play.example.com

To see what other resolvers return, add a public resolver to the query, for example dig +short play.example.com A @1.1.1.1.

TTL and propagation

The TTL tells resolvers how long they may cache a record. New records usually work within minutes; when you change an existing record, players may see the old value until the TTL expires. Lower the TTL to about 300 seconds a day before you move a server, then raise it again afterwards. If your own computer still shows an old address, clear the local cache as described in How to flush DNS. We cover resolvers and caching in What is DNS?.

Common problems

  • Proxied record: The A record or the SRV target has the Cloudflare orange cloud turned on. Switch it to DNS only.
  • Typos in the SRV record: _minecraft and _tcp must be spelled exactly with the underscores, and the port must match server-port.
  • Duplicate domain in the name: The panel appended your domain to a name you already wrote in full. Check the result with dig.
  • SRV target is an IP or a CNAME: The target must be a hostname with an A record.
  • server-ip is set: Leave server-ip= empty in server.properties so the server listens on all interfaces. A wrong value there stops it from accepting connections.
  • Firewall: DNS only finds the server; the port must still be open, for example sudo ufw allow 25566/tcp. See How to use UFW and What is a port?.
  • SRV on the root domain: You can create _minecraft._tcp.example.com, but if the root domain's A record points to a proxied website, players using the root name will hit the website instead. A dedicated subdomain avoids this.

Velocity, BungeeCord and protection services

In a network, the domain points to the proxy, not to the backend servers. Create the A record (and SRV record, if the proxy doesn't use 25565) for the Velocity or BungeeCord machine; the backend servers stay hidden. With Velocity's forced-hosts, you can also send survival.example.com straight to a specific server, as shown in our Minecraft Velocity network guide.

If you put a Minecraft DDoS protection proxy service in front of your server, the provider gives you a hostname or IP address to point your record at. In that case follow their DNS instructions and allow only their addresses on your server's firewall.

Once players can reach you by name, put the domain on server lists and your Discord; see How to get players on your Minecraft server.

A Minecraft server with a domain at Nodesty

Nodesty Minecraft server hosting plans run in Frankfurt on an AMD Ryzen 9 9950X processor reaching 5.7 GHz, with NVMe storage and DDoS protection; you point your domain at the server's address exactly as described above. If you'd rather manage everything yourself, our AMD Ryzen 9 9950X VPS plans give you full root access and free daily backups kept for 7 days.

Minecraft is a trademark of Mojang AB. Nodesty is not affiliated with or endorsed by Mojang or Microsoft.

Frequently Asked Questions

Do I need an SRV record for my Minecraft server?

Only if your Java server runs on a port other than 25565. When the server uses the default port, an A record pointing play.example.com to the server's IP address is enough, and players can join by typing only the domain name.

Why doesn't my Minecraft domain work with the Cloudflare orange cloud?

Cloudflare's standard proxy only forwards web traffic such as HTTP and HTTPS, not Minecraft connections. Set the A record used by your Minecraft server to DNS only, the grey cloud, so that the domain resolves to your server's real IP address.

Can the SRV record target be an IP address?

No. The target of an SRV record must be a hostname, such as mc.example.com, that has its own A record. If you enter an IP address as the target, most DNS panels reject it or the Minecraft client can't use it.

Do SRV records work for Bedrock Edition?

No. Bedrock Edition doesn't look up SRV records. Bedrock players type the domain name in the server address field and the port, 19132 by default, in the port field. An A record is all a Bedrock server needs.

How long does it take for a new DNS record to work?

A newly created record usually works within a few minutes. If you change an existing record, players may keep seeing the old value until its TTL runs out, so lower the TTL to around 300 seconds before you move a server.

Should I set server-ip in server.properties to my domain?

No. Leave server-ip empty in most cases so that the server listens on all of the machine's network interfaces. The domain is handled entirely by DNS; the server itself doesn't need to know it.

Nodesty

About the author

Nodesty Team · Infrastructure & Support

The Nodesty team runs our servers, network and DDoS protection day to day and answers customer support requests around the clock. These guides come from that work.

Related articles

Launch your server now.

Build, scale, and conquer without limits on Nodesty's premium infrastructure.

                                                                                                                                                                                                                            
                                                                                                                                                                                                                            
                                                                                                                                                                                                                            
                                                                                                                             ············································                                                   
                                                ··································································································..........···························                                     
                                       ················..........................................................................................................................··············                             
                                  ·············.................::::::::::::::::::::::::::::::::::::::::::::::....................:::::::::::::::::::::::::::::::::::::::................···········                        
                             ············................:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::............·········                     
                         ············.................:::::::::::::::::::::::::::::::::::::::::::::::::::------------::::::::::::::::::::::::::::::----------------:::::::::::::::::::::..........········                  
                    ············......................::::::::::::::::::::::::::::::::::::------------------------------------------------------------------------------------:::::::::::::.........········                
                ··········.............................................::::::::::::::::::-------------==========================================-----------------------------------:::::::::::........·······               
             ········..................:.....................................::::::::::--------=======+++++++++++++++++++++++++++++++++++++=========================------------------::::::::::.......·······              
           ······.........::::::::::::::::::::................................:::::::-----=====++++xxxxxx**************************xxxxxxxxx++++++++++++++===================------------::::::::.......·······             
          ·····.......:::::::::::::::::::::::::::.............................:::::----===+++xxx****%%%%&&&&&&#############&&&&&&&%%%%%*******xxxxxxxx++++++++++++++==============----------:::::::......······             
         ····......::::::::-------------:::::::::::..........................::::---===+++xx***%%%&&&####@@@@@@@@@@@@@@@@@@@@@@@@####&&&&&%%%%*******xxxxxxxxx+++++++++++++===========--------::::::......·····             
        ····.....:::::::--------------------:::::::::.......................::::---===++xxx**%%&&&###@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@###&&&&%%%%%********xxxxxxxxxxx++++++++++++========------::::::.....······            
        ····.....:::::--------------------------::::::::....................::::---===++xx***%%&&&####@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@###&&&&&%%%%%**********xxxxxxxxxxxxx+++++++++=======------:::::.....·····            
        ····....::::::-------=============---------:::::::::................:::::---===+++xx***%%%&&&#####@@@@@@@@@@@@@@@@@@@@@@@@@#####&&&&&%%%%%%*************xxxxxxxxxxxxxx+++++++++======-----:::::....·····            
         ····....:::::-------================---------:::::::::...............:::::----===++++xxx***%%%%&&&&&&#################&&&&&&%%%%%%%*******************xxxxxxxxxxxxxxxxx++++++++======----:::::....·····            
         ·····....:::::--------=================---------::::::::::..............:::::::-----====+++++xxxxxx**************************xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx++++++++=====-----::::....·····            
          ·····.....:::::--------=================----------:::::::::::.................:::::::::-------=============++++++++++++++++++++++++++++++++++++xxxxxxxxxxxxxxxxxxxxxxx++++++++======-----::::....·····            
            ·····.....:::::::----------===========-------------::::::::::::.........................::::::::::::::::::------------------=============+++++++++++++++++++++++++++++++++=======-----::::.....·····            
              ······......:::::::---------------------------------:::::::::::::........................................:::::::::::::::-----------============+++++++++++++++++++++========------:::::.....·····             
                 ······........:::::::::---------------------------:::::::::::::::::...........................................:::::::::::::------------=============================--------::::::.....······              
                    ·········.........:::::::::::::::-------------::::::::::::::::::::::::.......................................::::::::::::::::--------------------------------------::::::::......·······                
                          ··········............::::::::::::::::::::::::::::::::::::::::::::::::::................................::::::::::::::::::::::::::-------------:::::::::::::::.........········                   
                                  ············..................:::::::::::::::::::::::::::::::::::::::::::.........................:::::::::::::::::::::::::::::::::::::................···········                        
                                             ················.............................................................................................................·················                                 
                                                           ······················................................................................···························                                                
                                                                               ·········································································