Search code examples
ubuntuipipv4cidr

Block ASN instead of IP/CIDRs on Ubuntu


I am planning to block too many IPs (60k CIDRs) so I am concerned about the performance of my f1.micro (512MB RAM) Ubuntu 18 server.

Is it possible to block ASN instead of blocking individual CIDRs?

If not possible then what would be the best practice to add entries into the server without having any performance issue?


Solution

  • A simple answer is no.

    Any computer that sends request to your server will only let you know its IP address and there is no automatic process to convert the IP address to ASN, hence there is no native matching process that can match an IP with its associated ASN..

    This will guide you on how ot efficiently block IPs on a Linux server. https://superuser.com/questions/810853/how-do-i-block-a-host-by-asn-example-as16276