To install Firewall Command In Centos_linux
30 October 2023 at 13:59
STEP 1:
Update your package repository
sudo yum update
STEP 2:
install firewalld
sudo yum install firewalld
STEP 3:
Start the firewalld service and enable it to start at boot:
sudo systemctl start firewalld
sudo systemctl enable firewalld
STEP 4:
You can check the status of the firewalld service:
sudo systemctl status firewalld
- That's it! You now have firewalld installed and running on your CentOS system. You can configure your firewall rules using the firewall-cmd command. Here are a few examples of how to use firewall-cmd to configure your firewall:
STEP 5:
Allow incoming traffic on a specific port (e.g., port 80 for HTTP):
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
STEP 6:
Reload the firewall to apply the changes:
bash:
sudo firewall-cmd --reload
STEP 7:
List all open ports in the default zone (usually "public"):
sudo firewall-cmd --list-ports
sudo firewall-cmd --list-all
STEP 8:
List all the services currently allowed through the firewall:
sudo firewall-cmd --list-services