[sf-lug] SFLUG.org ...

Rick Moen rick at linuxmafia.com
Sat Apr 13 02:36:04 PDT 2019


Quoting Michael Paoli (Michael.Paoli at cal.berkeley.edu):

> We can be clever:
> $ (for d in $(whois sf-lug.org | sed -ne '/^Name Server: /!d;s/^Name
> Server: *//;s/.*/\L&/;s/[^\.]$/&./;p'); do echo "$d" $(dig +short
> "$d" A "$d" AAAA); done)
> ns1.linuxmafia.com. 198.144.195.186
> ns.primate.net. 198.144.194.12 2001:470:1f04:51a::2
> ns1.svlug.org. 64.62.190.98 2600:3c01::f03c:91ff:fe96:e78e
> ns1.sf-lug.org. 198.144.194.238 2001:470:1f04:19e::2
> $

I don't knock what works, even if that _is_ ugly as sin, and the sed
stuff looks more than usual like a picket fence that fell over onto some
tumbleweeds.  I'll be taking it apart, and thanks for the (I assume)
working incantation.

What I was stumped by was why this sort of thing fails:

$ whois sf-lug.org | grep 'Name Server' | awk '{print $3}' | xargs -L 1 host

Strip the last pipe, and the output's certainly correct:

$ whois sf-lug.org | grep 'Name Server' | awk '{print $3}'
NS1.LINUXMAFIA.COM
NS.PRIMATE.NET
NS1.SVLUG.ORG
NS1.SF-LUG.ORG
$

(I like to build up shell incantations that way, so each addition is 
self-explanatory and easy to check.)

I tried redirecting that to temp work file /tmp/ns, and then various
kludges to get host(1) read that from stdin, and couldn't seem to make
that function -- before needing to cut bait because this was taking too
long.  Always, the host(1) invocation returns 'not found: 3(NXDOMAIN)',
and my best guess is there's some weirdness involving quoting and
subshells -- which is a good guess in shell scripting at the best of
times.

> Minimum "required" nameservers (per RFC) is 3, max recommended is ...
> I think (typically) 7 - though it also depends slightly on length of some
> of the bits of DNS data (e.g. root (.) is a very special case - absolute
> shortest of names, so there's more room for NS data in a single 512 byte
> UDP packet).

It's RFC-2182 section 5, FWIW (min 3, max 7).




More information about the sf-lug mailing list