The official "securing your pi" guide from the Raspberry Pi foundation recommends installing the "uncomplicated firewall" (ufw) and adding a rule to deny access to port 30 from

sudo ufw deny from port 30

The guide doesn't give any justification for this recommendation and my googling hasn't turned up anyone else recommending blocking this port or anything about risky protocols that communicate on port 30. The only info I have found is that it looks like some splinter cell games communicate over port 30 and that is often a default address for routers.

What the intent is of this rule and what protection is afforded by implementing it?

  • 6
    There is no such recommendation - it is an example
    – Milliways
    Oct 31, 2018 at 6:20

1 Answer 1


In the preface of Securing your Raspberry Pi the author says:

This documentation will describe some ways of improving the security of your Raspberry Pi.

This is followed by a conglomeration of options. I would name it "best practice list":

  • Change your default password
  • Changing your username
  • Make sudo require a password
  • Ensure you have the latest security fixes
  • Improving SSH security
  • Improving username/password security
  • Using key-based authentication
  • Install a firewall
  • Installing fail2ban

It may or may not be sensible to implement them:

What level of security you need depends on how you wish to use your Raspberry Pi.

The specific code your question is about (sudo ufw deny from port 30) is only one general example for how to "Deny access to port 30 from IP address". Like @Milliways already commented, this is not a (mandatory) recommendation. You will not necessarily end up with an insecure device if you do not block port 30 for the given IPv4 address. If you need to block a different IPv4 address and maybe a different port number, now you know how to do it using ufw:

sudo ufw deny from [placeholder_for_IPv4_address] port [placeholder_for_port_number]

The documentation could be more clear about this and point out, that this code is just an example. If you want, use the link in the documenations footer and help to improve it: View/Edit this page on GitHub.

  • 2
    The documentation could be more clear about this and point out, that this code is just an example it actually does exactly that. Just above the lines OP comments on it says but here are some examples of more sophisticated commands
    – Dirk
    Oct 31, 2018 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.