简体   繁体   中英

DNS Record to Redirect Different Ports to Different Hosts

I have a subdomain that I want to use for 2 things at once:

  • When accessed through web ports, redirect to Server 1 to show a web page,
  • When that address is used for windows remote desktop, redirect to Server 2 for remote desktop.

Is it possible to split traffic with DNS record based on the port of incoming request?

I read a bit but I couldn't figure out if SRV records would do the job, or if that would be a backward compatible method.

Thank you to anyone who gives some ideas.

Cheers!

This is outside of the scope of DNS, as it's role is simply Domain Name Resolution, and ports do not exist in the DNS world.

This seems like an idea use-case for something like haproxy however, but you will still need one of the servers to route all of the traffic for another unless you use two different host names.

With HAProxy, packet flow would be the following:

User A (Web)

  • DNS Lookup of example.com -> 1.1.1.2
  • Establish TCP connection to 1.1.1.2 on port 80 (haproxy)
  • HAProxy forwards this connection to real webservice on 1.1.1.6

User B (RDP)

  • DNS Lookup of example.com -> 1.1.1.2
  • Establish TCP connection to 1.1.1.2 on port 5900 (haproxy)
  • HAProxy forwards this connection to real RDP service on 1.1.1.7

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM