我想使用ssh端口转发。 我几年没有使用这个function,所以我可能已经忘记了一些明显的东西,或者操作系统默认值可能已经改变了。
我已经尝试过三种不同的机器(所有的Ubuntu 9.10)。 debugging说,它正在打开端口进行聆听。 他们必须马上悄然离去。
我已经检查,我可以从我的本地机器达到192.168.1.8:80。
可能有一个非常简单的原因,但是我在20分钟内没有发现它。
任何想法可能是什么问题?
谢谢,
克里斯。
root@chris-desktop:~# ssh -v -L 3142:192.168.1.8:80 yellow.example.com OpenSSH_5.1p1 Debian-6ubuntu2, OpenSSL 0.9.8g 19 Oct 2007 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to yellow.example.com [199.82.114.103] port 22. debug1: Connection established. debug1: permanently_set_uid: 0/0 debug1: identity file /root/.ssh/identity type -1 debug1: identity file /root/.ssh/id_rsa type 1 debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048 debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048 debug1: identity file /root/.ssh/id_dsa type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-6ubuntu2 debug1: match: OpenSSH_5.1p1 Debian-6ubuntu2 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.1p1 Debian-6ubuntu2 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-cbc hmac-md5 none debug1: kex: client->server aes128-cbc hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host 'yellow.example.com' is known and matches the RSA host key. debug1: Found key in /root/.ssh/known_hosts:9 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,password debug1: Next authentication method: publickey debug1: Trying private key: /root/.ssh/identity debug1: Offering public key: /root/.ssh/id_rsa debug1: Server accepts key: pkalg ssh-rsa blen 277 debug1: read PEM private key done: type RSA debug1: Authentication succeeded (publickey). debug1: Local connections to LOCALHOST:3142 forwarded to remote address 192.168.1.8:80 debug1: Local forwarding listening on ::1 port 3142. debug1: channel 0: new [port listener] debug1: Local forwarding listening on 127.0.0.1 port 3142. debug1: channel 1: new [port listener] debug1: channel 2: new [client-session] debug1: Requesting [email protected] debug1: Entering interactive session. debug1: Sending environment. debug1: Sending env LANG = en_GB.UTF-8 Linux yellow 2.6.31-17-server #54-Ubuntu SMP Thu Dec 10 18:06:56 UTC 2009 x86_64 To access official Ubuntu documentation, please visit: http://help.ubuntu.com/ System information as of Thu Feb 18 09:31:36 GMT 2010 System load: 0.0 Memory usage: 51% Processes: 96 Usage of /: 1.3% of 194.04GB Swap usage: 0% Users logged in: 0 Graph this data and manage this system at https://landscape.canonical.com/ 18 packages can be updated. 13 updates are security updates. Last login: Thu Feb 18 09:26:14 2010 from gate.example.com root@yellow:~# ~# The following connections are open: #2 client-session (t4 r0 i0/0 o0/0 fd 6/7 cfd -1) root@yellow:~# netstat -lntp | grep 3142 root@yellow:~#
我不太理解你想达到的目标。 也许你把-L开关和-R开关混淆了?
你正在转发
chris-desktop:3142 to 192.168.1.8:80 via the sshd process on yellow.example.com
输出
root@yellow:~# netstat -lntp | grep 3142 root@yellow:~#
如预期的那样。 在yellow:3142上没有任何监听yellow:3142因为到192.168.1.8:80的连接正在由yellow的sshd进程pipe理。
执行时应该会看到一个侦听过程
root@chris-desktop:~# netstat -lntp | grep 3142