0

I'm starting a Minecraft server with some friends of mine. Two instances of Minecraft will be running on a Dell webserver on ports 25566 and 25565 respectively (one all the time, the other will be mostly offline). Also, we're going to run an instance of Discourse on another port.

I have the domain mchorizons.gq registered and I will use it for a website (it works, hosted with GitHub). My goal is to arrange the subdomains like this:

  • www.mchorizons.ga: Website
  • play.mchorizons.ga: 24/7 Server
  • private.mchorizons.ga: Occasional Server
  • forums.mchorizons.ga: Discourse

Cloudflare doesn't seem to support forcing a port to a subdomain. My other idea was to use a nameserver hosted somewhere that would route each incoming request to its respective port. I saw on another post that PowerDNS could be used to host a nameserver, but that had nothing on how to use it. Would it be viable to host a nameserver that manages ports to one IP?

Note: I did check this post that said I could use SRV records. I tried following the directions but to no avail.

Albin
  • 11,950

2 Answers2

2

They can always specify the port number in the URL like this:

play.mchorizons.ga:25565
or
play.mchorizons.ga:25566

It is ultimately up to the players to decide which server they're connecting to, so what difference does it make if they have to enter a different port or a different domain?

The Minecraft server uses port 25565 by default, and so does the Minecraft client. If they only specify play.mchorizons.ga then they will connect to the server listening on 25565. I would recommend that you make this the public server since it's going to be running 24/7.


There is nothing you can do on your DNS to have two subdomains pointing to the same IP but different ports. DNS only helps computers find each other by domain to IP translation. The port number is not a part of a domain name, so it cannot be considered in a domain -> IP lookup.

If you wanted to set up the servers that way you actually need either two server systems or two internet connections (IPs) on a single server. Then use port forwarding on each router/interface to route connections from that IP to a specific port number.

Romen
  • 1,308
-1

Edit: I think I misunderstood your question, so this answer will be incorrect (see comment).

The DNS only handles resolution from domain name to the IP address, nothing else. If your server has a public IP you don't need to do any configuration (except setting the A record or AAAA record for the associated IP but nothing about the port).

If the server is e behind a NAT the standard way is to setup a port at the router forward at the router providing the NAT. (Note: using the same IP and port multiple Domain names is a different matter)

Albin
  • 11,950