一:TCP over UDP
1、安装mosh
yum install epel-release
yum install mosh
2、使用客户端连接
mosh user@ip -p 60001
3、查看mosh的连接(默认UDP 60001端口,防火墙需放行)
netstat -unlp | grep mosh
二:纯UDP连接
1、启动mosh-server服务端
mosh-server new -c 256 -s -l LANG=en_US.UTF-8 -p 60000
显示如下:
MOSH CONNECT 60000 3aaxFsHQzzL6pb35pDzC+Q mosh-server (mosh 1.3.0) [build mosh 1.3.0] Copyright 2012 Keith Winstein <mosh-devel@mit.edu> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
2、使用生成的key通过mosh-client连接
MOSH_KEY=9S9Bz/KDYVMNyiJg2267nw mosh-client ip 60000
备注:如果提示字符集问题,请在~/.bashrc中添加
export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8
最后,推荐一个通过浏览器直接访问终端的工具gotty(https://github.com/yudai/gotty)