Resolved Once and For All: Fatal Error – Neither Dig Nor Host Nor Drill Nor Nslookup Present

Have you ever executed a command or script on Linux, only to be confronted with this befuddling error message?

Fatal error: Neither "dig", "host", "drill" or "nslookup" present  

As we‘ll cover today, these mysterious-sounding programs are actually very common DNS lookup utilities that many apps rely on under the hood. So when they are missing in action, chaos ensues!

By the end of this guide, you‘ll understand:

  • Purpose of dig, host, drill and nslookup
  • Why the error occurs and what programs it impacts
  • How to install required packages to fix it
  • Best practices for avoiding DNS issues

So whether you‘re a Linux system admin or application developer, bookmark this page as your one-stop-shop for banishing this annoying error!

DNS Lookups – Critical for Apps Big and Small

Before jumping to the error itself, let‘s briefly discuss DNS and why so many applications utilize these lookup tools.

DNS (Domain Name System) is like an old-fashioned phone book for the Internet – translating human-readable domain names like into actual IP addresses that computers use to route traffic.

Without DNS, we‘d be stuck memorizing rows of numbers just to get anywhere online!

There are over 350 million registered domains as of 2022 and growing every minute. As you can imagine, programs across the board leverage purpose-built utilities to query DNS data rather than building custom solutions. Let‘s explore some popular options:

Dig – The Domain Information Groper

  • Part of the industry-standard BIND DNS package
  • Provides lookup results in organized sections
  • Useful for administrators verifying records

Host – Simple DNS Lookup Tool

  • Ships with most UNIX-like systems
  • Easy to use with barebones output
  • Handy for quick checks

Drill – Advanced DNS Analysis

  • Robust tool from NLnet Labs
  • Broad feature set for troubleshooting
  • Generates visual traceroute graphs

Nslookup – Name Server Lookup

  • Enables interactive queries
  • Supports custom DNS servers
  • Administrator favorite

While they have different strengths, these utilities all query DNS in some fashion. Various applications leverage them behind the scenes for IPv4/IPv6 address resolution.

But what happens when those apps expect access to a lookup tool and get…bupkis?

The Root Cause – Missing DNS Utilities

When an application tries resolving a domain name to kick off its workflow, it searches for one of the DNS lookup tools we outlined: dig, host, drill or nslookup.

If the OS returns basically a shrug emoji because none of those programs are actually installed yet, our poor app has no way to get the critical DNS data it requires.

Game over. 😭

So in essence, the error occurs due to DNS lookup utilities being absent on the system. But why would they be missing in the first place?

Most common on:

  • Minimal or customized Linux installations
  • Container images meant to be lightweight
  • Systems undergoing maintenance/upgrades

Apps most susceptible to this issue:

  • Scripts & crons requiring DNS info
  • Network monitors validating uptime
  • Installers needing name services
  • Web servers serving content

And while the error itself seems esoteric initially, the impacts can be far-reaching if you don‘t regain DNS capabilities pronto!

Installing Bind-Utils – Simple & Effective Medicine


Alright it‘s go time! Let‘s finally tackle this error and get DNS lookups functioning again.

On CentOS 7 specifically, we can install a package called bind-utils from the default Yum repos that includes our MIA programs:

$ sudo yum install bind-utils -y

A mere two seconds later, this single command gives us dig, host, drill and nslookup with all their DNS prowess! 💪

We can validate everything is working again by invoking good ole nslookup:

$ nslookup

Non-authoritative answer:

And with that, DNS lookups are back in business! But we‘re not done quite yet my friend…

Beyond Bind-Utils – DNS Resilience Best Practices

While bind-utils solved the immediate error, let‘s discuss some pro tips for avoiding DNS issues more broadly:

Implement Local DNS Caching

  • Reduces external queries for faster performance
  • Enhances availability if nameservers are unreachable
  • Use dnsmasq, bind, unbound

Configure Multiple Nameservers

  • Eliminates single point of failure
  • Continuity if a server goes down
  • Combine public and private for redundancy

Monitor DNS Logs

  • Valuable troubleshooting data
  • Reveals query trends
  • Log analysis with GoAccess etc.

Utilize a Local DNS Server

  • Centralized access control
  • Custom domain rules
  • Views filtered by network

Enable DNSSEC Validation

  • Cryptographic assurance of records
  • Prevents hijacking/spoofing attempts
  • Validation of chain of trust

Following DNS best practices takes a bit more planning, but pays dividends through enhanced stability, speed and security in the long run.

The Circle of Life – From DNS Error to DNS Excellence

In closing, I hope explaining the "neither dig nor drill…" error and its straightforward resolution gave you confidence next time you encounter it. Now you know exactly why it appears and how to get rid of it quickly using bind-utils.

But even more importantly, I want you to consider advanced DNS configuration beyond just a quick fix. Things like running your own cache/server, leveraging DNSSEC, and having redundancy open up amazing possibilities.

You have all the building blocks now for world-class DNS infrastructure – now go forth and build!
Let me know if you have any other questions.