firewall in centos 7

firewall in centos 7

1. How to check firewall is working

firewall-cmd --state
systemctl firewalld status

2. How to know the firewall zone

firewall-cmd --get-default-zone

3. HOw to know the active zone on which card(interface)

firewall-cmd --get-active-zones

4. List of all acitve ports and services

firewall-cmd --list-all

5. List of all available zone

firewall-cmd --get-zones

6. How to change the zone of an interface

firewall-cmd --zone=home --change-interface=eth0

– And if want to change it permanently

vim /etc/sysconfig/network-scripts/ifcfg-eth0
zone=home

7. Output of all zone

firewall-cmd --list-all-zones | less

8.How to see the list of services available

firewall-cmd --get-services

9. How to know about the services available in server

vim /usr/lib/firewalld/services

10. How to add service

firewall-cmd --zone=public --add-service=https
firewall-cmd --zone=public --permanent --add-service=https

11. How to add port and any service in firewall centos 7

firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=80/udp
firewall-cmd --permanent --add-service=httpf
firewall-cmd--permanent --add-service=https

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.