0

I've frequently used /etc/hosts to hop back and forth between servers for a domain and also to test if it's serving correctly before a deployment.

However, in this latest case I've used cloudflare for DNS. For some reason I cannot serve (get a HTTP response) the site from the old IP address (of the server because it's stuck on the updated IP address). I cannot switch this back since the new site is already live. I've never had an issue like this before. The only difference seems to be that Cloudflare manages the DNS entries.

I've troubleshoot by flushing DNS caches, restarting, and other various tips found online but no success. I was also able to serve another site (different domain) by modifying the hosts file... Which leads me to the question at hand...

So, the question is, can cloudflare cause /etc/hosts entries to be ignored? Or is this a coincidence?

If this is the issue, how is this even possible? I thought the hosts file bypassed DNS lookup.

Cheers,

  • Can you clearly explain what the original problem here is? You seem to be seeking an explanation for behavior you haven't described. 'Cannot serve' is rather vague. –  Jan 30 '20 at 22:57
  • Description aside, the question itself is yes or no. Can cloudflare cause /etc/host entries to be ignored? – Chris Stage Jan 30 '20 at 23:22
  • Without context, the question doesn't make much sense. Why would cloudflare have anything to do with your /etc/hosts? You could easily run ping or nslookup to see what your OS is resolving it to. –  Jan 30 '20 at 23:32
  • The question itself is clear and concise, irregardless of the context behind it. I realize myself it's improbable, but I'm attempting to round out possibilities. Given the troubleshooting I've done and steps I've taken, I can't say with 100% confidence it wouldn't have anything to do with it, which leads me to why I'm here to confirm. – Chris Stage Jan 30 '20 at 23:39

2 Answers2

1

Domain name resolution is configured locally on your machine and no external entity can override it.

However you can change it through the nsswitch mechanism. E.g. if you have a line:

hosts: dns files

in /etc/nsswitch.conf, then DNS entries will override /etc/hosts.

Piotr P. Karwasz
  • 5,748
  • 2
  • 11
  • 21
0

Neither CloudFlare nor any other DNS server can override your local /etc/hosts file.

I suggest you start your troubleshooting again, and if you need help please ask another question with more diagnostic detail of your testing.

Tim
  • 31,888
  • 7
  • 52
  • 78
  • Thanks, this is the answer I was looking for. I thought as much but I needed confirmation. Hopefully, this is indexed for search and helps others. – Chris Stage Jan 31 '20 at 03:20