Skip to content

Instantly share code, notes, and snippets.

@tboydar
Forked from jnovack/README.md
Last active August 29, 2015 14:22
Show Gist options
  • Save tboydar/0f0d6466c9b40097c0e7 to your computer and use it in GitHub Desktop.
Save tboydar/0f0d6466c9b40097c0e7 to your computer and use it in GitHub Desktop.

Mosh (mobile shell) is a gift from the Gods(tm). Anyone with spotty internet or wireless connection has suffered the pain of a lost SSH session. Sure, one can fire up screen (or tmux as the kids are using these days), but that's an extra step and you are still using the SSH protocol.

I'm not here to tout the benefits of Mosh, you came here to open it up in your firewall.

  1. Create the following file as /etc/firewalld/services/mosh.xml
  2. firewall-cmd --reload
  3. firewall-cmd --add-service=mosh --permanent

If you tend to have a lot of sessions (not recommended), you can increase the ports, but the default should be fine for most applications.

Never, ever, ever modify the files in /usr/lib/firewalld/, they will be overwritten on upgrade. firewalld will look for any customization files in /etc/firewalld/ first for any services/ or zones/, so edit or create files there.

<?xml version="1.0" encoding="utf-8"?>
<service>
<short>MOSH</short>
<description>Mosh (mosh.mit.edu) is a free replacement for SSH that allows roaming and supports intermittent connectivity.</description>
<port protocol="udp" port="60001"/>
<port protocol="udp" port="60002"/>
<port protocol="udp" port="60003"/>
<port protocol="udp" port="60004"/>
<port protocol="udp" port="60005"/>
<port protocol="udp" port="60006"/>
<port protocol="udp" port="60007"/>
<port protocol="udp" port="60008"/>
<port protocol="udp" port="60009"/>
</service>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment