Score:0

Forward web requests to another IP and port over VPN

ng flag

I have the following setup

Web browser (192.168.5.10) ——> Home Ubuntu Server (192.168.5.15) ————->VPN over the internet———>to a public IP——> Work Server (192.168.6.90) ——-> Web interface at 192.168.6.90:8787

On my Windows desktop after establishing the VPN tunnel between ubuntu server and work, I build an SSH Tunnel from the Home desktop to the Home Ubuntu server on port 9090. Then using Firefox and SOCKS5 over 9090 I can connect to the work server and to the web interface at 192.168.6.90:8787

Is it possible somehow to configure the ubuntu server so that every time someone connects from home via browser at 192.168.5.15:9090 this will be forwarded to 192.168.6.90:8787. In other terms to make the ubuntu server do the job of the SSH tunnel and SOCKS5 internally?

I tried port forwarding using

iptables --append FORWARD --protocol tcp --sport 8888 --dst 192.168.28.111 --dport 8787 --jump ACCEPT
iptables --append FORWARD --protocol udp --sport 8888 --dst 192.168.28.111 --dport 8787 --jump ACCEPT

But it didn’t work. Maybe I am doing something maybe this is not possible. I would appreciate any tip. I am not sure this is the right title for this question. I would appreciate any correction.

in flag
What you want to do is not FORWARDing but PREROUTING (with DNAT)
ng flag
ok thank you. Could you please help me with the syntax?
jp flag
Does this answer your question? [How can I port forward with iptables?](https://serverfault.com/questions/140622/how-can-i-port-forward-with-iptables)
ng flag
unfortunately not
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.