Skip to main content

How to open up firewalld to allow Mosh on CentOS 7

109 words·1 min

If you use intend to Mosh on CentOS 7 you’ll need to open up UDP ports (60001-60009) through firewalld. Here are directions on allowing the port range through firewalld on CentOS.

Add the following mosh.xml file:

<?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>

to /etc/firewalld/services/

Load the service into firewalld:

firewall-cmd --zone=public --add-service=mosh --permanent

Then reload the service:

firewall-cmd --reload

Mosh should now work on the client end.