Networking - ASN (Autonomous System Number) - Use an ASN to Create an IP Blocklist

For example to create a blocklist of IP addresses used by FaceBook:

whois -h whois.radb.net -- '-i origin AS32934' | grep ^route | grep -v route6 | cut -d" " -f7 > /var/www/block_lists/facebook.txt

NOTE: As IP addresses can change often in an ASN, it is important to update the blocklist regularly.

A cron job each day is suggested.

If used on pfSense, make a URL table alias that points to that facebook.txt file, then use the alias in rules as needed.