Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

Whenever I run ssh inside of cygwin on Windows 7 I get the error:

ssh: Could not resolve hostname ... Non-recoverable failure in name resolution
lost connection

If I try the same command immediately after the error, it works without issue. If I wait too long to try again, I get the error again.

This doesn't happen for me on XP. Any ideas why ssh always fails the first time?

share|improve this question
Have you tried using dig from in cygwin to see if it works when curl fails? Have you tried Wireshark or tcpdump to make sure the packets are going out correctly? – Nathan V Nov 27 '12 at 12:13

I run Windows 7 with Cygwin in Virtualbox and experienced the same issue. The cause in my case was having blindly enabled the nat dns "resolver mode" in Virtualbox ( in an attempt to solve something unrelated.

While troubleshooting a third issue, I noticed something funny in dig's output.

$ dig <dns_server_ip> <network_server_name> ANY
;; Warning: Message parser reports malformed message packet.

Where dns_server_ip was the DNS given by the Virtualbox NAT adaptor,

The immediate fix was to manually set the DNS entries in the Windows guest. I also disabled the host resolver mode for the time being (which should have the same effect).

share|improve this answer
I'm voting this up months after it was posted because this is the only answer on this subject that has actually resolved my own issue. – OldTimer Aug 10 '15 at 22:40

Your Answer


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.