TIPS & TRICKS
To search the contents of the man pages
# man -k searchterm |
Manage Firewall
Maybe very hard to memorize, so, if needed :
# firewall-cmd -h | grep <pattern> |
Then ALREADY RELOAD THE CONFIG for APPLY CHANGES:
# firewall-cmd --reload |
Manage Firewall Example 1
| Refuse domain 172.25.0.0/16 to access the server.
# firewall-cmd --zone=block --add-source=172.25.0.0/16 --permanent |
Manage Firewall Example 2
| Remove the sshd service rule from the runtime configuration on server and try to access the server from the client using the ssh command
On the server
# firewall-cmd --remove-service=ssh |
Manage Firewall Example 3
| Determine the current active zone.
| Activate a permanent rule to allow HTTP traffic on port 80
| Then add a runtime rule for traffic intended for TCP port 443.
| Add a permanent rule to the internal zone for TCP port range 5901 to 5910.
| Confirm the changes and display the contents of the affected zone files.
| Switch the default zone to the internal zone and activate it
# firewall-cmd --get-default-zone |
Manage Firewall Example 4
| Remove the 2 permanent rules added above.
| Switch back to the public zone as the default zone, and confirm the changes
# firewall-cmd --remove-service=http --zone=public --permanent |
Manage Firewall Example 5
| Configurez firewalld
pour autoriser uniquement les connexions SSH et HTTP
| Bloquez tout autre trafic entrant
firewall-cmd --add-service=ssh --zone=public --permanent |
Manage Firewall Example 6
| Create a directory called /common and export it to server in read/write mode.
| Ensure that NFS traffic is allowed through the firewall.
| Confirm the export
In server1:
# mkdir /common |
Manage Firewall Example 7
| Download and Configure Apache to Serve index.html
from /var/web
and access it from the Host Machine
# yum -y install httpd |
Manage Firewall Example 8
| Determine the current active zone.
| Add and activate a permanent rule to allow HTTP traffic on port 80, and then add a runtime rule for traffic intended for TCP port 443.
| Add a permanent rule to the internal zone for TCP port range 5901 to 5910.
| Confirm the changes and display the contents of the affected zone files.
| Switch the default zone to the internal zone and activate it.
# firewall-cmd --get-default-zone |
Documentations
Internet
Git
ChatGPT