Ubuntu

未能實現到新的 ubuntu 10.04 伺服器的隧道

  • June 13, 2020

我剛剛設置了一個新的 10.04 伺服器,但無法讓隧道工作。

本地機器

ssh -L 9090:localhost:9090 admin@xxx.xx.xx.xxx

登錄成功,但隨後從本地瀏覽器嘗試隧道,http://127.0.0.1:9090

在伺服器終端回顯:

channel 3: open failed: connect failed: Connection refused

auth.log:

sshd[24502]: error: connect_to localhost port 9090: failed.

iptables -L

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination  

9090在伺服器上嘗試(links http://xx.xxx.xx.xx:9090工作)

sshd_config與之前的 8.04 伺服器相同,工作正常。

這是怎麼回事?

詳細輸出 (-vvv)。

登錄成功。根據本地瀏覽器的隧道請求,在伺服器終端:

ebug1: Connection to port 9090 forwarding to localhost port 9090 requested.
debug2: fd 9 setting TCP_NODELAY
debug3: fd 9 is O_NONBLOCK
debug3: fd 9 is O_NONBLOCK
debug1: channel 3: new [direct-tcpip]
channel 3: open failed: connect failed: Connection refused
debug2: channel 3: zombie
debug2: channel 3: garbage collecting
debug1: channel 3: free: direct-tcpip: listening port 9090 for localhost port 9090,  connect from 127.0.0.1 port 57884, nchannels 4
debug3: channel 3: status: The following connections are open:
 #2 client-session (t4 r0 i0/0 o0/0 fd 6/7 cfd -1)

debug3: channel 3: close_fds r 9 w 9 e -1 c -1

請注意,埠 9090 回复

# links 127.0.0.1:9090

在工作機器上:(8.04)

應要求:

debug1: Connection to port 9090 forwarding to localhost port 9090 requested.
debug2: fd 10 setting TCP_NODELAY
debug3: fd 10 is O_NONBLOCK
debug3: fd 10 is O_NONBLOCK
debug1: channel 3: new [direct-tcpip]
debug2: channel 3: open confirm rwindow 2097152 rmax 32768
debug2: channel 3: rcvd eof
debug2: channel 3: output open -> drain
debug2: channel 3: obuf empty
debug2: channel 3: close_write
debug2: channel 3: output drain -> closed

問候 //t

基於此執行緒,我認為您的問題的原因可能是 Apache,而不是 sshd。

嘗試將 httpd.conf 文件中的 Listen 指令更改為

聽 127.0.0.1:9090

之後重新啟動httpd,看看是否有什麼不同。

引用自:https://serverfault.com/questions/217992