Redirecting minecraft port to another - networking

We are transferring our Minecraft server to a different host and there's a pretty good chance, that it will be running on a different port.
I currently have two records on the server website:
mc.domain.sk CNAME {ServerIP}
_minecraft._tcp.mc.domain.sk SRV 5 25560 mc.domain.sk
So just changing the port in the SRV record should be fine. But here's the catch - many players have been connecting to our server using the port too. Basically using mc.domain.sk:25560 instead of just mc.domain.sk. Is there any way to forward this 25560 port to another port (f.e. 25561)?

First of all, CNAME must NOT point to an IP. It must point to another domain name, so unless you mis-wrote the question, your setup is incorrect.
Is there any way to forward this 25560 port to another port?
Is any downtime acceptable? If yes, then it's easy just spawn a proxy (nginx) at that domain and that port, and redirect all incoming traffic to another domain and another port.
If downtime is not acceptable, then you need somehow to migrate active connections between hosts. Even if you manage to do this at IP/TCP level, I don't know if your application will be able to handle this correctly. Cannot help on that.

Related

What hostname did the client use to connect to my TCP server?

In http the client supplies the hostname it used to connect to the service with. Now, for bare TCP connections, is there something similar one can do? My scenario is I have a service that has multiple open TCP ports and that works fine, but for convenience I would like to use the same port and subdomains. Is there any layer I can add on top (like a load balancer), or change the service? I have control over most things, basically anything goes.
Example:
Today I can connect to two TCP services like so: foobar.com:1001 and foobar.com:1002. Is it possible to have e.g. service-1.foobar.com:1000 go to foobar.com:1001 and service-2.foobar.com:1000 go to foobar.com:1002.
Different services can bind to same port but on different IP. Hence different domains shall resolve to different IPs : Port combination [where Port is same for all services]. And you can use Proxy service as from HA Proxy to route connections to final destination.
If I understand your question correctly based on your example then no it is not possible. In this case, there is no difference between an HTTP and TCP connection.
In both cases, the hostname is simply resolved to an ip address. If you setup DNS resolution for foobar.com, service-1.foobar.com, service-2.foobar.com to point to the same ip address then they will all go to the same machine.
I have at times needed to have a service running on a different port internally than it is accessible externally. For that, if you are running on Linux, you can simply use iptables to do the port forwarding.
You can find other stack overflow questions/answers for setting up the port forwarding.
https://serverfault.com/questions/140622/how-can-i-port-forward-with-iptables

Nginx: one port to multiple IP fowarding

I am new to Nginx, and I am looking to have my router port forward a No Machine remote access (NX) request to a Nginx server which would then forward the request again to the correct Virtual Machine for viewing. I am trying to do this because my router only allows one port to one IP forwarding. I want one port to multiple IP forwarding. How would one go about doing this? The issue seems to be that No Machine only allows me to specify my router IP and no way of having Nginx know which machine to forward the request to that it is given from the router.
NginX is of no use here. It will work for HTTP and HTTPS , so Ignore it.
What you're actually thinking of is Port address translation. However PAT will work only when the connection is initiated from the secured side (your virtual machines in this case). So again, this is not helpful either.
The only other possible way is to have individual 1-to-1 NAT. Not sure about the type of router you have, but I had done something similar in the past using IPTables.
Besides, this question is more suited to ServerFault where you might get better responses than on StackOverflow.

setting up a web stack with nginx?

I have got a dedicated server that has nginx web server located in a uk datacenter, the ngnix acts as a front end server which then directs users to other instances that i have on aws located in america. What ip address would the client see, the ngnix front server(which is the desired result), or would the client still know about the instances or servers ip address located in america?
PS. nginx acts as a load balancer here.
Typically, users connect to "www.yoursite.com", and that gets looked up in DNS.
Assuming there is only one DNS entry (corresponding your nginx frontend), then as far as those users are concerned, they are only talking to that one machine.
Sometimes people use round-robin DNS, where multiple machines correspond to a given host name.
Presumably you would know if you were doing this, though (:
You can confirm this by tracing your traffic when connecting. Maybe use WireShark?

Dynamic DNS port forwarding

I need to use my computer as a server but my ISP blocks port 80, 21, 23 etc. I can use other ports and some dynamic dns service but I don't want:
(HTTP) Users have to type http://mydynamicdnsaddress:#port#
(HTTP) Users be redirected from http://mydynamicdnsaddress to http://mydynamicdnsaddress:#port#
(HTTP) Some kind of service that gets HTTP response and change it before resending to users. No-ip and GoDaddy do that. They change some parts of html - eg: title.
Users have to type ftp://mydinamicdnsaddress:#port#
I believe that I need some kind of dynamic dns service that points to a router that forwards TCP packets to another address changing ports. Do you know any online service like that?
Many "dynamic DNS companies use HTTP redirection to send the browser from port 80 to a different port. When you ask a dynamic DNS company to point your domain to a port other than 80, what they actually do is point the domain to their own web-server IP address (in DNS), and then on their web-server (running on port 80) they have a simple server side script which redirects the browser to the your web-server on whatever port you specified - optionally "cloaked" so the visitor won't notice." Can I specify a TCP/IP port number for my web-server in DNS? (Other than the standard port 80)
Here's a reference article for a redirection script: Redirect Script.
What you are asking for is a tunnel or proxy. You'd set up a server which receives communications via port (e.g.) 80 and proxies that request to your home server on port-whatever. You'd probably need to get a dedicated host (or VM like linode) in order to do this. At that point, you might as well move your webserver to the unblocked host.
Also, to be clear, this is impossible with pure DNS. DNS, "Domain Name System", resolves names to IP addresses, NOT to IP address/port pairs.
Most dynamic DNS service providers also provide free web redirect or port forwarding such as dynu.com.
Please note that the cloak works by loading the page in a frame of sort and it does not work with all browsers. For example, Chrome does not support cloak.
As far as I know, you cannot specify the port number in the DNS unless the web server which performs redirection is clever enough to read out the TXT record and use it for redirection. Any web server doing that would be really nice though.

Create a Windows (win32) service discoverable across the network

In short: How to reliably discover a server running somewhere on a (presumably multi-segmented) local area network with zero client configuration
My client application has to locate the server application without knowing the server IP address. It has to work on a local LAN that may be split into segments with hubs or other switching devices.
I already have a working solution, but it is a bit cumbersome to get it working on multi-segment networks. It works as follows:
When the client starts up, it sends UDP broadcasts on its own network segment. If the server is running on the same segment, it works without any issues - the server responds with the appropriate messages.
If the server and client are running on networks separated by a hub / switch that won't forward UDP (the most likely case), then I have a server instance running on each segment, and they forward client requests to each other via TCP - but I need to configure this for the server instances (simple, but still a pain for tech support.) This is the main problem that I need to address. There are sites where we have hundreds of clients running on 5 or 6 separate segments.
The problems I'm facing:
1. Although my application installer enables the appropriate ports on the firewall, sometimes I come across situations where this doesn't seem to happen correctly.
2. Having to run multiple server instances (and therefore configure and maintain them) on hub/switched networks that won't forward UDP
Finally I need a solution that will work without maintenance on a minimal Windows network (XP / 2000 / Vista) that probably doesn't have Active Directory or other lookup services configured.
I don't want to tag on any runtime stuff for this - should be able to do it with plain VC++ or Delphi.
What approaches do commercial apps usually take? I know that SQL Server uses a combination of broadcast and NetBEUI calls (I may be wrong about this).
Thanks in advance.
You have a few terminology issues:
Where you say "network segment" you appear to mean "IP subnet". Devices on the same network segment can see the same IP broadcasts.
Where you say "hub/switch" you appear mean "IP router".
Where you say "won't forward UDP", the problem is actually "won't forward IP broadcasts".
Once we get past that, you have a few options:
Your servers could register themselves under a well-known name in DNS, if you have a DNS server that allows dynamic DNS updates. You should probably use a SRV record as specified in RFC2782. The clients then do a DNS lookup to find the server(s).
You could statically assign your server(s) well-known names in the organisation's DNS, perhaps with a SRV record as with the previous option.
Your servers could join an IP multicast group, if your routers support IP multicast. The clients then send their initial discovery request as a UDP packet to the (pre-ordained) multicast address.
If you have domain server, I would go with small service on it. You can connect with other services to it and use it as distribution point.
Why domain server? It is relatively easy to find it's name (DsGetDcName).
Other choices would include DHCP server, DNS server or something of that kind that needs to be filled by maintenance staff anyhow.

Resources