About
Everything You Wanted to Know About Country IP Blocks
Are you frustrated with malicious attacks originating from specific countries?
We were too! We responded to these threats by creating a database filled with country specific network data. The output of this data enables you to block or allow as few or as many countries as your security requires.
We exist to help protect your security
Country IP Blocks was created as a resource to protect servers, systems and websites from spam, malware, cross-site scripting, website hijacking, hacking, cracking and other malicious activities. When properly implemented, using our network data in your security scripts, firewalls, Access Control Lists or .htaccess files will dramatically improve your I.T. security.
The Country IP Database
Our database contains up to the minute network information on nearly 250 countries worldwide. We provide the data free of charge in CIDR and Netmask format.
We Update Our Database Daily
Our Country IP Database was designed with two goals in mind: Accuracy and availability. The database is derived directly from the Registry sources and is updated as often as the Regional Registries provide new or altered network allocations. This means we update our entire Country IP Database at least daily or more often as required.
We Want to Help Webmasters
Using our Country IP Database, webmasters can instantly create .htaccess deny and .htaccess allow files. Webmasters can easily block the country or countries of their choice by making a simple selection.
We Are a Resource to Networking Professionals
Accurate network data is important to Information Technology Professionals and Network Administrators. Those responsible for the security of your network can be assured they are getting the most accurate data available from the registrars. We offer the choice of CIDR or Netmask formats and instantly generate the data of choice.
Coming soon we will offer a greater variety of security scripts with Access Control Lists (ACLs) in vendor formats.
We Made our Database Searchable
All allocated network addresses are completely searchable in the Country IP Database. The Search results reveal the country and network data related to the IP search string.
We Provide Custom Network Data Services
Our programmers and database administrators can create custom scripts and custom data streams for your special needs. Contact us for more details.
We Want to Be Part of Your Web Security
We provide image and text links for your websites. Country IP Blocks data is free to use. We only ask that you let the world know you are serious about security by adding a link to Country IP Blocks on your website.
Stop Malicious Activity Now
The internet will never be completely secure; but you can take measures to reduce the number of attacks against your networks, systems and websites when you preemptively block problem countries. Why wait? Start using Country IP Blocks today!
After blocking Russia/China/Europe & Africa the malicious unregulated individuals from Russia (Mostly Ukraine) went after the spam device units. I had already blocked the ROGUE ranges from ALL of these countries. However, they managed to perform a Denial of Service attack on the Barracuda(s).
However, they were NOT able to reach any of the email servers, web_servers and the IP(s) got put into the Firewall Appliance!
I use this site almost everyday, it has saved the email servers from these malicious attacks that the iptables had no problem dropping their connection so they get ‘dead air’.
The damage they could have done to the email server(s), by trying to fill up the queue or brute_forcing the Linux boxes.
As one person noted Vietnam is horrible, but I am finding the Russian Federation/India/China to all be in the same league of polluted sewer traffic.
I wish they could have their own network, segregated out so they could enjoy spamming/hacking/DoS_attacks to themselves.
Keep up the EXCELLENT work!
Is there a way to contact your to ask some questions about changing to SSL?
Go ahead and send us a message through here. If you want your message and our response to remain private, let us know. If you choose privacy send us your contact info and we’ll respond directly (as time permits).
@Stewart White
Hi Stewart, thanks for your response. The app sounds interesting, but I’m not in any pressing need here, just doing some research on spam-blocking approaches. So I’ll wait for your final release and check it out then. Security would be a big concern BTW (I’d be leery of any automatic ACL-update feature or web-based login form). And on a shared server can’t be something running continuously in the background.
A general issue I just found is that (if I’m not mistaken) a rotating IP I myself had today from ATT in California is not on the US list — 75.36.xxx.xxx range. That seems to make an “allow US only” approach unusable. (You might warn people of this and recommend only using “exclude” instead.)
Getting back to my concept of “coarser” ranges, is there some reason why even giant blocks like this can’t be used, if you for example just want to block anything outside ARIN (US/Canada)?:
http://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.xml
Has ARIN redistributed some of its assigned IP blocks to other regions or something??
The plan for the webmaster product is to create a login section (it would exist on their server) where a user could select which countries he/she wanted to block/allow. The ACL updates would not be automatic. A user would select what, when and how they wanted to update their lists. They would then select a country or list of countries to allow or deny. The only thing they would get from us is the scripts and access to the updated country lists.
As for the general issue you mention, 75.36.xxx.xxx is listed on the US list. This network is found in the 75.0.0.0/10 block.
Years ago you may have been able to allow/block countries using “giant” blocks. Unfortunately, current country assignations no longer consist of continuous or contiguous networks. In many cases there are small and large networks from various countries that break up the continuity. Therefore, relying on monster sized blocks my create unforseen circumstances.
Can you clarify your question?
I worry about the server load/response time of running these gigantic lists. (I’d be doing it as htaccess on a hosted shared server.)
What would be useful as an alternative is a coarser approach using larger ranges of IP’s that will allow/block “most” of what you’re trying to do without worrying about being absolute.
I’d personally like a coarse list that will intentionally allow all US/Canada IP’s (this must be certain), while blocking as much of the rest of the world as possible. IP’s from Western Europe/Australia/NZ/Japan OK to let in as efficiency dictates. A target of like maybe 1000 IP ranges listed in total in the htaccess file.
With a few versions expanding this to Western Europe, etc. and the needs of most administrators could be met. If Mongolia gets blocked along with Nigeria not a crisis for a US celebrity gossip blog.
You could store your ACL in a database format. The lookups should be faster and less resource intensive than loading a large .htaccess file.
We are getting close to releasing a php/mysql application that will allow you to select the ranges you want to deny/allow and then respond as needed. We may have a beta version available in a few days. Is this something you would be interested in?
It would be nice if you made your data available in bulk (e.g. via a compressed zip file). That way we wouldn’t have to crawl your /e_country_data directory to get it all
Similarly, if you had a weekly “delta changes” file that would be nice. Something conceptually similar to a weekly backup and daily differential. That way I only have to download the diffs, and hopefully reduce the burden on your webserver.
Overall, thanks for a great service! It is a real PITA to do this anywhere else.
Beginning in 2011 we are offering daily change logs. As of now these are appearing on our front page, but soon we will make these a subscription service.
The content fields will appear as: status (add/drop)|country name|ISO code|network address|number of hosts. An example of this is data produced on January 5, 2011 appearing below.
drop|EUROPEAN UNION|EU|188.0.0.0|65536
drop|UKRAINE|UA|195.49.200.0|2048
drop|GERMANY|DE|195.149.117.0|256
drop|UNITED STATES|US|198.15.4.0|1024
drop|UNITED STATES|US|198.252.206.0|256
add|UNITED STATES|US|50.74.0.0|131072
add|UNITED STATES|US|199.68.152.0|1024
add|UNITED STATES|US|199.68.160.0|2048
add|UNITED STATES|US|199.68.168.0|2048
add|UNITED STATES|US|204.126.204.0|512
add|UNITED STATES|US|204.136.10.0|512
add|UNITED STATES|US|204.137.26.0|512
add|UNITED STATES|US|204.155.95.0|256
add|UNITED STATES|US|204.156.121.0|256
add|UNITED STATES|US|204.174.0.0|256
add|CANADA|CA|209.145.192.0|16384
add|UNITED STATES|US|216.238.32.0|8192
add|CHINA|CN|101.196.0.0|262144
add|CHINA|CN|122.188.0.0|262144
add|HONG KONG|HK|125.254.52.0|1024
add|NEW ZEALAND|NZ|202.50.85.0|256
add|AUSTRALIA|AU|203.57.192.0|512
add|CZECH REPUBLIC|CZ|46.174.152.0|2048
add|CZECH REPUBLIC|CZ|46.174.160.0|2048
add|SPAIN|ES|46.255.184.0|2048
add|CZECH REPUBLIC|CZ|91.221.246.0|512
add|EUROPEAN UNION|EU|188.66.48.0|4096
add|IRAN, ISLAMIC REPUBLIC OF|IR|195.20.136.0|256
add|CZECH REPUBLIC|CZ|195.20.137.0|256
add|POLAND|PL|195.20.138.0|256
add|EUROPEAN UNION|EU|195.49.200.0|2048
add|ARGENTINA|AR|181.16.0.0|16384
add|NETHERLANDS ANTILLES|AN|186.190.232.0|1024
add|UGANDA|UG|41.75.160.0|4096
add|MALAWI|MW|41.77.8.0|2048
add|SUDAN|SD|197.254.192.0|16384
Imquite intrested in this – how do i install it on wordpress ? do i just add the code to the home page?
I get daily visits from india and pakistan and recenly had issues with copyied content from sites designed in those countires and Im getting fed up with it.
Add the lists through .htaccess or through your existing hardware/software firewall. We are working on a future WorPress plugin.
@Stewart White
+1 it’s not about freedom of access to the internet, it’s about protecting your assets against bad guys who don’t give a &^%$ about freedom.
It is a shame that there are services like this which undermines freedom of access in the web.
It’s a shame these services are necessary. But blame the criminals not the people who need to protect their electronic assets.
@ JWSmythe
Thanks for sharing this info and script.
I’m keen to use something like this and with perl, as my current bash script is very slow. I tried your script and get an error:
line 3, near “= ;”
I’m not the best when it comes to perl, any suggestions to what is causing this?
Also is anyone using IPSET with Debian to load up the blocked addresses, I understand IPSET is specifically made for speeding up this type of function with iptables. The problem is IPSET requires some sort of kernel patching which I’m not keen to do.
Thanks
Really nice tool !
No more worry about Rus Spammers !
@RS
Actually, these files drop in very nicely in iptables rules. You just have to make your firewall script a little smart about it. This may be drop-in code. Adjust to your liking. This is just a snippet from one of my scripts.
— Bash script to create enemies.list —
# download the *_netmask.txt lists of your choice
cd /etc/firewall
wget -q http://www.countryipblocks.net/e_country_data/CN_netmask.txt
wget -q http://www.countryipblocks.net/e_country_data/RU_netmask.txt
cat *_netmask.txt | grep -v ^# > /etc/firewall/enemies.list
— End Bash script
— Begin Perl script —
$enemy_list = “/etc/firewall/enemies.list”;
open (IN, “$enemy_list”) || print “No enemies found in $enemy_list.\n”;
@enemies = ;
close (IN);
foreach $curenemy(@enemies){
$curenemy =~ s/\n//g;
print “Blocking $curenemy\n”;
$c = “iptables -A INPUT -s $curenemy -j DROP”;
system(`$c`);
};
— end Perl script
Just wanted to say a quick thanks for such a fantastic resource.
Since using your top 10 list, my malicious traffic has dropped from around 1500 attempts per day to 4-5.
Thank you so much for this fantastic service. I can stop India from offering me a top placement website now.
i have a query…
for a site..the client need to
deny only Canada country ..i do that by htaccess http://www.countryipblocks.net/ by this…is works fine
But now they ask allow one url like contact us page…..of that site to Canada people…is this possible if yes give me a solution
Yes, it’s possible, but it will depend on the method(s) used to control access to your site. Typically, your .htaccess file will control everything within the directory it is placed. This control will also accumulate to relative subdirectories. You could create a contact page outside of your main directory or you could write your .htaccess rules to route all Canadian traffic to a specific page, i.e., your contact page.
The following address does not seem to be listed as a Belgian IP:
84.199.12.xx
Best regards,
Sure it does:
IP Address assigned to: BELGIUM
IP Address: 84.199.12.34 is located within the following Network:
Network: 84.192.0.0
CIDR: 84.192.0.0/13
Mask: 84.192.0.0/255.248.0.0
Network Range: 84.192.0.0 – 84.199.255.255
Total addresses: 524,288
Registrar: RIPENCC
@Stewart White
Stewart, great site! I love it and use it all of the time.
Two really good ideas I have…
First: When selecting from that list. I always have to hold down Ctrl and scroll through all of the countries and click each one. Sometimes I let go of Ctrl and I have to start clicking all over again. Would be cool if there was a side by side selection. Where the select window was on one side and you can select one and click a button and it would copy that single selection to another select window. So you can like build your list that way.
Second: When clicking the button to process the country list, if there are a ton of entries, it takes forever for all that info to load in the browser and literally slows down my beefy computer to copy and paste that whole window into textpad. Because when I select my countries there are over 10,000 CIDR entries (lines). So, instead of opening another window and listing all of the entries, just have it open a pre-processed txt file so I can save it to my desktop.
Thanks again,
Shawn
Your website is awesome! Let the public know if there is any funding option needed!
Ready to collab!
Cheers from Ireland
Thank you for the kind comments. We are always open to ideas. If you have some please let us know.
I am working on a new !joomla Website and I came across your site while researching the security checklist. I think that this one of the best resources I have found so far for blocking I.P addresses.
This brings me to 2 questions….
Do you provide access to your IP data in a remotely accessible format (IE can I link to your table data for importing updates to my .htaccess files) and 2. would you consider supporting a !Joomla Admin component that would allow potential customers/ site traffic to rely on your database as a resource for providing IP blocking security to their sites? Just a thought…
We are currently contemplating a module to allow remote access to our database. If we proceed with this project it would enable valid users to have read only access to specific tables in the database.
We would consider supporting a Joomla Admin component to process and use our data.
Can you rename my country as Taiwan, not “Taiwan, Province of China”? All people on earth know Taiwan is not part of China, except China communist government.
While it is not our desire to enter into a geopolitical debate about the current names or designations of specific countries, we will take your request under advisement.
Thanks for this service.
I couldn’t find an email address anywhere on your website, in case I’d want to start a conversation about reusing the data that you have in a service.
You have my email address now (had to put it in to be able to post), so please contact me
We have sent you an email in response to your post.
Thanks for the great recourse, it is a valuable tool for spam reduction/hacking attempts. It would be nice to have the option to block by continent. Keep up the great work!
Hi, This is a great reference. I though am not so script savvy and wondered if you can help with something. I currently am using .htaccess to use your blocks and I do use that same file for other things in my site. I don’t like to play with a file like that too frequently. I use cPanel and wondered if all that you have talked about here has anything in reference to automatically updating IP Blocks. Also, in my admin part of my site I have the ability to block IPs as well. I wondered if one of your files I can simply import to the php database for example.
Thank you for such a great site and reference.
Ken
I cant seem to find an actual answer to this thought google, my sites country specific so i used the allow script to only allow the ip ranges within my country as my site serves absolutely no purpose to anyone in any other country.
By using this allow/block method/s does that also mean that if America is blocked am i then effectively blocking all American search engines like google and yahoo or do they fall outside the provided range and if not could you perhaps point me in the direction of blocking countries but allowing specific bots.
Thanks
When you block an country you are blocking traffic from IP ranges assigned or allocated to that country. This will include bots emanating from within those addresses. Google does utilize bots within a variety of countries. However, Google does not publish the IP addresses of these bots.
We recommend you monitor your bot traffic and then Verify Googlebot using the instructions located at Google Webmaster Central.
I agree with the iptables list. I ultimately just use your lists (with a little bit of doctoring via vi) to just flat out deny postfix connections. Works well.
iptables -I input -s subnet/cidr -j DROP # Country name i.e. china
would really be quite wonderful.
Thank you for making this website, I had thought we needed a site like this before. I personally am a big fan of banning whole countries, and do it on a lot of my sites or servers where I am, quite frankly, not the least bit interested in serving russian customers, or whatever. For sites that are only meant for a single country, or say, english speaking westerners, banning the notorious countries (russia, india, north korea, all of africa, etc) reduces almost all your spam.
Hello, I’m wondering if it is possible to block ip’s by states (in USA) using the htaccess format and where I can find the ranges. Regards.
Is a tool available that can accept a list of IP addresses and simplify/shorten it as much as possible?
We are working on such a tool and hope to have it available in 2010.
Wonderful service. Thanks!
Hi, no results from the following:
# Country: KOREA, DEMOCRATIC PEOPLE’S REPUBLIC OF
# ISO Code: KP
# Total Networks: 0
# Total Subnets: 0
You are correct.
@KEP
In answer to your questions:
1.) IP addresses change constantly if they are using dynamic addressing schemes. THis includes DHCP type assignments or the use of proxies to mask the originating IP. Static IPs remain the same.
2.) Blocking rapidly changing IPs requires a little forethought and planning. If the IP address is changing merely because it is a DHCP address assigned to a specific block of IPs, you can proactively block the IP. You can block proxies. You can also block an entire country or continent or allow access to your hidden site to only specific IP addresses.
3.) IP address 64.57.64.57 is assigned to the 64.57.64.0/19 address range. You can block the entire range.
4.) We can provide sample code and in fact already do. But to provide you better service it would help to know what method you are using to filter IPs. Are you using a firewall (hardware/software)? Are you using .htaccess?
If you are using .htaccess and wish to block 64.57.64.57 you could create an .htaccess file using the following text:
If you wanted to block the entire range containing the above IP you could instead use the following:
As you state you are not an expert we recommend getting some assistance from someone familiar with your specific situation.
Hi,
My site is private and no one knows about it. I check my access logs and I see some guys from Turkey. I copied and paste the entire deny codes from your site but there are some that aren’t on it because I still see them around. Sorry but I’m not an expert in IPs at all. My questions are:
1) Doesn’t a user’s ip address changes constantly?
2) If so, how do you block that user if his ip keeps changing?
3) For example, if his IP is 64.57.64.57 for today and tomorrow it’s something else, how do you go about blocking him?
4) Can you provide a sample deny code with above ip address to get an idea how the code is structured?
Thank you!
@DTH
We are currently developing some external API’s for autom queries. We are also working on an app for webmasters.
We update and verify our entire database on a daily basis.
We’re pleased you like our service. Please tell a friend about us.
Do you have an external API where your db can be queried (for input into iptables, etc)?
Also, how frequently to you verify your db information?
Lastly, this is great, as I have been looking for this (or do it myself) for a long time now.
-DTH
Super duper.. had to come back to see what you thought.
We are giving your suggestion some serious thought. In fact the consideration has been on the table for the past few months but you are the first visitor to make the request.@RS
iptables -A INPUT -s 62.217.192.0/18 -m state –state NEW -j DROP
And create a script that adds the iptables -A INPUT -s to the front,
and -m state –state NEW -j DROP to the rear of your IP block lists.
This would be very helpful. Not too many admins are willing to change firewalls, or scripts all the time. And as I mentioned, many of the scripts will not allow for having a list in the formats that you have on the site.
I would add an iptables format to your site. and then have your script generate the iptables commands for the lists you already have.
This would be “very” useful.
This would be pretty good if you would add a true iptables script. Where it output in complete iptables format. Many firewalls do not support full blown blacklist by subnet. But if it generated complete iptables rules for each of the subnet, you could dump it and run a simple script to block.
Just some thoughts
@MC
You first need to check with godaddy to see if they allow the use of .htaccess files with your specific hosting plan.
Got a spam message from the following IP in Brazil – seems this company’s IPs aren’t on anyone’s list yet:
189.27.177.184
Hi…whenever I try to add the .htaccess deny code to my .htaccess file, I get a Server Error 500. I’m on GoDaddy, and using FileZilla with the transfer mode set to ASCII. I’ve heard of using Cpanel, but GoDaddy doesn’t seem to have that.
My firewalls are so noisy with traffic, I don’t know where to begin. But your website helps me to create the necessary deny rules to cut down the noise to a manageable level. Its far easier to allow traffic to questionable zones then to just allow “all” and block only when “discovered”.
Thanks a billion and keep up the good work.
Rob
A great service!
Thank you for the information.
Thanks,
Anthony
Dear Sirs,
Thanks you for great service. It is best tool which i ever use to ban the IP from Vietnam.
Thanks you again.
VU KIMSON
Sale administrator
KIMSON Handicraft Co., LTD