0

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.

2
  • 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
    Sep 9 '20 at 15:06
  • i edited it in.
    – Adonai
    Sep 9 '20 at 16:39
1

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.

1
  • 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
    Sep 9 '20 at 17:38
1

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

1
  • 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
    Sep 9 '20 at 13:09
0

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

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.