New CIDR data format for IP2Location & IP2Proxy data

CIDR data format for IP2Location & IP2Proxy data

Introduction

For those unfamiliar with CIDR, it stands for Classless Inter-Domain Routing — a method for allocating IP addresses and routing Internet traffic more efficiently than the traditional class-based system. The CIDR data format groups IP addresses into flexible blocks, making it ideal for modern network management and data processing tasks.

Older class-based system

Prior to the introduction of CIDR, 32-bit IPv4 addresses were allocated based on classes. Each class has a fixed number of bits to be used as an address within a subnet.

E.g.

Class A uses a prefix of 8 bits to denote the network, with the remaining 24 bits being used as addresses.

Class B uses a prefix of 16 bits to denote the network, with the remaining 16 bits being used as addresses.

Class C uses a prefix of 24 bits to denote the network, with the remaining 8 bits being used as addresses.

Such rigidity in the allocation of the IP addresses causes unnecessary addresses to be allocated. Unused addresses mean other parties are being deprived of the IP addresses. This also contributed to the IPv4 address exhaustion.

Classless Inter-Domain Routing (CIDR)

CIDR was introduced to counter the flaws and inflexibility of the original class-based system. By using CIDR, network administrators can divide network addresses into the granularity that they need for assignment to users. This will optimize the allocation of IP addresses to reduce IP address wastage. In addition, CIDR supports more efficient routing, a.k.a. supernetting or route aggregation, to simplify route management with a smaller routing table.

E.g.

<ip address>/20 equals 4096 addresses.

<ip address>/28 equals 16 addresses.

New CIDR Format Offered by IP2Location

IP2Location now offers download of geolocation databases based on CIDR. Users have requested for CIDR data over the years, hence IP2Location has now come up with CIDR formats of our geolocation database as well as our IP2Proxy Proxy Detection databases.

Below are a few lines of the CIDR version of the DB26 database.

1.0.6.0/24,"AU","Australia","Victoria","Melbourne","-37.814007","144.963171","3000","+10:00","GTelecom Pty Ltd","gtelecom.com.au","DSL","61","03","ASXX0075","Melbourne","-","-","-","13","ISP","U","IAB19-18","Melbourne","38803","GTelecom Pty Ltd"
1.0.7.0/24,"AU","Australia","Queensland","Warren","-23.500000","150.283330","4702","+10:00","GTelecom Pty Ltd","gtelecom.com.au","DSL","61","07","ASXX0080","Mount Morgan","-","-","-","49","ISP","U","IAB19-18","Rockhampton","38803","GTelecom Pty Ltd"
1.0.8.0/21,"CN","China","Guangdong","Guangzhou","23.127361","113.264570","510140","+08:00","ChinaNet Guangdong Province Network","chinatelecom.com.cn","DSL","86","020","CHXX0037","Guangzhou","460","03/11","China Telecom","11","ISP/MOB","U","IAB19-18","Yue Xiu Qu","-","-"
1.0.16.0/24,"JP","Japan","Tokyo","Tokyo","35.689497","139.692317","100-0000","+09:00","I2TS Inc.","mediaindex.co.jp","T1","81","042","JAXX0085","Tokyo","-","-","-","37","DCH","U","IAB19-11","Shinjuku City","2519","Arteria Networks Corporation"

Below are a few lines of the CIDR version of the PX12 database.

1.0.0.0/24,"DCH","AU","Australia","Queensland","Brisbane","APNIC and CloudFlare DNS Resolver Project","cloudflare.com","CDN","13335","CloudFlare Inc.","1","-","-","0"
1.0.16.0/24,"DCH","JP","Japan","Tokyo","Tokyo","I2TS Inc.","mediaindex.co.jp","DCH","2519","Arteria Networks Corporation","1","-","-","3"
1.0.17.0/24,"DCH","JP","Japan","Tokyo","Tokyo","I2TS Inc.","mediaindex.co.jp","DCH","-","-","1","-","-","3"
1.0.18.0/24,"DCH","JP","Japan","Tokyo","Tokyo","I2TS Inc.","mediaindex.co.jp","DCH","-","-","1","-","-","3"

Common uses of CIDR geolocation or proxy data

Website operators often have to block users from various countries for licensing purposes or to block malicious activities. They can utilize configuration file in Apache or Nginx to block or grant access to users based on their IP addresses. These configuration files can be inserted with the necessary CIDR to regulate web visitors from certain regions or countries.

For example, the Apache configuration to block all users except those IP addresses specified by the CIDR listed.

<Directory "/var/www/html">
    Require all denied
    Require ip 175.136.0.0/13
    Require ip 110.159.0.0/16
    Require ip 202.75.32.0/19
</Directory>

Another example, the Nginx configuration that performs similar task.

location / {
    allow 175.136.0.0/13;
    allow 110.159.0.0/16;
    allow 202.75.32.0/19;
    deny all;
}

Network admins also frequently have to block bots from their networks. They can easily do this using the CIDR data from IP2Proxy to block proxy servers and bots.

E.g., using iptables in Linux

iptables -A INPUT -s 203.0.113.0/24 -j DROP

Conclusion

Now, with the option to obtain IP2Location geolocation data or IP2Proxy proxy data in CIDR format, users have greater flexibility to integrate the data with tools that require CIDR input. There’s no need to manually convert IP number ranges into CIDR, streamlining workflows and improving efficiency. This allows users to maximize the value of the geolocation and proxy detection data. The data is also available in BIN, CSV, and Parquet format for broader compatibility across different systems and platforms.


THE POWER OF IP GEOLOCATION

Find a solution that fits.


Was this article helpful?

Related Articles