This article is a mirror article of machine translation, please click here to jump to the original article.

View: 422|Reply: 1

[linux] Rocky Linux 9 uses a ufw simple firewall

[Copy link]
Posted on 2025-10-28 09:05:49 | | | |
Requirements: Linux's firewalld and iptables firewalls are too complex and powerful, suitable for complex business scenarios. The full name of ufw is Uncomplicated Firewall, which means uncomplicated firewall. Its instructions are not only easy to remember, but the written rules are also simple and easy to understand, which is very convenient.

Review:
Practical combat: Linux uses firewall-cmd to manage firewalls
https://www.itsvse.com/thread-10859-1-1.html

CentOS7 View and turn off the firewall
https://www.itsvse.com/thread-7771-1-1.html


UFW installation

First, to install ufw, you need to enable the EPEL source, see below:
Rocky Linux 9 package not found: No match for argument: xxx
https://www.itsvse.com/thread-10789-1-1.html

The installation command is as follows:

The enabling command is as follows:

The default policy for UFW is:Deny all inbound connections by default, allow all outbound connections by default, routed packets are disabled by default (usually not enabled unless you do a gateway/NAT), you can view it with the following command:
As shown below:



Port policy

Allow or block ports with the following commands:

You can allow one range of ports at a time with the following command:

IP-based rules

For certain IPs, the command is as follows:

Allow specified IPs to access all ports:

Delete rules

If you want to delete a rule, the command is as follows:

other

Enable/Turn on/reset the firewall with the following commands:

(End)




Previous:vscode shell script debug plugin bash debug
Next:A bank app turns on the monitoring service
 Landlord| Posted on 2025-10-28 09:09:37 |
If you want to install a ufw firewall for the GUI interface, the command is as follows:

Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com