By monicat
Using a fresh build of CentOS 7.3, I am attempting to follow the tutorial at https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-using-firewalld-on-centos-7
However there are no active zones when I use “sudo firewall-cmd --get-active-zones” as per the tutorial. I believe this is due to no network interface being bound to a zone. Using comand “sudo firewall-cmd --zone=public --list-all public”. I can see that there are no interfaces bound to the public zone (which I presume is what I need). I have used:
But I don’t think any of this is helping without an active zone. My goal is to have ports 80 and 443 show as opened after an external port scan, but they continue to show as closed. Please advise.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
To assign an interface to a zone, run:
- sudo firewall-cmd --zone=public --change-interface=eth0
Here is another useful command:
- sudo firewall-cmd --get-zone-of-interface=eth0
It allows you to find which zone to which a particular interface is bound.
I just build a Centos 7.5 system and my interfaces weren’t assigned to any zone. I added source ip ranges to trusted and created a few other zones with source ip ranges. All the zones plus the rules in the public zone are working.
I don’t know if it’s a bug or a feature, but not having to force an interface to a zone seems to be beneficial.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.