Networking Hostnames – Multiple Hosts with the Same Hostname on the Same Network

hostnamenetworking

Hypothetical situation: I have two (Linux) computers on the same network with the same hostname, but different FQDNs (foo.example.com and foo.example.org).

They have different MAC addresses, and get their IP addresses from a DHCP server.

What problems is this likely to cause, if any? In particular, there's no DNS in this network, and IP addresses are looked up from /etc/hosts and the Windows equivalent. Can /etc/hosts contain multiple entries with the same alias, or should I just omit the alias?

Best Answer

There is no a priori technical problem with several or even every stand-alone system in your network using the same hostname to refer to itself. They can even all use the same FQDN to refer to themselves. There is even a reserved hostname for that, localhost and you frequently see localhost.localdomain and variations as well, but feel free to name all your systems foo.example.com.

Problems can and most likely will arise when your systems are not completely stand-alone and belong to the same management domain.

Many tooling requires that hosts have unique hostnames and will look only at the hostname component of the FQDN. As far as I know that is for example the case when hosts want to join an Active Directory domain.

The moment you introduce the human operator in the mix, well... Others are probably more detail oriented than I am, but I will most likely confuse this foo with that foo and will frequently patch, reboot, power off the wrong systems in your network.