Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A while ago I set reddit.com to 127.0.0.1 in my hosts, because it was way too much of a time sink. I don't remember exactly how I set it - I know I had some trouble with it and tried a few different things before I found the "right" method, so I might have done something weird.

Now, no matter what I do, I can't un-set it or set it to something else - it's somehow "stuck" on 127.0.0.1.

$ sudo nano /etc/hosts
Password:

I add these two lines:

208.96.53.70 reddit.com
208.96.53.70 reddit2.com

Save, exit, then:

$ dscacheutil -flushcache
$ ping reddit.com
PING reddit.com (127.0.0.1): 56 data bytes
$ ping reddit2.com
PING reddit2.com (208.96.53.70): 56 data bytes

Same thing if I don't specify reddit.com at all.

What am I missing?? I don't have any other entry for reddit.com in my hosts file. It's not a router or ISP issue - other computers on the same router are fine. Where else could it be defined?

For the sake of completeness, I cleaned everything out of my hosts, and it contains only the following:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost
share|improve this question
    
What IP address does 'dig reddit.com' give you? – Steve Folly Oct 21 '09 at 22:30
    
reddit.com. 6 IN A 216.207.68.88 reddit.com. 6 IN A 216.207.68.72 (I got 208.96.53.70 from a google search just for testing, it's likely out of date.) – alex_c Oct 21 '09 at 22:46
2  
Try 'dscacheutil -cachedump -entries host' as an admin. Is reddit.com in there, and if so which DS node was it found in? – Steve Folly Oct 22 '09 at 5:41
up vote 3 down vote accepted

It sounds like you may've created the host entry in DSLocal, rather than /etc/hosts. To find out, run:

dscl /Search -read /Hosts/reddit.com

It should come back with something like this:

AppleMetaNodeLocation: /Local/Default
IPAddress: 127.0.0.1
RecordName: reddit.com
RecordType: dsRecTypeStandard:Hosts

See the AppleMetaNodeLocation? That tells you where it's getting the info from. If it says /BSD/local, it's in /etc/hosts; if it says /Local/Default (which I suspect it will), that's the default local directory node, aka DSLocal. If it says <dscl_cmd> DS Error: -14136 (eDSRecordNotFound), then I have no idea what you've done.

Anyway, assuming the entry is coming from DSLocal, it's fairly easy to remove:

sudo dscl /Local/Default -delete /Hosts/reddit.com
share|improve this answer
    
Thank you sir - that is exactly it! Would vote up, but no rep yet :) – alex_c Oct 22 '09 at 19:13

try

dscacheutil -flushcache
ping reddit.com

and report back.

share|improve this answer
    
Already did - see above. As far as I can tell this should do the trick, but it doesn't, that's why I'm baffled. – alex_c Oct 22 '09 at 0:27
    
Wow, sorry I apparently jumped over that while reading. I'd maybe grep for reddit.com in /etc and see what comes up. – Tyler Oct 22 '09 at 2:16

It seems that you need to run

sudo niload -v -m hosts . < /etc/hosts

after updating your hosts file if you want the changes to take.

share|improve this answer
    
I think that was for older versions of Mac OS X, I'm running 10.5.7 - "command not found" on mine. – alex_c Oct 21 '09 at 22:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .