Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
466 views
in Technique[技术] by (71.8m points)

networking - How to redirect DNS to different ports

TL;DR:

DNS resolution of a domain(s) must map to IP:port(s), instead of just IP.

Example,

sub1.example.com ?? 1.2.3.4:567
sub2.example.com ?? 1.2.3.4:678

I CAN modify DNS records.


I own the domain "Arboristal.com". I also own all sub domains privately on arboristal.com. Such as lg.arboristal or ft.arboristal.com.

Under my DNS settings, Arboristal.com is set to go to our web host who is currently hosting our website.

I have three servers running at my house all running under one public IP address. (71.82.237.27)

I also have three subdomains of Arboristal.com pointing towards my IP address.

Each of the three servers run on their own ports (25565, 25566, 25567)

I want for each subdomain to point to each open port on my IP Address.

Unfortunately when you try to connect to one of these servers using one of the subdomains it only connects to the server that you type the port for.

My situation:

Three servers, each running on a different port. (All portforwarded and working as servers)

  • Minecraft server one (25565)

  • Minecraft server two (25566)

  • Minecraft server three (25567)

I have three subdomains running on my DNS provider (webs.com)

  • mc.arboristal.com

  • tekkit.arboristal.com

  • pvp.artboristal.com

When you use Minecraft to connect to one of these it does automatically through port 25565, meaning that no matter what URL you attempt to connect to it always goes to my IP with the port 25565. Connecting you to Minecraft server one. You CAN type in the port manually, but I would rather keep this as good looking and professional as possible.

So, now that you know my situation, is there any possible way I can make mc.arboristal.com, tekkit.arboristal.com, and pvp.arboristal.com all go to my IP address under different ports without having to specify each port in the provided URL to connect to on the users end?

I can add MX, A (Using this one to connect to the server), CNAME, and TXT records to DNS settings

I can also add Name Servers to DNS settings if I need to use a third party as my DNS provider. (Am willing to do if necessary)

I also have full access to my router at 192.168.0.1 if anything needs to be configured there.

I have only just learned how the internet really functions in the last week so I am unsure if anything here is actually possible. I also may not have the right information about how the internet actually works. Please forgive me for any false information that I may assume about the internet.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can use SRV records:

_service._proto.name. TTL class SRV priority weight port target.

Service: the symbolic name of the desired service.

Proto: the transport protocol of the desired service; this is usually either TCP or UDP.

Name: the domain name for which this record is valid, ending in a dot.

TTL: standard DNS time to live field.

Class: standard DNS class field (this is always IN).

Priority: the priority of the target host, lower value means more preferred.

Weight: A relative weight for records with the same priority.

Port: the TCP or UDP port on which the service is to be found.

Target: the canonical hostname of the machine providing the service, ending in a dot.

Example:

_sip._tcp.example.com. 86400 IN SRV 0 5 5060 sipserver.example.com.

So what I think you're looking for is to add something like this to your DNS hosts file:

_minecraft._tcp.arboristal.com. 86400 IN SRV 10 40 25565 mc.arboristal.com.
_minecraft._tcp.arboristal.com. 86400 IN SRV 10 30 25566 tekkit.arboristal.com.
_minecraft._tcp.arboristal.com. 86400 IN SRV 10 30 25567 pvp.arboristal.com.

(Minecraft supports SRV records, as of 1.3.1, with the service name minecraft)

On a side note, I highly recommend you go with a hosting company rather than hosting the servers yourself. It's just asking for trouble with your home connection (DDoS and Bandwidth/Connection Speed), but it's up to you.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...