Answer the question
In order to leave comments, you need to log in
How to forward a port from the Internet to another Internet server (ala gateway) on CentOs 7?
Good evening friends!
In continuation of the question of hiding the RDP server, I am trying to implement what the knowledgeable people advised me, but I did not have enough knowledge, since I am completely unfamiliar with linux systems. :(
Briefly about the task so that you understand what needs to be done and why, but the previous question was not opened:
There is an RDP server located in the Russian Federation . It is necessary that the IP connection to the RDP server on the clients be different , preferably in a nearby European country. In other words, we you need an intermediary server that would accept connections on port 3389 , redirect TCP / UDP toreal IP of the server on the same port 3389, keeping the real IP secret from users and prying subjects.
It has already been popularly explained to me that this is nonsense, spy mania and, in general, a collective farm and stupidity, but the task has been set, and I am stupid, but I am trying to fulfill the wishes of the leadership in the vein of "any whim for your money."
Answer the question
In order to leave comments, you need to log in
A task as a task, quite to itself. Apparently there are reasons to hide the fact that the target server is in the Russian Federation. It happens. There are such -
"...Where they look with tenderness
At foreign stickers...
And they eat bacon ... Russian!" (C) Mikhalkov S.V. Two friends.
To the sheep.
The task is reduced to the usual natu, which changes the destination IP from local to a remote one in a packet that arrives at port 3389 - after which the bucket of course sends this packet to the world to the default gateway.
Firstly, I recommend this scheme to everyone and everyone who has fallen into a blunt and does not know how a packet passes through netfilter. Print and hang at work.
Let's set the assumptions first.
Server IP = 212.20.5.1 (many, many years ago it was the IP of our server, it is really Russian :) )
VPS IP = 170.70.1.1 (taken from the ceiling)
The default policy for filter is ACCEPT (everything that is not prohibited is allowed A very dangerous policy, it's only for demonstration purposes, you can't do that in real life, I'm just reluctant to write additional rules for passing traffic)
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A PREROUTING -p tcp --dport 3389 -d 170.70.1.1 -j DNAT --to-destination 212.20.5.1
-A POSTROUTING -o eth0 -j SNAT --to-source 170.70.1.1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question