How to make a domain point to a specific port for a Minecraft server? [closed]

I have a Minecraft server running on a port different than the default one. I want to create a domain that points to the server port, but when I'm creating it, it doesn't allow me to set the IP to ip:port. I also don't want people to have to put domain.com:port.

Is there any way to solve this?
I think it has to be easy, because there are some webpages that allow you to create a subdomain pointing to a port that you can specify.

EDIT: I have found this guide that tells exactly how to do what i'm asking for. However, I got a free domain from Freenom and i think they don't give me the option to add SRV records (and I don't even know what that means). Is there any other way to do what this guide tells with Freenom domains? I really don't want to spend money on this because again, it's a very small server and I only play with some friends. I know this way i would get something like mc.domain.tk but that's ok for me.

Thanks for all the replies so far.


You can't. *

Domain names don't support that. They're merely a human readable alias of one or more IP addresses and cannot be linked to a specific port.

If you want your players to be able to just use the domain name without port you'll need to use the default port (for Minecraft it is 25565). The default port will always be used when a player doesn't specify a port in the game. For example: mc.example.com:25565 = mc.example.com.

Or if you have access to it you could as well redirect the default port to yours. For example with iptables. But that would only work if the default port is not in use (e.g. by another Minecraft server).

* Some providers do allow it in their control panel as a part of unmasked redirect. They then redirect the traffic from that domain using their local settings to the target ip:port. This is no common practice so I cannot tell who actually supports it.


That's not how DNS works. Whatever's in the A (or AAAA) record is going to be used as an IP address only. The port is something different.

You can however achieve what you want. There are two main options.

  1. Run a proxy on the default port that forwards traffic to the actual MC server(s). For example Velocity.

  2. Run a MC server on the default port with mods that redirect players to the other server(s). For example ServerRedirect.

If what you want is a bit complicated, then you're going to need more than one machine and/or domain to solve it.