For this to work you need a running Minecraft server with a public IPv4 and your own domain name. In this example, Cloudflare will be used as the domain registrar.
- Create an A entry:
- Type: A
- Name: The subdomain you want to use
- IPv4 address: The public IPv4 of your Minecraft server
- Proxy status: Off
- TTL: Auto
- Create an SRV entry:
- Type: SRV
- Name: _minecraft._tcp.YOURSUBDOMAIN
- Priority: 0
- Weight: 0
- TTL: Auto
- Port: Portt of your Minecraft server (default is 25565)
- Target: Your full domain (e.g. mc.yourdomain.tld)

A entry details:

SRV entry details: