【发布时间】:2016-06-21 16:24:07
【问题描述】:
我在使用 OpenVPN 和 SSH(以及其他服务)时遇到问题:
我可以在没有任何错误消息的情况下连接到 VPN。 如果我想通过 SSH 连接到 VPN 内的计算机,我会收到错误消息:“ssh_exchange_identification: read: Connection reset by peer”。
这个问题发生在哪台机器上每天都不同,连接到连接。
$ ssh root@storage -vvv
OpenSSH_6.9p1, OpenSSL 1.0.1k-fips 8 Jan 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to storage [192.168.1.5] port 22.
debug1: Connection established.
debug1: identity file /home/ewald/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ewald/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ewald/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ewald/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ewald/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ewald/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ewald/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ewald/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
ssh_exchange_identification: read: Connection reset by peer
如果我可以连接到 VPN 内的另一台机器,我可以通过 SSH 连接到我的目标。 此外,我尝试在远程路由器上为端口 22 配置端口转发,并经常通过此转发从我的客户端连接,它始终有效,所以我认为问题不在于 SSH 服务器或客户端配置。
所以我在 OpenVPN 配置中尝试了许多设置(不同的 link-mtus、tcp 而不是 udp、禁用 lzo、...),将其安装在另一台机器上(默认 OpenVPN 服务器在 Ubuntu 12.04 VM 中。我试过了也将其安装在裸机上)并且没有任何改变。
自从第一次出现问题以来,甚至更改了 ISP(从 DSL 到 Fiber)。
其他客户端机器也存在问题:使用粘度的 macbook(tunnelblick 也不起作用),几个 linux 机器:fedora、ubuntu、...
有时我也没有收到来自 HTTP 服务器的答复(即使我可以使用 SSH 连接到它) HTTP服务器本身可以从内部网络和我的SSH隧道(使用它作为SOCKS代理)访问,所以问题一定是OpenVPN连接。
谁能帮帮我?如果连接本身有问题,我该如何检查?
TCP 转储:
$ sudo tcpdump -i tun0 dst port 22
15:56:17.689847 IP myclient.60920 > storage.ssh: Flags [S], seq 729708226, win 29200, options [mss 1460,sackOK,TS val 3108117687 ecr 0,nop,wscale 7], length 0
15:56:17.717556 IP myclient.60920 > storage.ssh: Flags [.], ack 2044707578, win 229, options [nop,nop,TS val 3108117714 ecr 1518717699], length 0
15:56:17.717949 IP myclient.60920 > storage.ssh: Flags [P.], seq 0:21, ack 1, win 229, options [nop,nop,TS val 3108117715 ecr 1518717699], length 21
15:56:17.945811 IP myclient.60920 > storage.ssh: Flags [P.], seq 0:21, ack 1, win 229, options [nop,nop,TS val 3108117943 ecr 1518717699], length 21
【问题讨论】:
标签: http ubuntu networking ssh openvpn