"ssh example.com"挂起,但"ssh example.com bash -i"没有

Ast*_*ios 6 ssh login netcat

我每天都会遇到一种非常奇怪的现象

从我的大学互联网连接,sshing到我的机器("ssh example.com")工作没有任何问题.

从我的家庭adsl,"ssh example.com"我的控制台卡住了这条消息:

debug1: Server accepts key: pkalg ssh-rsa blen 533
debug1: Enabling compression at level 6.
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
Run Code Online (Sandbox Code Playgroud)

有时它可能会让我进入,但在大多数情况下不会.有趣的是,如果我执行"ssh example.com bash -i",我会立即登录.

Ast*_*ios 11

我终于找到了问题的根源.它与SSH类型的服务(ToS)TCP数据包有关.

当您要求常规ssh teminal时,ssh将TCP数据包服务类型(ToS)设置为"interactive".我住所的路由器阻止了这些数据包类型!

使用netcat,隧道TCP数据包不会获得任何类型的服务指令.因此,如果通过netcat隧道传输所有ssh流量,则将TCP数据包的ToS重置为默认值.

在.ssh/config中,您必须设置:

Host *.example.com
    ProxyCommand nc %h %p
Run Code Online (Sandbox Code Playgroud)

因此,每次尝试ssh到example.com时,都会调用netcat并对数据包进行隧道传输.


Joe*_*Joe 9

OpenSSH 5.7开始,您可以将其添加到您的ssh配置文件(〜/ .ssh/config或/ etc/ssh/ssh_config):

Host *
  IPQoS 0x00

这是解决Asterios确定的问题的更直接的方法.