Verified on Ubuntu 18.04.
Install mosh on both server and client hosts and coonect it:
sudo apt install mosh # on both server and client host
mosh yourname@1.2.3.4 # on client host
You could connect to mosh server right after installation with apt
,
without restarting SSH service or other operations.
Use IPv6 as is: mosh yourname@ed00:caf7:bb2a:feb4:0f99:9e5a:6a0e:ea79
.
Mosh can read SSH config defined in ~/.ssh/config. So with the following SSH config on client host:
Host yourserver
Hostname 1.2.3.4
User yourname
Or the IPv6 format:
Host yourserver
Hostname ed00:caf7:bb2a:feb4:0f99:9e5a:6a0e:ea79
User yourname
Now you can connect to server with mosh yourserver
.
Multi-hop with Mosh
Mosh hasn't implemented ProxyCommand
of SSH yet.
So you can only use multi-hop command manually.
ssh + mosh: ssh -A -t x84 mosh tc
ssh + mosh + ssh: ssh -A -t x84 mosh tc ssh algo
You need to define SSH aliases:
x84
on you client,
tc
on x84 host,
and algo
on tc host,
with their ~/.ssh/config respectively.
And add pub_key for no_password login.
For convenience, add alias stc='ssh -A -t x84 mosh tc'
in startup script.
Now you can ssh to tc server simply with stc
,
and ssh to algo with stc ssh algo
.
See note 'Multi-hop SSH' for details about ProxyCommand
and manual multi-hop of SSH.