I'm trying to use ssh to log into remote servers, and I have a ProxyCommand setup in ~/.ssh/config to use a proxy (setup through PuTTY to connect to a VPN). The ProxyCommand uses nc to connect through the proxy (as described in the answer to How can I use SSH with a SOCKS 5 proxy?), but nc doesn't seem to be able to resolve the hostname to an IP through /etc/hosts before sending it on to the proxy, and the proxy doesn't know how to resolve the hostname.
$ cat /etc/hosts 127.0.0.1 localhost 22.214.171.124 hostname1 126.96.36.199 hostname2 $ cat ~/.ssh/config ProxyCommand /usr/bin/nc -x 127.0.0.1:7777 %h %p
Note that port 7777 is configured as a dynamic port in PuTTY.
$ cat /etc/resolv.conf lookup file bind $ cat /etc/nsswitch.conf hosts: files dns
If I use ssh email@example.com then the connection succeeds, but if I use ssh user@hostname1 then hostname1 gets passed to the proxy instead of being resolved to 188.8.131.52 and the connection fails. Does anyone know of any configurations that need to be made to make netcat hostname resolution through /etc/hosts work in cygwin?