<html><head></head><body><div style="color:#000; background-color:#fff; font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><br><div class="qtdSeparateBR"><br><br></div><div style="display: block;" id="yui_3_16_0_ym19_1_1529573586818_31126" class="yahoo_quoted"><div id="yui_3_16_0_ym19_1_1529573586818_31125" style="font-family: Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"><div id="yui_3_16_0_ym19_1_1529573586818_31124" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"><div id="yui_3_16_0_ym19_1_1529573586818_31123" class="y_msg_container">>On Thu, Jun 21, 2018 at 06:15:30AM +0000, Spon Spon wrote:<br clear="none">>> Hi,<br clear="none">>> I have following configuration of dnsmasq:<br clear="none">>    ...<br clear="none">>> domain-needed<br clear="none">>    ...<br clear="none">>> <br clear="none">>> Because of domain-needed option I expected that host only lookup,<br clear="none">>> without domain part will not forwarded to upstream servers (in my case<br clear="none">>> 192.168.2.1, but this seems it is not the case.<br clear="none">><br clear="none">>Please elaborate "seems"<br clear="none">>Is it being polite or only having "forwarded" in logging and no further proof?<div class="yqt1725567842" id="yqtfd14448">><br clear="none">><br clear="none">><br clear="none">>> The dnsmasq run on an EdgeRouter and has following version:<br clear="none">>> <a shape="rect" ymailto="mailto:root@bucuresti" href="mailto:root@bucuresti">root@bucuresti</a>:/etc# /usr/sbin/dnsmasq --version<br clear="none">>> Dnsmasq version 2.78-20-geaeda96  Copyright (c) 2000-2017 Simon Kelley<br clear="none">>> Compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect >inotify<br clear="none">>> <br clear="none">>> This software comes with ABSOLUTELY NO WARRANTY.<br clear="none">>> Dnsmasq is free software, and you are welcome to redistribute it<br clear="none">>> under the terms of the GNU General Public License, version 2 or 3.<br clear="none">>> <br clear="none">>> If I lookup a host with local domain, then the request is not going<br clear="none">>> to upstream server. Please see below the logged queries:<br clear="none">>> <br clear="none">>> Jun 21 09:13:31 dnsmasq[21398]: query[A] rrr from 127.0.0.1<br clear="none">>> Jun 21 09:13:31 dnsmasq[21398]: config rrr is NODATA-IPv4<br clear="none">>> Jun 21 09:13:31 dnsmasq[21398]: query[AAAA] rrr from 127.0.0.1<br clear="none">>> Jun 21 09:13:31 dnsmasq[21398]: config rrr is NODATA-IPv6<br clear="none">>> Jun 21 09:13:31 dnsmasq[21398]: query[MX] rrr from 127.0.0.1<br clear="none">>> Jun 21 09:13:31 dnsmasq[21398]: forwarded rrr to 192.168.2.1<br clear="none">>> Jun 21 09:13:38 dnsmasq[21398]: query[A] rrr.b from 127.0.0.1<br clear="none">>> Jun 21 09:13:38 dnsmasq[21398]: config rrr.b is NXDOMAIN<br clear="none">>> Jun 21 09:13:38 dnsmasq[21398]: query[A] rrr.b from 127.0.0.1<br clear="none">>> Jun 21 09:13:38 dnsmasq[21398]: config rrr.b is NXDOMAIN<br clear="none">>> <br clear="none">>> Is this a bug? Is there any configuration missing? I expected that<br clear="none">>> rrr lookup wil not be forwarded to upstream server (192.168.2.1)</div>><br clear="none">>> <br clear="none">><br clear="none">>Dnsmasq manual pages says<br clear="none">><br clear="none">>   -D, --domain-needed<br clear="none">>      Tells dnsmasq to never forward A or AAAA queries for plain names,<br clear="none">>      without dots or domain  parts,  to upstream  nameservers. If<br clear="none">>      the name is not known from /etc/hosts or DHCP then a "not found"<br clear="none">>      answer is returned.<br clear="none">><br clear="none">>So it would prevent the cost of a dail-out connection.<br clear="none">><br clear="none">><br clear="none">>  .....  local testing .....<br clear="none">><br clear="none">><br clear="none">>Jun 21 09:41:14 weiss dnsmasq[24942]: query[MX] inertia from 172.24.0.36<br clear="none">>Jun 21 09:41:14 weiss dnsmasq[24942]: forwarded inertia to 172.24.0.10<br clear="none">><br clear="none">>That un-expected, due 'domain-needed', forward is visible with tcpdump<br clear="none">>at my upstream DNS     :-(<br clear="none">><br clear="none">><br clear="none">>Groeten<br clear="none">>Geert Stappers<br clear="none">>-- <br clear="none">>Leven en laten leven<br clear="none"><div id="yui_3_16_0_ym19_1_1529573586818_31447"><br></div><div id="yui_3_16_0_ym19_1_1529573586818_31445">Through testing I discovered following:</div><div id="yui_3_16_0_ym19_1_1529573586818_31451" dir="ltr">If I issue host rrrr then the request is forwarded to upstream server and is should not<br></div><div dir="ltr">If I issue ping kkkk then the request is NOT forwarded to upstream server as expected.</div><div id="yui_3_16_0_ym19_1_1529573586818_31452" dir="ltr">(I put rrrr and kkkk, just to be sure cache is not involved)<br></div><div id="yui_3_16_0_ym19_1_1529573586818_31441" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1529573586818_31453" dir="ltr">the tcpdump (first 2 packets (between process to dnsmasq and his reply are below:</div><div id="yui_3_16_0_ym19_1_1529573586818_31454" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1529573586818_31455" dir="ltr">In case of host rrr we have:</div><div id="yui_3_16_0_ym19_1_1529573586818_31438" dir="ltr">13:40:19.858325 IP localhost.40987 > localhost.domain: 54601+ A? jjjj. (22)<br id="yui_3_16_0_ym19_1_1529573586818_31327">        0x0000:  0000 0304 0006 0000 0000 0000 0000 0800  ................<br id="yui_3_16_0_ym19_1_1529573586818_31328">        0x0010:  4500 0032 2960 0000 4011 5359 7f00 0001  E..2)`..@.SY....<br id="yui_3_16_0_ym19_1_1529573586818_31329">        0x0020:  7f00 0001 a01b 0035 001e fe31 d549 0100  .......5...1.I..<br id="yui_3_16_0_ym19_1_1529573586818_31330">        0x0030:  0001 0000 0000 0000 046a 6a6a 6a00 0001  .........jjjj...<br id="yui_3_16_0_ym19_1_1529573586818_31331">        0x0040:  0001                                     ..<br id="yui_3_16_0_ym19_1_1529573586818_31332">13:40:19.860678 IP localhost.domain > localhost.40987: 54601 0/0/0 (22)<br id="yui_3_16_0_ym19_1_1529573586818_31333">        0x0000:  0000 0304 0006 0000 0000 0000 0000 0800  ................<br id="yui_3_16_0_ym19_1_1529573586818_31334">        0x0010:  4500 0032 2961 4000 4011 1358 7f00 0001  E..2)a@.@..X....<br id="yui_3_16_0_ym19_1_1529573586818_31335">        0x0020:  7f00 0001 0035 a01b 001e fe31 d549 8180  .....5.....1.I..<br id="yui_3_16_0_ym19_1_1529573586818_31336">        0x0030:  0001 0000 0000 0000 046a 6a6a 6a00 0001  .........jjjj...<br id="yui_3_16_0_ym19_1_1529573586818_31337">        0x0040:  0001                                     ..<br id="yui_3_16_0_ym19_1_1529573586818_31338"><br></div><div id="yui_3_16_0_ym19_1_1529573586818_31440">in case of ping kkkk we have : <br></div><div><br></div><div id="yui_3_16_0_ym19_1_1529573586818_31463" dir="ltr">13:41:17.232389 IP localhost.58411 > localhost.domain: 1381+ A? kkkk. (22)<br id="yui_3_16_0_ym19_1_1529573586818_31406">        0x0000:  0000 0304 0006 0000 0000 0000 0000 0800  ................<br id="yui_3_16_0_ym19_1_1529573586818_31407">        0x0010:  4500 0032 4d72 4000 4011 ef46 7f00 0001  E..2Mr@.@..F....<br id="yui_3_16_0_ym19_1_1529573586818_31408">        0x0020:  7f00 0001 e42b 0035 001e fe31 0565 0100  .....+.5...1.e..<br id="yui_3_16_0_ym19_1_1529573586818_31409">        0x0030:  0001 0000 0000 0000 046b 6b6b 6b00 0001  .........kkkk...<br id="yui_3_16_0_ym19_1_1529573586818_31410">        0x0040:  0001                                     ..<br id="yui_3_16_0_ym19_1_1529573586818_31411">13:41:17.416815 IP localhost.domain > localhost.58411: 1381 0/0/0 (22)<br id="yui_3_16_0_ym19_1_1529573586818_31412">        0x0000:  0000 0304 0006 0000 0000 0000 0000 0800  ................<br id="yui_3_16_0_ym19_1_1529573586818_31413">        0x0010:  4500 0032 4d8c 4000 4011 ef2c 7f00 0001  E..2M.@.@..,....<br id="yui_3_16_0_ym19_1_1529573586818_31414">        0x0020:  7f00 0001 0035 e42b 001e fe31 0565 8180  .....5.+...1.e..<br id="yui_3_16_0_ym19_1_1529573586818_31415">        0x0030:  0001 0000 0000 0000 046b 6b6b 6b00 0001  .........kkkk...<br id="yui_3_16_0_ym19_1_1529573586818_31416">        0x0040:  0001                                     ..<br id="yui_3_16_0_ym19_1_1529573586818_31417"></div><div id="yui_3_16_0_ym19_1_1529573586818_31469" dir="ltr">Thanks,</div><div id="yui_3_16_0_ym19_1_1529573586818_31470" dir="ltr">Spon<br></div></div> </div> </div>  </div></div></body></html>