IP blocking: Quick guide to protect your network or website

IP Blocking

Networks or websites have to deal with spikes in traffic on occasion. Sometimes, it means you’ve got a boom in your website visitors. That’s great for your revenue. Having said that, network or server admins have to be alert for malicious traffic from hackers or bots. By utilizing IP blocking lists on firewalls or web servers, admins can block connections from various countries where such traffic are coming from. Fortunately, IP2Location provides such IP blocking lists that admins can use to easily protect their networks and servers.

IP2Location visitor blocker generates IP blocking list in various formats

IP2Location has a free service where users can download a list of IP addresses to block by country. This Visitor Blocker page allows users to download the list in a variety of IP blocking formats. Network admins will be glad to know that common firewall formats such as Linux iptables, Cisco or Juniper firewalls are supported. For users who wish to perform blocking at the web server level, they can get lists for Apache, Nginx and IIS.

The page is very easy to use. First of all, the user needs to select the country to block. Next, select the output format for the IP blocking list. Then, click on the Download button to save the list on your computer. Finally, just upload the list to your web server or firewall to enable the blocking.

Below is an example of the output file for Linux iptables:

Read this article for more details on how to generate the blocking list for use.

Automating updates for the IP blocking list via API

Manually downloading the IP blocking lists every month sounds like a tedious task. The manual process is not an option for admins in big organizations as they manage multiple networks or servers. Therefore, IP2Location has introduced an API to allow admins to automate the download of such lists via monthly cronjobs.

This API requires a paid subscription. For a small annual fee, admins will get a download token to use with the API. All the formats supported by the manual process are available via the API. In addition, admins can download multiple countries at once using the API. As a result, the task of updating servers and firewalls is now a relatively easy job.

Read this article for more details and scripts to automate configuring ipset & iptables for Linux systems.

Conclusion

To conclude, the API is geared towards system administrators who have to create cronjobs to update many servers automatically. Free or home users can just manually download the list every month.

Was this article helpful?

Related Articles