Considering that I'm in a LAN that assigns IP addresses using DHCP (and that I'm not its administrator), how do I set things up such that when I ping <hostname> (instead of ping <IP address>, I do get something back, without having added the match in "/etc/hostname")? Would I need to do this change in separate places for the web- and for ssh-server?

I'm wondering because I think there was a time when I could do this without any fiddling with "/etc/hosts" (or am I mistaken?). The problem with that file is that I would have to do it on every client that wants to use the name-to-IP mapping, and to have to continually change it if some IP address changes.

The question really is: is there's a tool that can do network discovery of hostnames (matched to their IP addresses of course).

Another, older method is NIS server. But these are not very common any more. You can try ypcat hosts and see if that returns you something.

Another is zeroconf, where hosts that support it broadcast their name and you can run a service that caches them (the Avahi package does this. If you have it set up then a ping <hostname>.local may work for you already. But not every node will support this either. you can also try querying with the avahi tools: avahi-resolve-host-name <hostname>.local and writing a script that updates /etc/hosts for you if the normal resolver doesn't work.

So there is no other "magic" place to get host names from. Somebody is going to have to define that mapping, or make it dynamically discoverable. If your sysadmin did not or will not, then you have to do it. And the only place you can do it for your local machine is the /etc/hosts file. So if none of the above methods work then you're stuck with that. Sorry.

Were you perhaps thinking of zeroconf? Zeroconf is a suite of protocols to establish an IP link between two or more machines and discover services. Unfortunately, there are several name resolution protocols in the zeroconf realm, so its goal of being completely cross-platform is not fully realized. But if all machines run the same operating system, this isn't a problem. The primary target use case of zeroconf is two machines connected by a crossover cable, but it also works on a local switched network.

The most common implementation of zeroconf on Linux is Avahi. On Debian or Ubuntu, installing the avahi-daemon package should be enough to get going. Other packages may be useful as well (in particular avahi-autoipd if you want to negotiate IP addresses in a network that isn't running a DHCP server, avahi-discover to view available services).