0

I am using this command to port forward in my local machine:

ssh -L 3409:0.0.0.0:3309 -N -f [email protected]

after run this command, I could connect remote 80.110.35.85 successfully. But when I using another PC in the same local network, it tell me connection refused. This make me confusing, why did this happen? is it possible to using the port 3409 on other computer in the same local network?

2
  • Note 0.0.0.0 in your code has nothing to do with the listening end. If you did -L 0.0.0.0:3409:0.0.0.0:3309 then the first 0.0.0.0 would. Frankly I have never thought of using 0.0.0.0 as destination. 127.0.0.1 as destination? -- yes. Commented Jun 11, 2021 at 10:32
  • Please edit your question to show exactly what happens when you try "sing another PC in the same local network". What command are you running, or how did you configure the software that's failing, and how exactly does it fail. Tell us the exact error message.
    – Kenster
    Commented Jun 11, 2021 at 11:31

2 Answers 2

3

On the machine that is supposed to share the port with other hosts on the LAN, enable Gateway Ports in the /etc/ssh/sshd_conf and restart sshd service.

GatewayPort yes
1
  • Thanks for sharing! This is really-really useful! Commented Feb 4, 2023 at 12:12
1

Try the following. It should work from your local machine as well as any other machine that can reach your local machine in your network as long as you don't have any firewall on your local machine preventing port 3409.

ssh -L *:3409:80.110.35.85:3309 -N -f [email protected]

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