By swbot
Hello,
How can I block IP range or entire country on CentOS 7 with FirewallD? The IP range starts with 180.76.15.* and is Chinese IP.
The command below works for single IP but not for range:
firewall-cmd --permanent --add-rich-rule="rule family='ipv4' source address='180.76.15.154' reject"
I tried with this command for the range but without success:
firewall-cmd --permanent --add-rich-rule=“rule family=‘ipv4’ source address=‘180.76.15/24’ reject”
Cheers
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!
Thank you xMudrii,
This command is executed successfully. Lets see if it works and the Chinese visitors from 180.76.15* will not have access to the site anymore.
Cheers, Ivo
You have to reload firewalld after adding a permanent rule.
firewall-cmd --reload
This comment has been deleted
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.