Skip to content

Instantly share code, notes, and snippets.

@teknogeek0
Created September 30, 2012 19:52
Show Gist options
  • Save teknogeek0/3808283 to your computer and use it in GitHub Desktop.
Save teknogeek0/3808283 to your computer and use it in GitHub Desktop.
block ips from around the world.
IPTABLES="/sbin/iptables"
### block all Asian/APNIC IPs (includes NZ, AU)
$IPTABLES -A bad_stuff -s 58.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 59.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 60.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 61.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 110.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 111.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 112.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 113.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 114.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 115.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 116.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 117.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 118.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 119.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 120.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 121.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 122.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 123.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 124.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 125.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 126.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 169.208.0.0/12 -j DROP
$IPTABLES -A bad_stuff -s 175.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 180.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 182.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 183.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 202.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 203.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 210.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 211.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 218.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 219.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 220.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 221.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 222.0.0.0/8 -j DROP
### block all African(AFRINIC) IPs
$IPTABLES -A bad_stuff -s 41.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 154.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 197.0.0.0/8 -j DROP
### block off RIPE - europe, africa, middle east
$IPTABLES -A bad_stuff -s 62.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 77.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 78.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 79.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 80.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 81.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 82.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 83.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 84.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 85.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 86.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 87.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 88.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 89.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 90.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 91.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 92.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 93.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 94.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 95.0.0.0/8 -j DROP
### block all Latin America/LACNIC IPs
$IPTABLES -A bad_stuff -s 186.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 187.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 189.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 190.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 200.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 201.0.0.0/8 -j DROP
### block all US mill and DOD, and private company registered Anets
$IPTABLES -A bad_stuff -s 3.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 6.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 7.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 8.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 11.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 13.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 15.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 16.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 17.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 19.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 20.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 21.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 22.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 25.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 28.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 29.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 30.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 33.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 34.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 35.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 38.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 40.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 48.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 51.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 52.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 53.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 54.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 55.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 56.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 57.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 214.0.0.0/8 -j DROP
$IPTABLES -A bad_stuff -s 215.0.0.0/8 -j DROP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment