ssh-connect icon indicating copy to clipboard operation
ssh-connect copied to clipboard

On windows, 127.0.0.1 isn't relayed through proxy tunnel

Open BigSully opened this issue 4 years ago • 1 comments

ssh -o ProxyCommand='connect -d -S 192.168.11.9:1080 %h %p' -p 20022 [email protected] This command works on my macOS, but fails on MINGW64(git bash). Turns out the make_localnet_as_direct function is compiled on windows, which makes the connect command on windows to not relay 127.0.0.1 traffic through the proxy server.

Can we make this behavior of relaying local net consistent across different platforms?

Debug info on MINGW64:

Kelly@local-pc MINGW64 ~
$ ssh -o ProxyCommand='connect -d -S 192.168.11.9:1080 %h %p' -p 20022 [email protected]
DEBUG: making direct addr list from network adapter address:
DEBUG: adding direct addr entry: 192.168.11.0/255.255.255.0
DEBUG: adding direct addr entry: 192.168.216.0/255.255.255.0
DEBUG: adding direct addr entry: 192.168.84.0/255.255.255.0
DEBUG: adding direct addr entry: 192.168.5.0/255.255.255.0
DEBUG: adding direct addr entry: 127.0.0.0/255.0.0.0
DEBUG: 5 direct address entries.
DEBUG: relay_method = SOCKS (2)
DEBUG: relay_host=192.168.11.9
DEBUG: relay_port=1080
DEBUG: relay_user=Kelly
DEBUG: socks_version=5
DEBUG: socks_resolve=REMOTE (2)
DEBUG: local_type=stdio
DEBUG: dest_host=127.0.0.1
DEBUG: dest_port=20022
DEBUG: match with: 127.0.0.0/255.0.0.0
DEBUG: 127.0.0.1 is for direct.
DEBUG: connecting to 127.0.0.1:20022
DEBUG: connect() failed.
FATAL: Unable to connect to destination host, errno=10061
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535

Kelly@local-pc MINGW64 ~

BigSully avatar Oct 31 '21 13:10 BigSully

I have same problem on this, i need to skip make_localnet_as_direct on Windows.

we can add an option in windows platform to disable it.

ElonH avatar Feb 04 '25 09:02 ElonH