Re: converting a hostname to an IP address
13.08.2011 15:31, Otavio Salvador wrote:
> On Mon, Aug 8, 2011 at 08:50, Wouter Verhelst <wouter@debian.org> wrote:
>> As such, I'd need to a name lookup of the servername the user provided
>> me with, preferably in a shell command, so that when root-on-NBD is
>> used, I can provide the user with a working command line (i.e., an
>> nbdroot= parameter that specifies the server by IP address, not
>> hostname).
>
> I am not aware of any easy way for doing that but I'd suggest you to
> take a look in BusyBox to see what it can offer you to solve this.
>
Actually, there's no tool to query DNS information from a script.
People tried to use host(1) but its output have to be parsed and
it is inconsistent, too. I wrote dnsget utility exactly for this
purpose - to be able to query DNS information from a script, and
to be able to do DNS debugging more easily -- it is part of UDNS
software, http://www.corpit.ru/mjt/udns.html . It is not packaged
for Debian.
If you _only_ need hostname-to-ip-address translation, like it looks
like you do, -- yes, a tool like getent should be sufficient. But
busybox does not provide such applet (yet).
But really, what's up with in-kernel DNS client these days, shouldn't
kernel be able to perform such translation automatically?
Thanks,
/mjt
Reply to: