How to fix MikroTik RouterOS v7 SSH port forwarding not working: Connection refused

In multiple models of MikroTik routers running RouterOS v7.5 I got Error: Connection refusedwhen running simple SSH port forwarding commands such as

mikrotik_ssh_forward.sh
ssh [email protected] -L 8080:192.168.178.1:80

but in the RouterLS log I could see multiple local forwarding forbidden error messages:

MikroTik RouterOS log showing local forwarding forbidden error messages for SSH port forwarding

Solution

In this case, the solution was simple: Go to IP -> SSHin WebFig or Winbox and set Forwarding Enabled to **Both**and click Apply.

MikroTik RouterOS IP SSH settings with Forwarding Enabled set to Both **If you have already set Forwarding Enabled to Both or Local,**on one of my routers this setting wasn’t properly activated - possibly after a RoutreOS upgrade. In order to fix this, set Forwarding Enabled to no, click Apply, then set Forwarding Enabled to Both and click Apply again. For me, this fixed the issue of being unable to do SSH port forwarding.


Check out similar posts by category: MikroTik, Networking