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
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 192.168.2.1 port 30) is only one general example for how to "Deny access to port 30 from IP address 192.168.2.1". 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.