I have a toaster system that does one thing. I'm looking to provide some network troubleshooting ability to the extremely stripped Linux OS by providing the 'dig' command. However, it appears that 'dig' is only available via the 'bind' package.

My questions is: has anyone ever successfully buildt a dig binary without all of the 'bind' cruft? Is this even possible?

I don't want a DNS server, I just want the ability to perform some simple 'dig' lookups.

Any thoughts?

Dani AI

Generated

Short answer: you don’t need a full BIND server just to do queries — you can either build the BIND utilities only (as suggested), or pick a much smaller, standalone client that gives you dig-like queries without the server baggage. dig itself is distributed with ISC BIND. (ftp.arnes.si)

Two practical, smaller alternatives to consider are drill (from the ldns project) and kdig (from the Knot project). drill was designed as a modern, compact replacement for dig and includes DNSSEC support if you want it. (nlnetlabs.nl) kdig is an advanced lookup tool that also supports modern transports (DoT/DoH) and is packaged separately as knot-utils on many distros. (knot-dns.cz)

Quick workflow that works well for tiny systems (build on a dev box, ship only the binary + needed libs):

  • Pick the client (drill or kdig) and build it on your dev machine (both provide standard ./configure && make flows). (github.com)
  • Check runtime deps with ldd /path/to/binary, strip the binary (strip), and copy it plus any required .so files to the target. Example sanity checks:
    ldd /usr/local/bin/drill
    strip /usr/local/bin/drill
    scp /usr/local/bin/drill root@toaster:/usr/bin/

Cautions: building fully static binaries with glibc can bite you (NSS / resolver and other features often require dynamic modules), so if you need a single static binary consider building against musl or accept shipping a few .so files. (gnu.org)

If you need exact dig output/flags for scripts, compile the BIND utilities only and install the dig binary — that works and gives full compatibility, but it’s heavier than drill/kdig. For a tiny network-troubleshooter on a toaster-like appliance, drill (small, DNSSEC-capable) or kdig (feature-rich, modern transports) are typically the easiest, smallest wins. (nlnetlabs.nl)

Recommended Answers

All 2 Replies

Hi Hummdis,
Yes it can be done.
Assuming that you have an environment where you can compile specific to your extremely stripped LINUX OS, you can follow the instructions provided in the link - compiling bind utilities.
I have done this before and it works :)
Use the version that suits your environment.

Thanks abhisek!

I have a dev system that contains all of the compilation packages. The things are compiled and tested there before it's moved to the production server.

I just wanted to make sure this is possible before I embark on a three-hour-tour to find that it can't be done.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.