{"id":644,"date":"2014-03-31T21:06:03","date_gmt":"2014-04-01T02:06:03","guid":{"rendered":"http:\/\/www.thegatesofdawn.ca\/wordpress\/?p=644"},"modified":"2021-04-13T00:09:32","modified_gmt":"2021-04-13T05:09:32","slug":"dns-problems-with-windows-dnsmasq-ipv6-and-cname","status":"publish","type":"post","link":"https:\/\/www.thegatesofdawn.ca\/wordpress\/posts\/2014\/03\/31\/dns-problems-with-windows-dnsmasq-ipv6-and-cname\/","title":{"rendered":"DNS problems with Windows, Dnsmasq, IPv6 and CNAME"},"content":{"rendered":"<p>I&#8217;ve been trying to set up a <a title=\"Git SCM\" href=\"http:\/\/git-scm.com\/\">git<\/a> repository on a server in my home.\u00a0 I wasn&#8217;t sure exactly which computer I should set it up on, and I want to be able to move it to another computer later without breaking the connections to it.\u00a0 I thought maybe I could do this by setting up some magic in my network&#8217;s DNS server, giving the same computer two names in DNS: both its own name, and also the name &#8220;git&#8221;.\u00a0 Then I could change the name &#8220;git&#8221; to point to another computer later, if I wanted to.\u00a0 But things didn&#8217;t work out very well at first.<\/p>\n<p><!--more--><\/p>\n<p>My router is running <a title=\"DD-WRT\" href=\"http:\/\/dd-wrt.com\">DD-WRT<\/a>, which uses <a title=\"Dnsmasq\" href=\"http:\/\/www.thekelleys.org.uk\/dnsmasq\/doc.html\">Dnsmasq<\/a> to provide the DHCP and DNS functions.\u00a0 I learned about DNS&#8217;s &#8220;<a title=\"CNAME record\" href=\"http:\/\/en.wikipedia.org\/wiki\/CNAME_record\">CNAME<\/a>&#8221; records, which allow you to create &#8220;canonical&#8221; names that point to other &#8220;real&#8221; names.\u00a0 It seemed perfect.<\/p>\n<p>I figured out how to configure Dnsmasq to do that.\u00a0 Other pages talk about how to do this too, so I won&#8217;t go into the details here.\u00a0 But It didn&#8217;t work for me.\u00a0 When I tried &#8220;ping git&#8221; on my PC, it couldn&#8217;t resolve the name.<\/p>\n<p>Actually, after a great deal of debugging, I discovered that it did actually work on other computers in my house.\u00a0 All of them, in fact.\u00a0 Just not the one in my home office.\u00a0 It happens to be a Windows XP box, but then so were some of the other ones I tried it on.<\/p>\n<p>This led me to suspect something weird about the DNS name resolution going on with that particular computer.\u00a0 I tried using &#8220;nslookup git&#8221; on the same PC, and it found it.\u00a0 But &#8220;ping git&#8221; still could not.\u00a0 Weird.\u00a0 Apparently &#8220;nslookup&#8221; does not use the same DNS resolver as the Windows system itself, which kind of limits its usefulness for debugging issues with the resolver.\u00a0 But this, apparently, is a common problem with many causes, possibly involving NetBIOS, and LMHOSTS files, and a bunch of other stuff.\u00a0 Nothing I found really addressed my problem, though.<\/p>\n<p>Eventually, I installed <a title=\"Wireshark\" href=\"http:\/\/www.wireshark.org\/\">Wireshark<\/a>, so I could see exactly what was going to and from the DNS server.\u00a0 This finally clued me in.\u00a0 When I executed the &#8220;ping git&#8221; command, the request that Windows sent to my DNS server was asking for an IPv6 address record (type &#8220;AAAA&#8221;), rather than the IPv4 record (type &#8220;A&#8221;) that you might expect (since I don&#8217;t use IPv6).\u00a0 And DNSmasq gave a &#8220;not found&#8221; response.  When I observed the name resolution done by &#8220;nslookup&#8221;, it requested an IPv4 &#8220;A&#8221; record, and got a proper response (which included both the &#8220;git&#8221; CNAME record, and the A record for the actual server that it pointed to.)<\/p>\n<p>It was at this point that I recalled that this particular PC was the only WIndows XP box in the house that had IPv6 installed.\u00a0 I don&#8217;t know why it was installed, or when, but there it was.\u00a0 I wasn&#8217;t using IPv6, and I even disabled the IPv6 interface in the LAN connection properties, but it still seems to affect how Windows XP handles DNS resolution.\u00a0 But somehow it still worked for other names in my DNS, though, that weren&#8217;t using a CNAME record.\u00a0 Perhaps there&#8217;s some bug in how Dnsmasq handles CNAME records when an IPv6 AAAA record is requested.<\/p>\n<p>Anyway, in the end the solution was to uninstall the IPv6 support, using the command &#8220;netsh int ipv6 uninstall&#8221;.\u00a0 After that, &#8220;ping git&#8221; started working properly, returning the IP address of the computer that my CNAME record currently has &#8220;git&#8221; mapped to.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been trying to set up a git repository on a server in my home.\u00a0 I wasn&#8217;t sure exactly which computer I should set it up on, and I want to be able to move it to another computer later without breaking the connections to it.\u00a0 I thought maybe I could do this by setting [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[112,110,113,111,108,114,109],"class_list":["post-644","post","type-post","status-publish","format-standard","hentry","category-tech","tag-cname","tag-dns","tag-dnsmasq","tag-ipv6","tag-windowsxp","tag-wireshark","tag-xp"],"_links":{"self":[{"href":"https:\/\/www.thegatesofdawn.ca\/wordpress\/wp-json\/wp\/v2\/posts\/644"}],"collection":[{"href":"https:\/\/www.thegatesofdawn.ca\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.thegatesofdawn.ca\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.thegatesofdawn.ca\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thegatesofdawn.ca\/wordpress\/wp-json\/wp\/v2\/comments?post=644"}],"version-history":[{"count":4,"href":"https:\/\/www.thegatesofdawn.ca\/wordpress\/wp-json\/wp\/v2\/posts\/644\/revisions"}],"predecessor-version":[{"id":761,"href":"https:\/\/www.thegatesofdawn.ca\/wordpress\/wp-json\/wp\/v2\/posts\/644\/revisions\/761"}],"wp:attachment":[{"href":"https:\/\/www.thegatesofdawn.ca\/wordpress\/wp-json\/wp\/v2\/media?parent=644"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thegatesofdawn.ca\/wordpress\/wp-json\/wp\/v2\/categories?post=644"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thegatesofdawn.ca\/wordpress\/wp-json\/wp\/v2\/tags?post=644"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}