Tuesday, June 23, 2015

windows - Same network, different site for same domain name



I have a little problem that I can't understand. We developed a new version of an existing website. This was developed locally, then transferred to a new server. The final change was to update the DNS of the domain name so that it would resolve to the IP of the new server. My client says he can see the site now, but I can't. I thought it was weird, but maybe the change was not fully spread around the internet, so I decided to wait. Then I decide to look at the site from my other computer, which runs ubuntu. The site works there, and I see the new version. This is even more weird, right? especially considering they are both connected to the same network and access the web with the same internet connection. So, I decided to take a look at the site on my tablet, and it also works. Then my phone, which connects to the internet using my carrier's internet service. The site also works on my phone.




The question is, why would it not work on one of the computers? Lets forget about the tablet, and the phone for a minute.



I have two computers, one runs Ubuntu, the other runs windows 7. The one running windows 7 point the domain name to it's old IP, and the one running ubuntu resolves the domain to the new IP. They are both connected to the same internet access point. I thought maybe I changed the DNS on Ubuntu at some point and I don't remember, but then I never changed them on the tablet, and it resolves to the new IP too. So, my only guess is that windows 7 has its own DNS, is that true? or what is going on?


Answer



Windows performs local DNS caching. Perform the following command at an elevated command prompt: ipconfig /flushdns and then try to go to your site.



In fact, if you want to verify, before flushing your local resolver cache, run the following command: ipconfig /displaydns. I'll bet the domain name in question is cached with the internal IP address.



To double verify, open up nslookup in an elevated command prompt, type server 208.67.222.222 and hit enter. Then type set type=all and hit enter. Finally, type domain.com and hit enter. You will likely see an A record with the proper IP address.




What does the above prove? That your local PC has the internal IP address cached and that external, public DNS servers have the proper, external IP address.



To turn off the Windows DNS caching facility (so that Windows behaves like a civilized operating system), go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\MaxCacheEntryTtlLimit and set the DWORD value to 1.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...