Useful Snippets

Welcome!


This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!

Are your smart devices spying on you? Make better purchasing choices and find products that respect your privacy at Unwanted.cloud

RSS Latest posts from my personal blog


Most viewed posts


Subscribe to RSS feed


iptables rules for Mosh connections

Stanislav KhromovStanislav Khromov

Mosh reqires UDP 60000-61000 to be open and accent connections for it to work. Here is the iptables rule to add that:

sudo iptables -A INPUT -p udp -m multiport --dports 60000:61000 -j ACCEPT

Don’t forget to save the config once you are done, on CentOS the command to save the iptables config to disk is:

service iptables save 

Source

Web Developer at Aftonbladet (Schibsted Media Group)
Any opinions on this blog are my own and do not reflect the views of my employer.
LinkedIn
Twitter
WordPress.org Profile
Visit my other blog

Comments 3
  • Martin Brampton
    Posted on

    Martin Brampton Martin Brampton

    Reply Author

    Helpful, but should be –dport (no s)


    • Stanislav Khromov
      Posted on

      Stanislav Khromov Stanislav Khromov

      Reply Author

      Hi Martin!

      Thanks for your comment. I’ve tried to read up on the difference between -dport and –dports but they seem to be the same command. Could you enlighten me on the difference? :-)


  • Martin Brampton
    Posted on

    Martin Brampton Martin Brampton

    Reply Author

    Well, I’ve never used dports myself! But looking up the man page for iptables at https://linux.die.net/man/8/iptables indicates that –dports is followed by a list of up to 15 ports, separated by commas. This is different from –dport which will accept either a single port or a range of ports, separated by colon. Obviously in this case you couldn’t list out all the ports that are being enabled, so –dport is the correct option to use, along with the range.