i am trying to do something , but i cant get it to work After at least 4-5 hours of research and trying , its time for help

I want to connect to a second remote machine trough a primary remote machine

my setup is like that

-> "Home1" windows desktop machine with SSH server

-> "HOME" router with opened port to "Home1" SSH server

-> internet

-> "REMOTE" router with port opened to SSH server to "Remote1"

-> "Remote1" on the same LAN as "Remote2"

-> Http Server on port 1080 on "Remote1"

-> Http Server on port 80 on "Remote2"

-> Empty IPTABLE and policy set to ACCEPT on "Remote1"

what is working right now :

  • i can connect to SSH console on "Remote1"

  • launch reverse SSH tunneling from "Remote1" To "Home1" -> ssh -fN -R 1080:localhost:1080 user@HOMEIP

  • i can acces "Remote1" http server from "Home1" by typing in my browser

SO FAR everything is OK

but if i try to do

ssh -fN -R 80:localhost:80 user@HOMEIP


iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination
iptables -t nat -A POSTROUTING -j MASQUERADE

i can never get acces to "Remote2" http server

i get an error on the "Remote1" console everytime i try to acces it thru my browser on "Home1"

connect_to localhost port 80: failed.

i am sure that "Remote2" is up and running , because it is actually my ISP router and i want to acces it to open new ports (interface acces is only possible from LAN and locked from WAN) (i have 3 hours of road to "REMOTE" and no one on site for weeks)

also tried many permutation of different settings and nothing seem to work



1 Answer 1


Connection to remote2 is in fact working , but it appear that there is a HTTPS certificate problem , did not find how to fix it , but i think this is not related to the original question

  • Welcome to the community. Please check the Asking and Answering -sections in the Help. SE communities aren't discussion forums, Answers are strictly for providing answers to questions (yes, you can answer your own too if you find a solution). As this is a separate issue you should delete the answer and ask another question. Please include relevant details of your system / setup. You can also refer to this question in the new one. Feb 5, 2023 at 14:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .