|||
自己用台式机搭了个 GPU 服务器,但是 ssh 访问总是总是卡顿,按照网上建议已将 /etc/ssh/sshd_config 中的 GSSAPIAuthentication 置为 no,UseDNS 置为 no,但仍未明显改善。
看到有人说 mosh 连接较稳定,于是准备安装试试。
要使用 mosh,本地端与远端都需要安装 mosh。
本地安装:MacBook,OSX,没得说
$brew install mosh
顺利安装 mosh 及依赖包( brew 是 OSX 下的包管理工具)
服务器端:RHEL 6.5,使用国内 163 的 yum 源没有找到 mosh,只能从源码安装。
1. 安装依赖包 Protocol Buffers(https://github.com/google/protobuf),直接从源码安装,无依赖;
2. 安装 mosh 源码:
# ./configure PKG_CONFIG_PATH=/usr/local/lib/pkgconfig(安装Protocol Buffers的位置)
# make && make install
安装成功后,在服务器端运行 mosh-server 正常,但是在本地使用 mosh 远程访问服务器时出错:
mosh-server: error while loading shared libraries: libprotobuf.so.8: cannot open shared object file: No such file or directory。
远程启动服务器端 mosh-server 时找不到动态链接库文件,但是在服务器本地执行正常。没办法,在 mosh-server 的安装位置 /usr/local/bin 下编写了一个shell脚本加载动态链接库并启动:
# mv mosh-server mosh-server.bak
脚本内容:
#!/bin/sh
LD_LIBRARY_PATH=/usr/local/lib:/usr/lib exec /usr/local/bin/mosh-server.bak "$@"
使用脚本包装之后虽然可以启动连接,但显示
mosh: Nothing received from server on UDP port 60002. (8 s without contact.)
怀疑可以是防火墙阻止了 mosh。于是将服务器端的防火墙关闭:
1) 重启后生效
开启: chkconfig iptables on
关闭: chkconfig iptables off
2) 即时生效,重启后失效
开启: service iptables start
关闭: service iptables stop
之后就可以正常使用 mosh ,卡顿果然消失!
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-9-20 15:01
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社