I'm trying to put in some country blocks already in my router to avoid my server logs being filled up by attacks from certain countries. So in order to have these rules inserted before any virtual server NAT redirection i have added these rules in the nat table's PREROUTING chain which, in my understanding, is the earliest possible action the router takes with incoming packets.
Something like
iptables -t nat -I PREROUTING -p all -m set --set blacklist src -j DROP
where the "blacklist" is an ipset hashlist of all addresses to block. This seems to work well but since I'm far from an expert on iptables (nor do I want to be ... ) I was just seeking a second opinion if this is the "right" way to do it?
Something like
iptables -t nat -I PREROUTING -p all -m set --set blacklist src -j DROP
where the "blacklist" is an ipset hashlist of all addresses to block. This seems to work well but since I'm far from an expert on iptables (nor do I want to be ... ) I was just seeking a second opinion if this is the "right" way to do it?