Search code examples
dnsportportforwarding

Can I configure a subdomain to point to a specific port on my server


I have an old computer which I converted into a Minecraft server. I have 2 Minecraft servers running simultaneously, one on port 25565 (default) and one on port 25566.

I bought the domain something.example and pointed it to my server. Right now, in the game you type something.example to get into the first server and something.example:25566 to get into the other server.

Is there a way to set one.something.example to point to the first server and two.something.example to point to the second server? I own the (centos) server, have root access, and everything else. The domain is controlled by no-ip if that makes a difference. I know that DNS has no relationship to port numbers but if there a program I can install to make this work?


Solution

  • If you only got one IP on the server, there is no chance to do that. DNS is a simple name to number (IP) resolver. If you have two IPs on the server, you can point each subdomain to each of the IP-addresses and run both servers on the default port on each IP.
    one.example.com -> 127.0.0.1 (server: 127.0.0.1:25565)
    two.example.com -> 127.0.0.2 (server: 127.0.0.2:25565)