Difference between revisions of "Red Hat / Centos firewall"
From MyWiki
Line 16: | Line 16: | ||
sudo firewall-cmd --zone=home --change-interface=eth0<br> | sudo firewall-cmd --zone=home --change-interface=eth0<br> | ||
firewall-cmd --get-active-zones<br> | firewall-cmd --get-active-zones<br> | ||
+ | If the firewall is completely restarted, the interface will revert to the default zone: | ||
+ | sudo systemctl restart firewalld.service | ||
+ | firewall-cmd --get-active-zones | ||
+ | output | ||
+ | public | ||
+ | interfaces: eth0 eth1 |
Revision as of 11:13, 19 July 2016
Try this command firewall-cmd --permanent --zone=public --add-rich-rule="rule family="ipv4" \ source address="1.2.3.4/32" \ port protocol="tcp" port="4567" accept" Check the zone file later to inspect the XML configuration cat /etc/firewalld/zones/public.xml
firewall-cmd --state
sudo systemctl start firewalld.service
firewall-cmd --get-default-zone
firewall-cmd --get-active-zones
firewall-cmd --list-all
firewall-cmd --get-zones
firewall-cmd --zone=home --list-all
sudo firewall-cmd --zone=home --change-interface=eth0
firewall-cmd --get-active-zones
If the firewall is completely restarted, the interface will revert to the default zone: sudo systemctl restart firewalld.service firewall-cmd --get-active-zones output public interfaces: eth0 eth1