I have used dnsmasq to provide local dns services in my home network and it is also known to be able to serve way beyond 1000 hosts. Dnsmasq will serve names from the /etc/hosts file, provide dns-caching and it also contains a dhcp server. The dhcp part is disabled by default.
On Debian the installation procedure goes like this:
apt-get install dnsmasq
Dnsmasq will per default ask the nameservers in resolv.conf if it's own cache or the local hosts file lacks a suitable entry.
I also use dnsmasq at work to provide dns-caching and it's effect is very noticeable.
I would choose a consistent approach across the entire environment. Both solutions work fine and will remain compatible with most applications. There is a difference in manageability, though.
I go with the short name as the HOSTNAME setting, and set the FQDN as the first column in /etc/hosts
for the server's IP, followed by the short name.
I have not encountered many software packages that enforce or display a preference between the two. I find the short name to be cleaner for some applications, specifically logging. Maybe I've been unlucky in seeing internal domains like server.northside.chicago.rizzomanufacturing.com
. Who wants to see that in the logs or a shell prompt?
Sometimes, I'm involved in company acquisitions or restructuring where internal domains and/or subdomains change. I like using the short hostname in these cases because logging, kickstarts, printing, systems monitoring, etc. do not need full reconfiguration to account for the new domain names.
A typical RHEL/CentOS server setup for a server named "rizzo" with internal domain "ifp.com", would look like:
/etc/sysconfig/network:
HOSTNAME=rizzo
...
-
/etc/hosts:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.16.100.13 rizzo.ifp.com rizzo
-
[root@rizzo ~]# hostname
rizzo
-
/var/log/messages snippet:
Dec 15 10:10:13 rizzo proftpd[19675]: 172.16.100.13 (::ffff:206.15.236.182[::ffff:206.15.236.182]) - Preparing to
chroot to directory '/app/upload/GREEK'
Dec 15 10:10:51 rizzo proftpd[20660]: 172.16.100.13 (::ffff:12.28.170.2[::ffff:12.28.170.2]) - FTP session opened.
Dec 15 10:10:51 rizzo proftpd[20660]: 172.16.100.13 (::ffff:12.28.170.2[::ffff:12.28.170.2]) - Preparing to chroot
to directory '/app/upload/ftp/SRRID'
Best Answer
There are a couple of mechanisms that could be at work here.
Firstly, a system will often include its locally-configured hostname as a DHCP Client Identifier, and the router (which is also the DHCP and DNS server) will dynamically add a DNS record for that client ID matching the IP it gave out for that request.
The other likely case is that the system is advertizing it's locally-configured hostname using Multicast DNS Service Discovery (via Bonjour services on macOS, or the avahi daemon on Linux), and many modern distros include mDNS in their NSS lookup chain by default.