My work often requires me to access remote machines. Luckily, I’m fortunate enough to live in a part of the world with decent broadband, and my work has very fast and reliable networks.
Still, networks are not as reliable as we want them to be, and higher latency hurts ergonomics. Then I tried mosh, which claims to improve latency and also help smooth some of the rough edges of non-ideal network conditions.
Installation is a 2 part process. You have to install most-server on the server, and mosh-client on all your laptops and desktops at home.
I’m using a Mac laptop at home, so I installed through homebrew:
brew install mosh
The machine I’m working with right now is Debian 9, so I installed with apt, then make sure the port range is open for business:
sudo apt-get install -y mosh sudo iptables -I INPUT 1 -p udp --dport 60000:61000 -j ACCEPT sudo bash -c 'iptables-save > /etc/iptables/rules.v4'
In my case, I had to insert the rule (with
-I INPUT 1 ...) rather than append (with
-A INPUT ...) because the remote already has rules which seemed to conflict with mosh.
Instead of typing
ssh [email protected], I now type
mosh [email protected].
Mosh works with existing ssh aliases, too.
The most noticeable change is the lack of typing latency. This makes the remote feel snappier and, well, not remote at all.
For more information, check out this guide.