
ファイアウォールの背後にあるopenvpn-vpnサーバーに接続する必要があるため、これにはssh-reverseトンネルを使用します。 「一般」ssh
コマンドを使用すると機能しますが、接続を介して移動することはautossh
機能しません。他のすべての接続ではautossh
正常に動作します。
SSHコマンド:
ssh -R 0.0.0.0:8888:localhost:1194 user@server -N
Autossh コマンド:
/usr/bin/autossh -o "ServerAliveInterval 10" -o "ServerAliveCountMax 3" -N -R 0.0.0.0:8888:localhost:1149 user@server
接続しようとしたときのエラーメッセージ
autossh
:debug1: connect_next: host localhost ([127.0.0.1]:1149) in progress, fd=7 debug3: channel 2: waiting for connection debug1: channel 2: connection failed: Connection refused connect_to localhost port 1149: failed. debug3: send packet: type 92 debug2: channel 2: zombie debug2: channel 2: garbage collecting debug1: channel 2: free: 193.175.84.201, nchannels 3 debug3: channel 2: status: The following connections are open:
ここで違いが何であるかわかりません。何が間違っているのかを知っている人はいますか?
答え1
同じ問題がある人のための解決策を見つけました。
変える:
/usr/bin/autossh -o "ServerAliveInterval 10" -o "ServerAliveCountMax 3" -N -R 0.0.0.0:8888:localhost:1149 user@server
コマンドは次のようにする必要があります。
/usr/bin/autossh -o "ServerAliveInterval 10" -o "ServerAliveCountMax 3" -o ExitOnForwardFailure=yes -R 0.0.0.0:8888:localhost:1194 user@server -N
したがって、-N
オプションは次のようにする必要があります最後に。