Skip to content

Instantly share code, notes, and snippets.

@jdraths
Created June 13, 2019 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdraths/8dd6aabaa9771c09589af9fbc63102a1 to your computer and use it in GitHub Desktop.
Save jdraths/8dd6aabaa9771c09589af9fbc63102a1 to your computer and use it in GitHub Desktop.
# install it
apt-get install ipset
# create a blacklist
ipset create blacklist hash:ip hashsize 4096
# add the blacklist to your iptables rules
iptables -I INPUT -m set --match-set blacklist src -j DROP
iptables -I FORWARD -m set --match-set blacklist src -j DROP
# check that rule is set in iptables
iptables -L
# now add the offending ip address
ipset add blacklist WW.XX.YY.ZZ
# check that the ip address is in your blacklist
ipset list blacklist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment