I have a pi in my local network, and I sometimes want to connect to it via ssh. However, the pi always has a different IP-address, so I look it up beforehand each and every time. Is there a way for me to connect to my pi without looking up it's IP address? I could assign a static IP in my local network, but I'm not sure if that's good practice or whether there are better solutions. If there aren't, it would be great if s.b. could explain how to assign a static IP to my pi in my local network. Thanks a lot in advance.

PS: I am looking to connect to my pi via ssh programmatically. So a software solution that finds the IP address might not do.


2 Answers 2


I don't know if you've changed some settings on your Pi or not, but recent "stock" Raspbian will have the Avahi service installed & configured for the SSH server. All being well you should be able to say ssh [email protected] from within the local network, where raspberrypi is the hostname you've given your Pi, and connect.

If it's not set up on your Pi then you can follow the instructions on eLinux here to get it working: the Avahi stuff is a little bit further down after the section on assigning a static IP (which you can follow instead if you prefer).


in the terminal : sudo raspi-config then with 'N1 hostname' give the name you want to your pi : mypi reboot then you can connect in ssh with : ssh [email protected]

  • @R.Kohlisch An unmodified Raspbian image comes with hostname raspberrypi. Why it does not work with ssh [email protected]?
    – Ingo
    Commented Dec 4, 2018 at 23:01

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.