Linux – Reset firewalld rules to default

centosfirewalldiptableslinuxSecurity

On CentOS 7 have I been trying out different firewalld rules and iptables commands, and now want to do it all over, but only using firewalld.

Question

How can I reset all rules to the default that CentOS 7's firewalld ships with?

Best Answer

Following piece of Code may be helpful for you.

for srv in $(firewall-cmd --list-services);do firewall-cmd --remove-service=$srv; done firewall-cmd --add-service={ssh,dhcpv6-client} firewall-cmd --runtime-to-permanent

Regards,

Ahmer Mansoor