Answer the question
In order to leave comments, you need to log in
linux. iptables. Redirecting RDP from one server to another. How?
There is office1 with subnet 192.168.6.0. There is office2 with subnet 192.168.4.0.
Office1 has server 192.168.6.12, office2 has server 192.168.4.30. These are 1C servers. office1 and office2 are connected via openvpn, the gateways in the offices are on Debian 7. It is necessary to configure a firewall in both offices so that when clients knock on 192.168.4.30, they get to 192.168.6.12. In office1 I set it up with half a kick, but in office2 it doesn’t work, no matter how perverted with iptables. Suggest a solution, please.
iptables -t nat -A PREROUTING -p tcp -d 192.168.4.30 --dport 3389 -j DNAT --to-destination 192.168.6.12:3389
iptables -t nat -A POSTROUTING -p tcp --dst 192.168.6.12 --dport 3389 -j SNAT --to-source 192.168.4.30
iptables -A FORWARD -d 192.168.6.12 -p tcp --dport 3389 -j ACCEPT
Answer the question
In order to leave comments, you need to log in
Thank you all for the answers and comments, I found this solution, on the advice of a friend.
I made a 3rd level domain name, in the domain control panel I just set the necessary ip, and if necessary I will simply change it there. All clients will go to the server just by this domain name.
Is forwarding allowed?
What does
# cat /proc/sys/net/ipv4/ip_forward say
?
if zero, then enable:
# echo "1" > /proc/sys/net/ipv4/ip_forward
# sysctl net.ipv4.ip_forward=1
Attach rules from both gateways indicating their local addresses, as well as which server is the OVPN server.
In general, it is not very clear what these actions with DNAT are for. Do you have local subnets do not see each other? If not, then configure OVPN, not a firewall, and go directly to a remote subnet.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question