If your router doesn't resolve local hostnames and you don't want to use dnsmasq, read on:
1. Load avahi-2.7 and start the avahi daemon.
2. Modify /etc/nsswitch as follows:
hosts: files [before]
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 [after]
3. [Due to a bug in avahi]:
$ sudo ln -s /var/run/avahi-daemon/* /usr/local/var/run/avahi-daemon
..and now, by adding .local to the hostname, you can ping devices on the local network using their hostname rather than their ip address.
Note that in same cases, avahi will find hostnames of devices that seem to be missed by dnsmasq, eg:
$ avahi-resolve -a 192.168.1.107
$ ping -c1 juanitos-iPhone.local
PING juanitos-iPhone.local (192.168.1.107): 56 data bytes
64 bytes from 192.168.1.107: seq=1 ttl=64 time=27.342 ms
Edit: I thought this would require multicast to be enabled in the kernel, but that doesn't appear to be neccessary