I have a list of ranges for IP addresses that I want to block, the ranges are like 210.80.32.0 to 210.80.63.255
How can I dynamically determine the right 210.80.32.0/NUMBER to capture the full range?
sudo ufw deny 210.80.32.0/???
I am reading these IP ranges in once a month from text files to add to my firewall rules, I tear the firewall down once a month and rebuild it to capture any changes in these ranges. Currently I am just doing lowerrange/20 in the rule.
So I need to get the two network values by splitting the string on . then do the math to determine how many there are.. and add a rule for each network?