Question About nslookup

Kevin Darcy kcd at daimlerchrysler.com
Mon Nov 13 23:17:57 UTC 2000


Sumit Mehrotra wrote:

> A quick question about nslookup. Does it use UDP or TCP by default? If it uses both, under what conditins does it use either kind of socket?

Zone transfers use TCP by default, which affects nslookup's "ls" command, but other than that, nslookup uses UDP by default or can be configured to use TCP ("set vc"). It will also
automatically retry truncated UDP queries with TCP; this is also configurable ("set ignoretc").

> Correspondingly, could someone point me to the portion of BIND code, where the incomingg messages from nslookup are accepted, also what kind of socket does BIND listen on, for requests?

By default, it bind()s to both UDP and TCP port 53, listen()s on the TCP port, does a select(). Like any daemon, basically. Where is the message "accepted"? Depends on what you mean by
"accept". Do you really mean the accept() call? That's TCP-specific, and for BIND 8, is actually done in the event library (see src/lib/isc/ev_connects.c). The lowest-level routine which
handles both TCP and UDP messages is probably dispatch_message(), in src/bin/named/ns_main.c, which is called from both stream_getmsg() and datagram_read() (in the same source file).

What is it exactly that you're trying to do? I suspect that these low-level routines are probably irrelevant. If you're having a problem with *only* TCP or *only* UDP queries, it's usually
something in the network (e.g. a firewall or a router filter) or the nameserver's OS that is to blame.

                                                                                                                                                                - Kevin





More information about the bind-users mailing list