Changed /etc/hosts entries, but they are still pointing to localhost

2

I've had two sites on my local host and have had mysite1.local and mysite2.local in my /etc/hosts file to pointing in my localhost. Now, I moved those sites into my homeserver (Ubuntu, Local network) and made changes to the hosts file, and also in /private/etc/hosts is the same. The files have 644 permissions.

192.168.0.50 mysite1.local
192.168.0.50 mysite2.local

I flushed my dnscache

sudo dscacheutil -flushcache

I rebooted the machine, reset Safari but still no changes.. Still if I try to go either mysite1.local or mysite2.local, it is pointing to localhost!

When I run

dscacheutil -q host -a name mysite1.local

It returns name: mysite1.local ip_address: 127.0.0.1 two times and if I do the same for mysite2.local, it returns name: mysite2.local ip_address: 127.0.0.1 only once.

What could be the problem?

OS is Snow Leopard 10.6.8

Marko

Posted 2011-11-26T08:13:24.007

Reputation: 121

Yes, hosts file is where I made hosts changes! /etc/hosts file permissions are 644. When I ran your command mysite1.local puts name: mysite1.local ip_address: 127.0.0.1 two times and mysite2.local puts name: mysite2.local ip_address: 127.0.0.1 one time.. weird!? Without .local I get nothing?? – Marko – 2011-11-26T10:44:18.377

No... ? Why you ask? Never heard that command before!? – Marko – 2011-11-26T11:21:29.707

That would have been another way to set those redirects. I updated your question to include what we know so far — I'll delete my comments. For now, I'm a bit out of ideas. – slhck – 2011-11-26T11:31:38.697

Okey, thank you sir! :) I could and at the moment are using different local domain to get access to mysites. So new records works just fine not just those what I was using to point localhost... COuld there be some other hosts file/s what system will use? – Marko – 2011-11-26T17:54:19.620

Answers

0

A great deep-dive into DNS in Snow Leo is here

My best guess is that you have a cached .local domain flat file in /etc/resolver that wasn't refreshed/flushed properly. By the way, are you using the system's apache? Where did you make the local virtual host changes, to point to the corresponding site files? .local is always a troublesome domain to use, as it overlaps with the Bonjour protocol's default/expected namespace, and (as described in the article above,) all resolution goes through the same daemon.

Sacrilicious

Posted 2011-11-26T08:13:24.007

Reputation: 256