I followed this guide to create a static IP for my Raspberry Pi running Raspbian Jessie. The static IP is running but my router still lists the old IP address for the Raspberry Pi. I also am no longer able to ssh into my Pi; when I try to ssh using the hostname, the ssh connection times out. On the other hand, when I try to ssh to the static IP, I receive the following error:

Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
<finger print>.
Please contact your system administrator.
Add correct host key in <path to known_hosts file> to get rid of this message.
Offending RSA key in <path to known_hosts file>:21
RSA host key for <raspberry pi static ip> has changed and you have 
requested strict checking.

How do I fix this?


NEVER delete a known_hosts file, because it will wipe out all the seen keys! And a MitM attack against you will be much easier. Open it with text editor and replace/delete *a single string starting with a hostname. After a hostname there's a key, so either update the key or delete just one string and connect to a new key+address pair


You get the warning because you changed the IP address. This is security issue as it could mean you are the subject of a man in the middle attack. To fix the problem you can edit the old entry from the known_hosts file. The file is located in the /home/pi/.ssh directory. You can open it in the editor of your choice and delete its contents.

As for your router seeing the old address that will eventual be removed automatically.

  • is the fact that I can not ssh into the pi using the hostname also a result of the router seeing the old address i.e. will it resolve when the router sees the new static ip address? And how long does that typically take? – Jay Karimi Mar 25 '16 at 5:51
  • If your router only associates the old name with the old address, you won;t be able to use the name without making a change to your hosts file. A search of google for hosts file and your OS will show you how to add an entry for your Pi. As for how long it will take to notice the change I can't say it depends on your router and its configuration. – Steve Robillard Mar 25 '16 at 5:54
  • why would I need to change the hosts file on my laptop; the hostname "raspberrypi" has been configured through the pi's host file using the following tutorial – Jay Karimi Mar 25 '16 at 5:59
  • can you resolve the host name from your laptop? I am betting no, hence why you can reach the box by ip and not by name – Steve Robillard Mar 25 '16 at 6:00
  • prior to the static ip attempts, yes. If I remove the static ip config in /etc/dhcpcd.conf, then my laptop is able to resolve the hostname over ssh again – Jay Karimi Mar 25 '16 at 6:01

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.