I need to publish several RDP hosts and I would like to do that with single rule.
General idea is that connection on WAN port, say, 30209 should go to internal host 172.16.0.209:3389,
30210 should go to internal host 172.16.0.210:3389
…
30230 should go to internal host 172.16.0.230:3389
Sequence should start at A and finish at B.
Is there a (not overly complex) way to achive this in ROS?
You could configure it using some script … but you’d still end up with N NAT rules. So even if the job would be done using a script, I’d run the script on some linux PC and copy-paste the resulting configuration commands to the CLI connection.
Then your RouterOS requires a single D-NAT entry pointing to HAProxy where you can do much more flexible things.
Offcourse it depends on the use-case, this introduces “another” components in the chain for sure. But again, is it that dramatic to have a couple of D-NAT lines ? It’s not that you are looking to map hundreds of RDP-NAT’s right ?
You can even “pre-configure” them and ENABLE/DISABLE them as you need them. Just make a small plan and communicate to the RDP/Server guys that they need to follow that scheme.
This would not solve anything as there is only 1 public IP-address to my understanding.
IF there are multiple public IP’s available sure you could already distribute based on that.
But I don’t even know if the topic-starting wants to address inbound connections coming from Internet…
Still confused, port forwarding is doable with one public IP???
The key is to do port translation. The router will keep track of the incoming traffic and return it properly.
What you CANNOT have is incoming traffic for the SAME PORT going to to different servers, how does the router know which server that port is destined for???
(one port to one server).
We honour that above rule with port translation as shown below, each incoming port goes to one specific server.
Perhaps the question was… can I just write one rule to cover all of the above - answer no.
Perhaps the question was… can I have just one incoming port and rule and the router then switches the request to the next server in some sort of fair sequence? answer - not to my knowledge.
The whole idea with haproxy seems to be that the proxy gets the domain name inside the session payload, but I’m not sure whether the domain name is available at all in the RDP protocol, and if yes, whether it is available in plaintext.
As for the same port being forwarded to different internal IP addresses, this is only possible if you match on source address of the request as well. For example, my colleague’s Tik forwards requests to port XXXX to some internal server, except if accessed from my home IP - in that case, it forwards requests to the same port to its own SSH port. But that’s a special application case of course.