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 184.108.40.206 hostname1 220.127.116.11 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 firstname.lastname@example.org then the connection succeeds, but if I use ssh user@hostname1 then hostname1 gets passed to the proxy instead of being resolved to 18.104.22.168 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?