내 Windows에서 local-to-port 포트 전달을 사용하여 원격 데이터베이스에 액세스하고 있습니다. 그것은 포트 포워딩을 위해 퍼티를 사용하는 매력처럼 작동하지만 루비/네트 :: SSH를 사용하여 전달하려고 할 때 실패합니다. 브라우저에서 테스트 할 때 google.com에원격 db 연결을위한 Ruby/Net :: SSH를 사용하는 로컬에서 원격 포트 포워딩
require 'rubygems'
require 'net/ssh'
Net::SSH.start(remote_host, user_name, :password => password) do |ssh|
ssh.logger.sev_threshold=Logger::Severity::DEBUG
ssh.forward.local(5555, 'www.google.com', 80) # works perfectly
ssh.forward.local(4444, remote_host, 1234) # db connection hangs up
ssh.loop { true }
end
앞으로 포트가 잘 작동 : 여기 내 코드입니다. 내 DB 서버가 포트 1234에서 수신 대기하는 내 Linux 서버로의 포트 전달이 작동하지 않습니다. localhasot : 4444에 연결하려고하면 연결이 끊깁니다. 로그 :
DEBUG -- net.ssh.service.forward[24be0d4]: received connection on 127.0.0.1:4444
DEBUG -- tcpsocket[253ba08]: queueing packet nr 6 type 90 len 76
DEBUG -- tcpsocket[24bde64]: read 8 bytes
DEBUG -- tcpsocket[253ba08]: sent 100 bytes
DEBUG -- net.ssh.connection.channel[24bdcc0]: read 8 bytes from client, sending over local forwarded connection
그리고 아무것도! 내가 그물 - ssh를 2.0.22/루비 1.8.7
구글을 주석으로 처리하고 앞으로 해보십시오. 그게 도움이 되니? – barrycarter
불행히도 작동하지 않습니다. – nakhli