Unless you disable it (i.e. by default), Raspbian is running a service called Avahi which responds to mDNS requests in your local network.
By default machines are configured to appear in .local
domain, so a fresh Raspbian will be accessible with raspberrypi.local
from other machines using Avahi. If you change the hostname, it will be reflected in Avahi response.
Machines also by default are configured to strip .local
domain when accessing other ones, so it's usually enough just to access the destination machine by its hostname (like raspberrypi
). Hostnames should be of course kept unique to avoid random connections to one or another.
The Avahi service is enabled by default in macOS (implementation known as Bonjour) and most desktop Linux distributions.
It was not available separately for Windows versions earlier than Windows 10, but came with Apple iTunes (and even if you uninstalled iTunes, chances are Bonjour would still remain installed).
With Windows 10, mDNS seems initially was supported natively, but with bugs, and now at least supported programmatically (some reference). This paragraph is subject to change and clarification.
Unless you have a multi-network configuration, Avahi is enough to get your machines discovered without using IP.
With multi-network configuration (i.e. if you use router between two separate IP networks like 192.168.1.0/24
and 192.168.2.0/24
you can set the router as Avahi reflector (provided it has Avahi running), or you can configure DNS as suggested in ppumkin's answer.