This Bash script blocks all IP prefixes associated with an ASN (Autonomous System Number). An ASN is a unique identifier assigned to a group of IP addresses managed by an autonomous organization. This can be particularly useful for network administrators and security professionals who need to block traffic from specific networks known for malicious activity.
Blocking IP addresses by ASN can be a more efficient way to manage network security. Instead of blocking individual IP addresses or smaller subnets, you can block entire ranges associated with an organization. This is especially useful in situations where you need to mitigate threats from known malicious networks or reduce unwanted traffic from specific regions.
- Blocks both IPv4 and IPv6 addresses.
- Uses the
whoiscommand to obtain IP prefixes associated with a given ASN. - Utilizes
iptablesandip6tablesto implement the blocks.
whoiscommand installediptablesandip6tablesinstalled and configured
- Ensure you have
whois,iptables, andip6tablesinstalled on your system. - Clone this repository.
- Run the script with the ASN you want to block.
./ASN_IPTables_Blocker.sh <ASN>