Score:0

How to forward all port from Debian to Windows with OpenVPN

mx flag

My Setup:
Debian 10 from Azure
Windows 10 from Azure

Debian 10 is a clean new server from Azure with only OpenVPN installed and set up using the script from this Repository.

Windows 10 is full of programs and has Xampp running on it and I can connect to Debian 10 from Windows 10 with both OpenVPN and SSH.

Issue:
I don't want to give away my Windows 10 IP address but I want people to access the website on Xampp using the Debian 10 IP.

Goal:
I can port forward or Tunnel all the requests made to the Debian IP TCP port (80, 443, 3000, 8080) to the Windows 10 Port through OpenVPN, or if it can be done with SSH.

Progress:
I have set up OpenVPN on Debian with the script from here and it's successful and my Windows 10 connects with the OpenVPN.

Windows 10 firewall is disabled.

I try using C2S with Bitverse SSH to forward port, it only works locally.

There is a Topics on OpenVPN forum that try to do this but is not comprehensive enough. this is the link

Please, if anyone can forward all ports or those specific ports from Linux to Windows, using any method please let me know how I can do it. Thank you so much in advance.

Score:0
br flag

If all your ports are serving http/s content, then setting up nginx or a different reverse proxy would probably be the best way to go. If you need other data streams that are not http/s to work I would suggest using iptables like mentioned in the example here: https://my.esecuredata.com/index.php?/knowledgebase/article/49/how-to-redirect-an-incoming-connection-to-a-different-ip-address-on-a-specific-port-using-iptables/

Depending on your setup you can easily modify the examples given in that link to suit your setup:

iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination Windows10-ip:443
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination Windows10-ip:80
iptables -t nat -A PREROUTING -p tcp --dport 8080 -j DNAT --to-destination Windows10-ip:8080
iptables -t nat -A PREROUTING -p tcp --dport 3000 -j DNAT --to-destination Windows10-ip:3000
iptables -t nat -A POSTROUTING -j MASQUERADE

This setup also works via a VPN tunnel if needed. Just use the VPN IP address of the Windows 10 machine.

A note of caution: XAMPP is not a very secure setup out of the box and is not intended for production usage but rather for development. So unless you have taken the necessary steps to secure your XAMPP installation or only use this setup temporarily, it would be a much better idea to move your website / webapp to a more robust LAMPP stack or similar.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.