[DNSOP] Unexpected behaviour of dig +trace

Florian Streibelt <florian@inet.tu-berlin.de> Wed, 26 March 2014 09:22 UTC

Return-Path: <florian@inet.tu-berlin.de>
X-Original-To: dnsop@ietfa.amsl.com
Delivered-To: dnsop@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 328921A01FF for <dnsop@ietfa.amsl.com>; Wed, 26 Mar 2014 02:22:37 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.338
X-Spam-Level:
X-Spam-Status: No, score=0.338 tagged_above=-999 required=5 tests=[BAYES_40=-0.001, HELO_EQ_DE=0.35, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id At077On4pT3n for <dnsop@ietfa.amsl.com>; Wed, 26 Mar 2014 02:22:33 -0700 (PDT)
Received: from mail.net.t-labs.tu-berlin.de (mail.net.t-labs.tu-berlin.de [IPv6:2001:470:96b9:4:130:149:220:252]) by ietfa.amsl.com (Postfix) with ESMTP id 3CE681A010C for <dnsop@ietf.org>; Wed, 26 Mar 2014 02:22:32 -0700 (PDT)
Received: from inet.tu-berlin.de (garfield.net.t-labs.tu-berlin.de [130.149.220.74]) by mail.net.t-labs.tu-berlin.de (Postfix) with ESMTPSA id DCD5E802E7 for <dnsop@ietf.org>; Wed, 26 Mar 2014 10:22:28 +0100 (CET)
Date: Wed, 26 Mar 2014 10:22:27 +0100
From: Florian Streibelt <florian@inet.tu-berlin.de>
To: dnsop@ietf.org
Message-ID: <20140326092227.GA6898@inet.tu-berlin.de>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="9amGYk9869ThD9tj"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
Archived-At: http://mailarchive.ietf.org/arch/msg/dnsop/g441rwmmz02XisoFpLsNY_IbGxA
Subject: [DNSOP] Unexpected behaviour of dig +trace
X-BeenThere: dnsop@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: IETF DNSOP WG mailing list <dnsop.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/dnsop>, <mailto:dnsop-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/dnsop/>
List-Post: <mailto:dnsop@ietf.org>
List-Help: <mailto:dnsop-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/dnsop>, <mailto:dnsop-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 26 Mar 2014 09:22:37 -0000

Hello DNS ops,

last week I discovered something that I personally would consider a bug in
binds dig utility, at least the behaviour was unexpected for me.

Summary: too many dns requests, using the system resolver although told
otherwise.

My question now is: bug or feature?


Currently I am implementing a little testbed that simulates the DNS
hiererchy, including root servers, TLD servers and so on.

I thought it would be nice to let the dig utility show me the delegations it 
follows when resolving www.example.org in my testbed, using the +trace option, 
and starting by one of the simulated rootservers. Like so:


$ dig +trace www.example.org @10.1.1.1

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> +trace www.example.org @10.1.1.1
;; global options: +cmd
.           2   IN  NS  a.root-servers.net.
.           2   IN  NS  a.root-servers.net.
;; Received 77 bytes from 10.1.1.1#53(10.1.1.1) in 5 ms

org.            172800  IN  NS  d0.org.afilias-nst.org.
org.            172800  IN  NS  b2.org.afilias-nst.org.
org.            172800  IN  NS  b0.org.afilias-nst.org.
org.            172800  IN  NS  c0.org.afilias-nst.info.
org.            172800  IN  NS  a2.org.afilias-nst.info.
org.            172800  IN  NS  a0.org.afilias-nst.info.
;; Received 435 bytes from 198.41.0.4#53(198.41.0.4) in 188 ms

example.org.        86400   IN  NS  a.iana-servers.net.
example.org.        86400   IN  NS  b.iana-servers.net.
;; Received 81 bytes from 199.19.56.1#53(199.19.56.1) in 186 ms

www.example.org.    86400   IN  A   93.184.216.119
example.org.        172800  IN  NS  b.iana-servers.net.
example.org.        172800  IN  NS  a.iana-servers.net.
;; Received 185 bytes from 199.43.133.53#53(199.43.133.53) in 192 ms



As you can see, immedeately after the first lookup the dig utility leaves my
testbed, which consists of a simulated 10/8,  and runs right off the Internet.


The reason is that dig uses the system resolver from resolv.conf for all but
the initial query and the direct queries to the authoritative servers.


This can easily by validated when you look at a pcap trace from something like

$ dig +trace www.tu-berlin.de @198.41.0.4

or 

$ dig +trace -4 www.tu-berlin.de @198.41.0.4

For reference I attached a plot generated by wireshark for the second command,
limiting the packet count from 94 to 52 packets.


cheers,
  Florian



-- 
Florian Streibelt, Dipl.-Inf.        building MAR, 4th floor, room 4.004
Fachgebiet INET - Sekr. MAR 4-4          phone: +49 30 314 757 33
Technische Universität Berlin           gpg-fp: 5BE7 F008 8B83 9357 1108
Marchstrasse 23 - 10587 Berlin                  984A 3B8E A41F 82F6 1240