This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Best way for mass CIDR blocks.

This question is for anyone, but I think it was Barry who mentioned this before.

I am blocking a huge number of CIDR address with Banish in IPCop. Someone, again I think Barry, said there was a better way to block all of these addresses.

Can someone please tell me what thay way is, and how to do it!?

I am blocking all of China, Russia, Brazil, and a dozen other countries.  Over a MILLION IP's! I would like to roll this over to the astaro.

If anyone wants the full CIDR list, just let me know. I keep it in Excel for easy export.  It is in Banish format but can be exported with just the CIDR's.

Thanks!


This thread was automatically locked due to age.
  • You can create "supernets" of adjacent networks, which reduces the number of CIDRs.

    e.g. 
    8.0.0.0/8 

    9.0.0.0/8 

    8.0.0.0/7


    It's harder to do it by country than it is to do by region/Registry, as the allocations are so fragmented. e.g. If you want to block all of Latin America, you can get the blocks assigned to LACNIC.
    This isn't as easy as it sounds though...
    I wanted to block email from Asia (spam), but Australia is part of APNIC.
    We wanted to block fraudsters on our website from Africa, but AfriNIC is new and much of Africa is on RIPE or on US (Arin) satellite networks.

    Anyways, several years ago, I blocked of much of the world from spamming us with only about 2 dozen CIDR defs.

    Sources and references:
    IP  Country database at LUDOST.NET
    http://www.iana.org/assignments/ipv4-address-space/
    Slashdot | Blocking a Nation's IP Space
    Okean - Spam Intro
    Bad IP addresses (BBL) (out of date?)
    http://www.cymru.com/Documents/bogon-bn-agg.txt (reserved or non-public networks)
    The Team Cymru Bogon List v4.7 31 JAN 2009

    edit: some of the above are out of date; ftp://ftp.arin.net/pub/stats/ has up-to-date allocation info, but apparently only by ASN #.

    Barry
  • I know two continuous lines like 77/8 and 78/8 can be done as 77/7... but what about a huge block like this? Do I go down one (/6) for three lines and then /5 for four?  What is the fewest number of lines that will cover this entire range? I take it this works just like subnetting, but in the other direction.

    077/8   RIPE NCC
    078/8   RIPE NCC
    079/8   RIPE NCC
    080/8   RIPE NCC
    081/8   RIPE NCC
    082/8   RIPE NCC
    083/8   RIPE NCC
    084/8   RIPE NCC
    085/8   RIPE NCC
    086/8   RIPE NCC
    087/8   RIPE NCC
    088/8   RIPE NCC
    089/8   RIPE NCC
    090/8   RIPE NCC
    091/8   RIPE NCC
    092/8   RIPE NCC
    093/8   RIPE NCC
    094/8   RIPE NCC
    095/8   RIPE NCC 

    Thanks,

    C68
  • Hi,
    Best to use a subnet calculator and check the ranges for each mask...
    A free one for Windows is here.
    Note that if you have Windows XP set to "Large Fonts" that the tabs at the top are hard to see.
    The CIDR tab seems to be the simplest for this purpose.

    You'll find that the 77 network can't be supernetted with the others, etc.

    I think you can cover these with
    77/8
    78/7
    80/5
    88/5

    Barry
  • When I tried 77.0.0.0/7 and Astaro balked at it... I decided just type them all in since it was not very many.

    Thanks Barry!

    C68




  • Anyways, several years ago, I blocked of much of the world from spamming us with only about 2 dozen CIDR defs.


    Barry


    do you have that list?
  • Hi, 
    Currently I only block AfriNIC... last I checked that was just
    41.0.0.0/8 
    196.0.0.0/8
    but it's been quite awhile.
    Note however that most of Africa is still registered through RIPE or even ARIN.

    I used to block all of APNIC for E-Mail, but as Australia and NZ are in APNIC, it could be problematic even if you don't communicate with Asian countries.
    Last I checked, APNIC could be expressed as 13 CIDRs, e.g.
    112.0.0.0/5
    120.0.0.0/6
    ...

    If you want to block e-mail from all of Europe, you can block RIPE (keep in mind that Astaro is in .DE!).

    LACNIC covers most of Latin America and some of the Caribbean.

    Please see the links in my post above on how to find the lists by NIC and/or Country, and keep in mind that you can create 'supernets' by combining CIDRs.

    Barry
  • Might be easier to use RBL for that.

    One option is to use one that already exists (astaro does that too), or tell it to use one you set up yourself.
    Then you don't have to do the clickety click on the astaro UI, but can paste the whole thing into the DNS you use for RBL queries.
  • Hi, I know about RBLs for anti-spam, but RBLs don't help if you're trying to block scammers from posting fraud on your web site.

    Barry
  • Current APNIC blocks:
    1/8
    14/8
    27/8
    36/8
    42/7
    49/8
    58/7
    60/7
    101/8
    110/7
    112/5
    120/6
    124/7
    126/8
    133/8
    150/8
    153/8
    163/8
    171/8
    175/8
    180/8
    182/7
    202/7
    210/7
    218/7
    220/6

    aggregated from IANA IPv4 Address Space Registry

    Note I'm not currently using Astaro's geoIP blocking due to the following limitations:
    1. can't choose by protocol (e.g. block mail but allow web traffic)
    2. can't allow outgoing but block incoming
    3. can't whitelist or override; e.g. can't allow a user/network in S. Africa while blocking the rest of S. Africa

    Barry
  • When I tried 77.0.0.0/7 and Astaro balked at it... I decided just type them all in since it was not very many.

    Thanks Barry!

    C68

    What you are writing (or trying to) is netword adresses. 77.0.0.0/7 is not a netword address. If what you are trying to do is include 77.0.0.0/8 and 78.0.0.0/8 you have to write both with /8 to have it correct. 76.0.0.0/7 would be a correct address though, just that it would imply 76.0.0./8 and your 77.0.0.0/8.

    You should realy read up on ip classes and subneting.

    Some links on IP network and subnetting:
    http://support.microsoft.com/kb/164015
    http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a00800a67f5.shtml
    http://www.techrepublic.com/article/ip-subnetting-made-easy/6089187
    http://en.wikipedia.org/wiki/Subnetwork