1

I followed this tutorial on how to setup a static ip on my Raspberry Pi.

I can now successfully ping my Raspberry Pi from my Mac, but when I try to ssh like so:

ping [ip]
sudo ssh pi@[ip]

I get the error:

ssh: connect to host [ip] port 22: Operation timed out

Looking at similar questions I noticed them saying things about port forwarding. I don't have access to my apartments router or anything, but shouldn't I still be able to do it locally then?

2
  • are you sure there's SSHD running on your Pi? what distribution are you using? you may connect TV/keyboard to check and amend your configuration to allow sshd to run.
    – lenik
    Commented Oct 31, 2013 at 8:49
  • the range 192.x.x.x is a private range and not used on the internet. You would need a static IP on your Internet or use DynDNS like I mentioned.
    – Piotr Kula
    Commented Oct 31, 2013 at 9:00

2 Answers 2

1

Even though you setup a static IP on your Pi you will still need to forward the default port 22 to the Pi, on your Router.

After you have forwarded it you will then need to know the IP of your home internet connection. Most of the time they are dynamic and change as defined by the ISP. You can overcome this by setting up dynamic dns on the Pi.

My favuoritre free DynDNS provider is no-ip but any one will work the same. Install the client to update your IP to the DNS record.

sudo apt-get install ddclient

Then go and edit the configuration file .

#
# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf
daemon=60                          # check every 60 seconds
syslog=yes                         # log update msgs to syslog
mail=root                          # mail all msgs to root
mail-failure=root                  # mail failed update msgs to root
pid=/var/run/ddclient.pid          # record PID in file.
ssl=yes                            # use ssl-support.
use=web, web=dynupdate.no-ip.com   # get ip from server.
server=pi.no-ip.org                # Your DNS
login=                   # your login
password=                # your password
server=www.no-ip.com,    \
protocol=dyndns2          \
YOUR-DOMAIN

Then at work or anywhere else in the world you can connect to your Pi over ssh using the DNS you have selected.

sudo ssh pi@[mypi.no-ip.org]
3
  • I don't have access to my router directly, because I live in an apartment complex. I can't setup portforwarding because resources like portforwarding.com require a lot of information on it.
    – Tom Prats
    Commented Nov 2, 2013 at 18:41
  • That makes it allot more complicated then. Doing it easily will not work then. You will need a server on the internet and then create a SSH Reverse tunnel and it become pretty complicated. Without router access there is not much you can do without complex solutions
    – Piotr Kula
    Commented Nov 4, 2013 at 9:14
  • raspberrypi.stackexchange.com/questions/10422/… - You can read that on how to reverse tunnel.
    – Piotr Kula
    Commented Nov 4, 2013 at 11:21
0

Happened with me too, try

ssh [email protected]

if the hostname of your Pi is raspberrypi or replace it with the hostname of your Pi.

2
  • This happened like 6 years ago
    – Tom Prats
    Commented Jan 19, 2017 at 14:13
  • @TMP :P sorry, I am new here was just looking around.
    – Rattle
    Commented Jan 19, 2017 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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