In our setup we have a linux server with 2 NICs, one connecting to our LAN/internet and one connecting to a windows machine that is also serving RDP. We want to connect to via RDP and land on the win machine of course.
I set up fixed IPs between the 2 -> ping works. Additionally I have the following iptables settings:
iptables -t nat -A PREROUTING -p tcp -d <external IP of linux machine> --dport 3389 -j DNAT --to-destination <IP of win machine> iptables -t nat -A POSTROUTING -p tcp -s <IP of win machine> --dport 3389 -j SNAT --to-source <external IP of linux machine>
I also tried with
iptables -t nat -A POSTROUTING -p tcp -s <IP of win machine> --sport 3389 -j SNAT --to-source <external IP of linux machine>
No RDP connection possible. Am I even doing the right thing? Should I try not specifying any port on the SNAT rules?
/edit: tried SNAT without specifying a port and also couldn't connect.
/edit: tried MASQUERADE instead of SNAT and still no success.
sudo iptables -t nat -A POSTROUTING -o <outgoing interface on linux machine> -j MASQUERADE
/edit: tried deliberately forwarding via
sudo iptables -A FORWARD -p tcp --dport 3389 -j ACCEPT
But still no connection.
/edit: Suspecting network manager be the source of the problem. I manually defined the internal interface of the linux machine. It still shows up in network manager and the problem is still not solved.