I was exploring ssh and was trying to log into my pc from my phone, i'm on mac by the way.
i activated the ssh server on my mac, and i logged into it with my phone in the same LAN, by entering my mac local ip address.
Now i was figuring out a way to connect from remote, since in that case i can't put my mac local address.
I set up a port forwarding rule in my router, to forward everything that arrives to my public ip on port 22 to my mac, then i tried to ssh into my pc using the public ip...
It doesn't work the connection is refused, it yield error 1005 or something like that.
What am i missing exactly?
I couldn't find another answer to this question.

EDIT:My router is a Home&Life model by wind 3..it is italian so i don't think anybody in here is familiar with it.
Just so you guys know, i tried to do the same with a simple node server, i can access it with my public ip, if i make a port forwarding rule.

  • Welcome on U&L! Some routers require you to separately set up port forwarding and corresponding firewall rules. Mentioning your router model in your question may be of help.
    – fra-san
    Commented Sep 9, 2020 at 15:06
  • i edited it in.
    – Adonai
    Commented Sep 9, 2020 at 16:39

4 Answers 4


If you are testing from inside the network it is likely that your router does not support NAT loopback. If you test off mobile data/4G and same result I'd check if there is a firewall rule blocking on the router (Most have separate NAT/port forwarding and firewall configuration sections).

Also to double check your public IP visit a site like https://www.whatsmyip.org

  • the ip matches perfectly, and so does the username... I asked a friend of mine to try to ssh into my pc from remote, and it doesn't work as well. I'll check in the firewall section of my router. In case that's the problem, would changing the ssh port solve the problem?
    – Adonai
    Commented Sep 9, 2020 at 13:09

My ISP (in Brazil) deny all traffic on port 22 for the residential plan, only the commercial plan (more expensive and with fixed ip) allow traffic on the port 22 and others.

Not sure if it is your case, but since the node server works, try changing from port 22 to another one like 5555, or 5656. Is good to not use default ssh port as well.

  • mmm...i was thinking about that, but changing the default port entails modifying some configuration file, i don't want to mess up things xD. I'll take a look
    – Adonai
    Commented Sep 9, 2020 at 17:38

Check your ISP, which ports are open from outside, try to check with check open port and also now some ISP not give you a real public IP4


Depending on your hardware (using the router provided by your ISP ?), you may also have to check the firewall settings. Some factory presets ("Secure", "High filtering", ...) deny all entering connections, no matter the NAT settings.

You must log in to answer this question.

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