DNS Resolution Everywhere
Notes
| 2021-08-10
(updated 2025-10-25)
| 1 min read
#container
#dns
#linux
#sysadmin
Usually at least one of those is present on any system
- dig
- nslookup
- host
But sometimes the usual suspects don’t work, especially in container-land. After trying them you may try some more involved/unknown things:
getent
Part of glibc, this will probably work on nearly every system.
getent hosts example.org
Or, if you specifically want to query A or AAAA records.
getent ahostsv4 example.org
getent ahostsv6 example.org
Using Python2 Or Python3
Given this depends on glibc it is more of a alternative then another real solution.