<p>I use <a href="http://www.thekelleys.org.uk/dnsmasq/doc.html" rel="nofollow noreferrer">dnsmasq</a> to resolve DNS queries on my home network. Unfortunately, if a domain name is not known, it will append my own domain name to the request which means that I always end up viewing my own site in a browser.</p>

<p>For example, if I enter <a href="http://dlksfhoiahdsfiuhsdf.com" rel="nofollow noreferrer">http://dlksfhoiahdsfiuhsdf.com</a> in a browser, I end up viewing my own site with that URL. If I try something like:</p>

<pre><code>host dlksfhoiahdsfiuhsdf.com
</code></pre>

<p>Instead of the expected:</p>

<pre><code>Host dlksfhoiahdsfiuhsdf.com not found: 3(NXDOMAIN)
</code></pre>

<p>I get this:</p>

<pre><code>dlksfhoiahdsfiuhsdf.com.mydomainname.com has address W.X.Y.Z.
</code></pre>

<p>Clearly, dnsmasq is appending my domain name to impossible name requests in an effort to resolve them, but I'd rather see the not found error instead.</p>

<p>I've tried playing with the <em>expand-hosts</em> and <em>domain</em> configuration settings, but to no avail. Is there anything else I can try?</p>

[{'answer_id': 5912, 'author': 'saint_groceon', 'author_id': 59, 'author_profile': 'https://Stackoverflow.com/users/59', 'pm_score': 0, 'selected': False, 'text': "<p>I tried removing <em>domain-needed</em> from my own configuration to replicate your issue and it did not produce this behaviour.  It's the only other parameter I could find that might be close to relevant.</p>\n<p>What does your hosts file look like?  Maybe something weird is going on there that makes it think all weird domains are local to your network?</p>\n"}, {'answer_id': 5980, 'author': 'jj33', 'author_id': 430, 'author_profile': 'https://Stackoverflow.com/users/430', 'pm_score': 2, 'selected': False, 'text': '<p>try querying with a trailing dot to explicitly set the root:</p>\n\n<pre><code>host dlksfhoiahdsfiuhsdf.com.\n</code></pre>\n'}, {'answer_id': 160319, 'author': 'Zan Lynx', 'author_id': 13422, 'author_profile': 'https://Stackoverflow.com/users/13422', 'pm_score': 2, 'selected': False, 'text': '<p>It is probably not dnsmasq doing it, but your local resolver library.  If you use a unixish, try removing the "search" or "domain" lines from /etc/resolv.conf</p>\n'}, {'answer_id': 342481, 'author': 'benc', 'author_id': 2910, 'author_profile': 'https://Stackoverflow.com/users/2910', 'pm_score': 1, 'selected': False, 'text': '<p>There might be other causes, but the most obvious cause is the configuration of /etc/resolv.conf, and the fact that most DNS clients like to be very terse about errors.</p>\n\n<pre><code>benc$ host thing.one\nHost thing.one not found: 3(NXDOMAIN)\n</code></pre>\n\n<p>(okay, what was I using for a DNS config?)</p>\n\n<pre><code>benc$ cat /etc/resolv.conf \nnameserver 192.168.1.1\n</code></pre>\n\n<p>(edit...)</p>\n\n<pre><code>benc$ cat /etc/resolv.conf \nsearch test.com\nnameserver 192.168.1.1\nbenc$ host thing.one\nthing.one.test.com has address 64.214.163.132\n</code></pre>\n\n<p>Without bothering to do a packet trace, the likely behavior is that it returns the error for the last FQDN it tried.</p>\n'}, {'answer_id': 21961685, 'author': 'parawizard', 'author_id': 3341986, 'author_profile': 'https://Stackoverflow.com/users/3341986', 'pm_score': 1, 'selected': False, 'text': "<p>You have a wildcard domain?</p>\n\n<p>dnsmasq is forwarding the appended name out to the external dns server and its getting wildcarded.</p>\n\n<p>you can use --server=/yourinternaldomainhere/ to make sure that your internal domain name lookups are not forwarded out.</p>\n\n<p>syntax in this case would be:</p>\n\n<p>--server=/domain/iptoforwardto</p>\n\n<p>and in this case leave the iptoforwardto area blank as you don't want it to forward anywhere.</p>\n"}]
['https://Stackoverflow.com/questions/5876', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/726/']