Skip to content

Country IPv6 ranges

Many comments in http://blog.erben.sk/2014/02/06/country-cidr-ip-ranges/ was about IPv6 support.


Since there was change how RIRs report IPv6 ranges in their list – now using /mask notation, I have updated my script to include IPv6.
Enjoy!

2 thoughts on “Country IPv6 ranges”

  1. Hi,

    Thanks for your tool!

    Sadly, the script can’t work on ROS 7.3 as the IPv6 is no more a plugin and is activated by default. Could you manage to remove in the script the plugin detection to make it work with ROS 7.x ?

  2. !!! Warning: http://www.iwik.org/ipcountry/ !!!

    I found extra false entries in SE.cidr and discovered IP addresses, e.g 103.78.107.0/24 that belong to India!

    Create your own list with python or bash script instead.

    Bash script:
    #!/usr/local/bin/bash
    curl -o /tmp/delegated-ripencc-latest ftp://ftp.ripe.net/pub/stats/ripencc/delegated-ripencc-latest
    ipv4_file=”/usr/local/geo/se_ipv4.cidr”
    ipv6_file=”/usr/local/geo/se_ipv6.cidr”
    gawk -F’|’ ‘/ipv4/ && /SE/ {
    net = $4;
    cidr = $5;
    prefix = 32 – log(cidr)/log(2);
    printf “%s/%d\n”, net, prefix;
    }’ /tmp/delegated-ripencc-latest > “$ipv4_file”
    gawk -F’|’ ‘/ipv6/ && /SE/ {
    net = $4;
    cidr = $5;
    prefix = 128 – log(cidr)/log(2);
    printf “%s/%d\n”, net, prefix;
    }’ /tmp/delegated-ripencc-latest > “$ipv6_file”

Leave a Reply

Your email address will not be published. Required fields are marked *