Four years ago, I wrote a tutorial on how to install DNS on your Ubuntu desktop. The tutorial still works and is valid to this day. I recently referred to that article when I installed DNS on a machine running on Ubuntu server. While going through the DNS configuration, I couln’t get the DNS to resolve to hostnames only. It’s working with a fully qualified domain name (FQDN), but not the hostname. So, here’s the simple fix to get the DNS to resolve to hostnames.
ping server # pinging the hostname doesn't work ping: unknown host server ping server.example.com # pinging the FQDN works PING server.example.com (192.168.1.1) 56(84) bytes of data
Edit /etc/resolve.conf and add this to the top of the file.
sudo /etc/init.d/bind9 restart
ping server # now the hostname works