Skip to content

Instantly share code, notes, and snippets.

@janl
Last active November 18, 2015 22:02
Show Gist options
  • Select an option

  • Save janl/f9ecde0ac00d55eca160 to your computer and use it in GitHub Desktop.

Select an option

Save janl/f9ecde0ac00d55eca160 to your computer and use it in GitHub Desktop.

I’m connected via ethernet and DHCP, the DHCP provided nameserver is 10.0.0.111 and running dnsmasq for example.com to resolve to 10.0.0.110 when on the local network, while the ip for example.com on the open internet is 91.65.182.25.

Why would Mac OS X, after resetting the DNS cache first resolve the domain correctly, and then after a few minutes somehow get the public DNS ip?

ping, Safari, etc. are all affected. There is nothing going on in the 360 seconds wait time.

> sudo killall -HUP mDNSResponder && ping -c 3 example.com && sleep 360 && ping -c 3 example.com
Password:
PING example.com (10.0.0.110): 56 data bytes
64 bytes from 10.0.0.110: icmp_seq=0 ttl=64 time=0.795 ms
64 bytes from 10.0.0.110: icmp_seq=1 ttl=64 time=1.598 ms
64 bytes from 10.0.0.110: icmp_seq=2 ttl=64 time=0.830 ms

--- example.com ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.795/1.074/1.598/0.371 ms
PING home.jan.io (91.65.182.25): 56 data bytes
64 bytes from 91.65.182.25: icmp_seq=0 ttl=64 time=1.180 ms
64 bytes from 91.65.182.25: icmp_seq=1 ttl=64 time=3.704 ms
64 bytes from 91.65.182.25: icmp_seq=2 ttl=64 time=2.567 ms

--- home.jan.io ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 1.180/2.484/3.704/1.032 ms
@janl
Copy link
Author

janl commented Nov 18, 2015

@maxheadroom That sounds plausible.

So far it looks like dnsmasq-ing my-other-example.com might have done the trick.

@mattghali
Copy link

Hm. I've never seen a nameserver answer a NS query with a CNAME. This suggests that you're most likely trying things that don't work in DNS, and your nameserver (dnsmasq?) is doing broken things trying to make sense of your config. Can you paste the zonefile for 'example.com'?

@janl
Copy link
Author

janl commented Nov 18, 2015

@mattghali I don’t have a zone file, but example.com is a CNAME for my-other-example.com and more specifically it is really foo.example.com as a CNAME of bar.my-other-example.com — the DNS hoster just has a web interface for DNS, so I can’t really screw up the zone file.

@janl
Copy link
Author

janl commented Nov 18, 2015

that said, dnsmasqing my-other-example.com totally did the trick, thanks everyone! <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment