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.
The Test
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
The Fix
Edit /etc/resolve.conf and add this to the top of the file.
search example.com.
Restart Bind
sudo /etc/init.d/bind9 restart
Test
ping server <– now the hostname works