What would be the preferred way to make the raspberry pi respond to hostname.local?

For example on a raspberry pi which hostname is set to berry :

ssh pi@berry.local

This would be to make it available by name to all computers (Mac OS/linux) in the network. I would like it to work directly on all the similar networks I bring it to.

  • Please provide more information. Do you want your pi to he accessible from only your dev machine or from all pcs on connected to the network? Jan 15 '14 at 23:01
  • @DaGhostmanDimitrov : added "make it available by name to all computers (Mac OS/linux) in the network"
    – Coyote
    Jan 16 '14 at 7:11
  • possible duplicate of Rpi not reachable via its hostname in LAN Jul 4 '14 at 10:29

For berry.local to work, you need to either have avahi running, so that the name is resolved via mDNS, or your router must have appropriate host entries and a default local domain which is searched. The avahi approach is probably the least trouble, and is also needed if you want to use shairport or other zeroconf services.


avahi does this, and it's on by default on Raspbian.

If you're on Windows you need to install an external service to handle doing the lookups. Appe's Bonjour Print Services comes with mDNSResponser.exe, which works for this purpose (even though you're not using it for printing).


The best way of getting your Pi into the network DNS is going to depend on the details of the environment where you're trying to access it. There are several approaches:

  • As others have suggested, using avahi will allow the Pi to broadcast it's name and the services it offers to other systems. The advantage is, you can configure everything on the Pi. Disadvantage is, all the others systems on your network need to be running a compatible DNS system.
  • If there's only one other computer involved, you could add berry.local to the hosts file. (Or known_hosts, if applicable.)
  • If you have a router which supplies DNS to your network, you may also have the option of configuring the router to resolve the name.

You need an entry in ~/.ssh/known_hosts (on the machine you are running ssh)

Try logging on as:- https://raspberrypi.stackexchange.com/a/11853/8697


To make this work on any network with any computer You need to use a real domain, sorry. But all the other solutions (Avahi/hostfile...) requires setup of the other machines.

I also like to connect to my machines on my network by name. So i have bought a domain-name (quite cheap now a days), and setup dyndns.

First Let me stress that just because the domain-name is available from the internet, this does NOT make your device available on the internet.

When my device boots up it gets a IP-number from the local DHCP server (usually build into the router/modem), this is standard behavior and this is probably how your raspbarry already works.

But i added a little script that sends a message to the name-server that host my domain-name (I use gratisdns.dk), with the new ip-address, and the DNS record is updated.

While you cannot use berry.local, but have to use something like berry.fancyname.eu, it still fulfills your purpose, also if you connect at another network.

The verbose version of the procedure:

  1. Berry powers on
  2. Berry request ip number on the network.
  3. Some DHCP server replies with a ip number
  4. Berry now has an address on the network usually 192.168.0.xxx
  5. Berry sends message to the name-server out there on the big internet.
  6. Name-sever updates its DNS record for berry.zzz.zz
  7. Some other computer (Conny) on the same network want to connect to berry
  8. Betty ask the DNS server for berry.zzz.zz (is it would if it connected to stackexchange.com)
  9. DNS relies the request out there on the net and replies with the ip-number of Berry.
  10. betty can now connect to berry.

So any computer on the same network as berry, that can connect to any website out there can now also connect to berry.

  • Thanks for the lengthy answer. But what I need to accomplish is this zeroconf dark magic (I can't add the zeroconf tag due to rep): when I bring my raspberry pi somewhere I want to be able to connect it to the network and directly have access to it on the current network, not from the internet. I'm sorry if my post is not clear about that... I have my domain names setup properly on my servers and all the relevant hosts... DNS is something I understand but I don't want to rely on my DNS servers to do things that can be solved on the local network.
    – Coyote
    Jan 18 '14 at 0:59
  • As I did stress this does NOT give access from the internet. The ip address thas is recieved for berry is an internal ip address, it is correct that whith this setup I can fetch the ip address from anywhere on the net, but i cannot access berry, just as You can't access my PC just because i tell you that it has the ip And zeroconf and others limits you to only connect to where the other devices is setup with zeroconf.
    – Otzen
    Jan 18 '14 at 1:20
  • I understand that computers on the private IP range aren't accessible from the internet. I want to solely rely on the local network wherever it is connected to the internet or not (as it's the case at my parents' office).
    – Coyote
    Jan 18 '14 at 11:42

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.