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.
For instance:
$ cat /etc/hosts
127.0.0.1 localhost
12.34.56.78 hostname1
12.34.56.79 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 user@12.34.56.78 then the connection succeeds, but if I use ssh user@hostname1 then hostname1 gets passed to the proxy instead of being resolved to 12.34.56.78 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?
Thanks