Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to SSH to an Eee PC laptop running Debian on a network where hostnames are automatically registered with DNS via the DHCP server. The Eee PC laptop had run out of power and gone to sleep and now when it's booted up again, the Mac can't see it except for the nslookup program.

gaz:~ jeff$ ssh epc
ssh: Could not resolve hostname epc: nodename nor servname provided, or not known
gaz:~ jeff$ nslookup epc
Server:     192.168.2.20
Address:    192.168.2.20#53

Name:   epc.osnetwork
Address: 192.168.2.139

gaz:~ jeff$ ssh epc.osnetwork
ssh: Could not resolve hostname epc.osnetwork: nodename nor servname provided, or not known

Now, ssh epc is how I normally access the Eee PC, but for some reason I think some part of OS X is caching a no-response despite the machine being online but I don't know how. I'm not even sure how to resolve this with any degree of certainty, I suspect a reboot will do it but for lack of a no-downtime solution I've just been using the IP address instead (which can still be obtained on the mac with nslookup epc, which is the most baffling part).

If I SSH to another Mac that didn't try to contact the Eee PC while it was down, that Mac can SSH to it without problems, but when I go back to the original Mac it still can't reach the hostname.

Other non-Apple machines on the network do not appear to suffer from this behavior.

Does anyone know why this is happening, or have ideas on how to fix this behavior?

[EDIT] I've found that coming back a half hour later to try again worked, but I'd still like to know why this is happening and how to correct it.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You've encountered the overly zealous OS X DNS Cache. Next time you see this you can flush it:

# sudo dscacheutil -flushcache

That should fix SSH, etc.

share|improve this answer
    
+10. I haven't even had a chance to test this yet, but it sounds like exactly what I was looking for, THANKYOU!!! I wish I could send you a pie :D –  Jeff Welling Sep 1 '11 at 0:07
    
Actually, it seems I spoke too soon. After running that command, I wasn't able to ssh to any of the machines on my local network. Most peculiar. Waiting it out allowed me to eventually ssh to said machines again. Thanks for the tip though :) –  Jeff Welling Sep 12 '11 at 21:02
    
It seems to work some of the time, and at other times prevents me from ssh-ing to any of the hostnames on my network. Ah well, focusing on the positive.. –  Jeff Welling Oct 3 '11 at 11:45
    
We used to use that command reliably in Snow Leopard, however a couple of our devs updated to Lion and it gives unreliable results for flushing now. Although we don't run into the issue where no hostnames work, that sounds like a broken DNS server somewhere. –  polynomial Oct 3 '11 at 14:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.