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:
- Berry powers on
- Berry request ip number on the network.
- Some DHCP server replies with a ip number
- Berry now has an address on the network usually 192.168.0.xxx
- Berry sends message to the name-server out there on the big internet.
- Name-sever updates its DNS record for berry.zzz.zz
- Some other computer (Conny) on the same network want to connect to berry
- Betty ask the DNS server for berry.zzz.zz (is it would if it connected to stackexchange.com)
- DNS relies the request out there on the net and replies with the ip-number of Berry.
- 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.