My RPi is running Raspbian. I am trying to get SSH set up.

I followed these steps to get a static IP on my Pi:

  1. Since my PC was connected to the LAN via WiFi, I used ipconfig to get the IP address, gateway, etc. of my WLAN card
  2. I used this data to set up a static IP in Raspbian, changing the IP address of course.

ifconfig confirms that I have set up the static IP correctly.

I have tried to connect to the Pi using PuTTY on my Windows 7 PC. PuTTY throws the following error message:

connection timed out when connecting

Additionally, when I tried to ping the Pi's static IP address, I didn't get any reply from RPi, instead getting "connection timed out".

Was copying the information from my working PC the wrong thing to do? How can I fix this and get working SSH on my Pi?

  • A timeout when connecting or a timeout after a while when connected? Jul 7, 2013 at 10:33
  • timedout when connecting
    – nbsrujan
    Jul 7, 2013 at 10:51
  • Does it happen to be behind a router that does some port forwarding for you? Maybe your ssh port (usually 22) is not forwarded. Jul 7, 2013 at 11:10
  • Do you have a firewall on your Windows PC that is blocking SSH ?
    – Lawrence
    Jul 8, 2013 at 1:24
  • @Lawrence I have also checked Firewall options. It looked fine. Is there any specific way to enable firewall to allow SSH connection? I will try disabling firewall again.
    – nbsrujan
    Jul 8, 2013 at 7:48

5 Answers 5


A couple of things to try:

  1. Are you able to ping the Raspberry Pi from the windows machine, open a command prompt and enter ping (but with the IP address you are using for SSH), if you get replies the connection is good, if not there is a networking problem preventing SSH working
  2. Did you set-up SSH using raspi-config, or did you set it up yourself, if you set it up yourself can you tell us how (there may be a set-up issue with SSH)
  3. Can you log in to SSH from the Raspberry Pi itself, use ssh (actually use, if this does not work then it is likely that SSH is not set-up correctly, the error may give a clue to the problem.
  4. Can you now try to log in to SSH from the Raspberry Pi itself, but this time use the actual address and port ssh -p 22 (but with the IP address you are using for SSH), if this does not work it may point to a problem with the firewall on Linux, or that SSH is set-up to only use certain connections or a different port number
  5. If all of the above work fine then it is probably something like a firewall problem with the router, it may help to try some different port numbers

To add extra port numbers do the following:

  • Backup the SSH configuration using sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.old
  • Edit the SSH configuration using sudo nano /etc/ssh/sshd_config
  • Look for the line that says Port 22
  • Add some additional lines below with some other port numbers, I would suggest a different well-known number, e.g. Port 80, and a largish number, e.g. Port 55555
  • Restart the SSH service using sudo /etc/init.d/ssh restart
  • Try using putty with each number you added in turn, in my case 80 does not work because we have a web server the router forwards to, but 55555 worked fine

Hopefully something here helps, let us know what happens

  • Sir, thanks a lot. Adding extra ports really really helped me a lot. I was stuck with SSH from 2 weeks. Another problem with my RPi could be DNS server address in RPi and PC are not same. This also could be a reason :)
    – nbsrujan
    Jul 10, 2013 at 16:34
  • Changing the ssh port solved the problem. Thanks for the answer.
    – BenRoe
    Jan 24, 2015 at 16:42
  • I can connect to myself, but no matter what I do I cannot connect with Putty, while I can ping my pi IP adress without any problem. What could be the problem? Could it be that my router is blocking somehow this connection?
    – saldenisov
    Jul 8, 2017 at 13:32
  • I have the same exact problem. This is the code I get: Jun 5, 2018 at 13:44

Since your Raspberry Pi is directly connected to your PC you should choose static IPs in a network different from your WIFI network otherwise Windows will probably try to use the WIFI interface to access the RPi.

For example if your WIFI network is 192.168.0.xxx use 10.2.2.xx for the RPi and the wired interface on your PC.

Configure the Rpi with (netmask or /24) and the PC with (also netmask) on the wired interface. You should be able to ssh from your PC to

Be aware that the Raspberry Pi will not be able to access the internet unless you configure windows as a gateway which is out of scope for this answer.


It is possible that Raspi can kick me out of putty and session if is it is too far away from router and the signal level is under 20%.

My opinion is this: Raspberry needs a good signal level, because if the signal level is low the Raspberry disconects from the wifi network (sometimes I can see it connected, sometimes not, but when I log in and want to start script ... it's over and raspberry disconect from network).


After verifying the RaspberryPi's ip address (ifconfig), and setting my PC's ip address to a static one, I kept getting a timeout when I pinged "ping raspberrypi.local". The most important thing I forgot was to be sure that whatever my RaspberryPi's ip address is ( that my PC's static ip is similar (ex.,!!!! This will enable you to connect.


In my case the answer was a high traffic of transmission torrent client on the desktop.

If anybody else has the same problem first check your network speed.

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