2

I know there is host and dig and all those... but they are DNS tools and they don't query the local resolver library.

/etc/hosts can change what the local resolver returns. The local resolver does caching too. /etc/nsswitch.conf can completely remove DNS from the resolution path...

So it seems wierd that there is no command for checking what the local resolver library has.

I normally do something like this:

export VAR='"nics-acer"'; python -c "import socket; print(socket.gethostbyname($VAR));"

and when I wrote my Python version of resolvconf, I added a switch to test the resolver, but shouldn't there be a reason for there not being a standard tool?

1 Answer 1

12

There is such command: getent.

Try following: getent hosts google.com, getent hosts 8.8.8.8 - it will query using system resolver (see also /etc/nsswitch.conf to check what is actually being queries and in what order).

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .