Setting nameserver regardless /etc/resolv.conf

Iñaki Baz Castillo ibc at aliax.net
Thu Apr 14 16:21:23 MSD 2011


2011/4/14 Michael Tokarev <mjt at tls.msk.ru>:
> The only trap that comes to mind is that you didn't export
> NAMESERVERS variable so it's not available in subprocesses.
>
> Check this:
>
> NAMESERVERS=127.0.0.2 dnsget -vv foo.bar
>
> it will tell where it is sending queries to (if nothing is
> listening on 127.0.0.2 it will just time out).
>
> NAMESERVERS=127.0.0.2; dnsget -vv foo.bar
>
> (note the semicolon) -- this will change nothing, dnsget will
> use regular nameservers listed in /etc/resolv.conf.  And this:
>
> export NAMESERVERS=127.0.0.2; dnsget -vv foo.bar
>
> will use 127.0.0.1 agin.


Thanks a lot, it clearly explains how it works.

In my case I've coded a Ruby wrapper for udns:
  https://github.com/ibc/em-udns/
and the way I "try" to set the NAMESERVERS environment variable is
within Ruby code:

  env["NAMESERVERS"] = "xxx.xxx.xxx.xxx"

but obviously this does not work so I must investigate how to do it properly.

Thanks a lot!

-- 
Iñaki Baz Castillo
<ibc at aliax.net>


More information about the udns mailing list