-
-
Save hamzamu/1f265c97e5424804eedc6babb2a76f74 to your computer and use it in GitHub Desktop.
Block a list of IP ranges using IPSet and IPTables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Script to process ip ranges to ban using IPSet and IPTables | |
ipset create countryblock hash:net | |
while read line; do ipset add countryblock $line; done < blocklist.txt | |
iptables -I INPUT -m set --match-set countryblock src -j DROP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment