[Dnsmasq-discuss] Why does dnsmasq append .home to a plain hostname?

Petr Mensik pemensik at redhat.com
Tue Oct 29 18:19:24 GMT 2019


Hi Sean,

this is not dnsmasq related question, since it is not involved directly.

$ hostname -d

If that prints something different than (none), you have some domain set 
as part of hostname on the router. I do not know how to flush DNS cache 
on Android. But googled it successfully [1].

As long as it does not cache it for ages, where is problem in caching? 
When you install any dns application, you would be able to tell how long 
should that name be cached.

It can be tested by dig command. For example:
$ dig thekelleys.org.uk
...
thekelleys.org.uk.	18319	IN	A	213.138.109.107
...

18319 is number of seconds to keep that name in cache. It should be ok 
to keep it for that long. Besides, it can do also negative caching. If 
your domain is queried, it gets negative answer. But that can be cached 
as well. So next time you enter that name, it may already know this name 
does not exist.

$ dig mymovies.
...
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 28127
...
.			86400	IN	SOA	a.root-servers.net. nstld.verisign-grs.com. 2019102901 
1800 900 604800 86400
...

In general, your server has to serve with TTL 0, if your device is 
supposed to ask the server every time. Caching is ok. Why do you test 
number of queries but not the results?

PS: would recommend home.arpa instead of home domain [2]

Cheers,
Petr


1. 
https://www.techwalla.com/articles/how-to-flush-the-dns-on-an-android-phone
2. https://www.rfc-editor.org/rfc/rfc8375.html

On 10/28/19 4:25 AM, Sean Warner wrote:
> Hello,
> 
>   
> 
> I did some more testing and confirmed that the .home was being sent to the
> dhcp client (my laptop) by the dhcp server on my router. The Windows OS then
> appended that dns suffix when doing a dns lookup on any unqualified domain
> names.
> 
>   
> 
> Actually I was able to confirm Windows order of name resolution:
> 
> 1.     The client checks to see if the name queried is its own.
> 
> 2.     The client then searches a local Hosts file, a list of IP address and
> names stored on the local computer.
> 
> 3.     Domain Name System (DNS) servers are queried.
> 
> 4.     If the name is still not resolved, NetBIOS name resolution sequence
> is used as a backup. This order can be changed by configuring the NetBIOS
> node type of the client.
> 
>   
> 
> I need a webpage to work from Windows and from an Android phone so my
> question now is to confirm what is the process of name resolution on Android
> OS?
> 
>   
> 
> My dnsmasq.conf contains these two lines (as well as others!)
> 
> address=/mymovies/192.168.1.124
> 
> #address=/mymovies.home/192.168.1.124
> 
>   
> 
> So the mymovies.home is commented out.
> 
>   
> 
> Here is dnsmasq log file after I try to access a webpage from the Android
> phone with the url http://mymovies
> 
>   
> 
> Oct 28 02:07:22 dnsmasq[16759]: query[A] mymovies.home from XX.XX.XXX.XXX
> 
> Oct 28 02:07:22 dnsmasq[16759]: forwarded mymovies.home to 192.168.1.254
> 
> Oct 28 02:07:24 dnsmasq[16759]: query[A] mymovies.home from XX.XX.XXX.XXX
> 
> Oct 28 02:07:24 dnsmasq[16759]: forwarded mymovies.home to 192.168.1.254
> 
> Oct 28 02:07:26 dnsmasq[16759]: reply mymovies.home is NXDOMAIN
> 
> Oct 28 02:07:26 dnsmasq[16759]: reply mymovies.home is NXDOMAIN
> 
> Oct 28 02:07:26 dnsmasq[16759]: query[A] mymovies from XX.XX.XXX.XXX
> 
> Oct 28 02:07:26 dnsmasq[16759]: config mymovies is 192.168.1.124
> 
> Oct 28 02:10:22 dnsmasq[16759]: query[A] mymovies from XX.XX.XXX.XXX
> 
> Oct 28 02:10:22 dnsmasq[16759]: config mymovies is 192.168.1.124
> 
> Oct 28 02:16:14 dnsmasq[18418]: query[A] mymovies from XX.XX.XXX.XXX
> 
> Oct 28 02:16:14 dnsmasq[18418]: config mymovies is 192.168.1.124
> 
>   
> 
> The X's are my routers public ip address redacted.
> 
> Can someone explain what is happening?
> 
> It looks like dnsmasq starts by trying to resolve mymovies.home then it
> can't so it tries mymovies and succeeds?
> 
> So does this mean that Android OS will try to do name resolution on an
> unqualified domain name? I know that Windows will not.
> 
>   
> 
> The last four lines in the log output are when I just repeated the same
> webpage load from the Android phone two times. The first time I just
> reloaded the page (at 02:10:22). The second time I actually restarted
> dnsmasq and cleared the phones browser dns cache and recent history (at
> 02:16:14). However it looks like those last two name resolutions were
> successful from an earlier cached response? Why didn't it try mymovies.home
> on these last two occassions? Maybe I needed to do something like an
> ipconfig /flushdns on the phone.. if only it was rooted, which it isn't.
> 
>   
> 
> Sorry but my understanding of dnsmasq is limited!
> 
>   
> 
> Thank you,
> 
>   
> 
> Flex
> 
> 
> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
> 

-- 
Petr Menšík
Software Engineer
Red Hat, http://www.redhat.com/
email: pemensik at redhat.com  PGP: 65C6C973




More information about the Dnsmasq-discuss mailing list