Block Visitors by Country Using Firewall

Do you want to block visitors by country?

Select the countries you want to block, IP address version (IPv4 or IPv6), output format and press the "Download" button.

The output formats supported are Apache .htaccess, Linux iptables, CIDR, Netmask, Inverse Netmask, IIS web.config, Cisco ACL, PeerGuardian2, network-object, Cisco bit bucket, Juniper Junos and MikroTik. Please find the details below:

Format Sample Output
Apache .htaccess allow allow from 8.8.8.0/24
Apache .htaccess deny deny from 8.8.8.0/24
Nginx allow allow 8.8.8.0/24;
Nginx deny deny 8.8.8.0/24;
CIDR 8.8.8.0/24
Linux iptables accept iptables -A INPUT -s 8.8.8.8/24 -j ACCEPT
Linux iptables drop iptables -A INPUT -s 8.8.8.8/24 -j DROP
Netmask 8.8.8.0/255.255.255.0
Inverse Netmask 8.8.8.0 0.0.0.255
Web.config allow <ipSecurity allowUnlisted="false">
<add ipAddress="8.8.8.0" subnetMask="255.255.255.0"/>
Web.config deny <ipSecurity allowUnlisted="true">
<add ipAddress="8.8.8.0" subnetMask="255.255.255.0"/>
Cisco ACL deny ip 8.8.8.0 0.0.0.255 any
PeerGuardian2 HOST:8.8.8.0-8.255.255.255
network-object network-object 8.8.8.0 255.255.255.0
Cisco bit bucket ip route 8.8.8.0 255.255.255.0 Null0
Juniper Junos set 8.8.8.0/24
MikroTik add address=8.8.8.0/24 comment="Danger" list=MyList
ConfigServer Firewall (CSF) 8.8.8.0/24

Download List

IP2Location Firewall IP List

$99/year

  • Support multiple countries or ASN in one API call
  • System administrator can automate the semi-monthly download using script to improve productivity
IP2Location Firewall IP List API

This IP2Location Firewall IP List API is available under commercial plan. With this yearly subscription, you can easily download the firewall list from multiple countries using any scripting languages or console application such as cURL, wget and so on. Sign up 7-days trial today and upgrade to commercial plan.

Note: The API will return you a file in gzip compressed format. You have to decompress the file to retrieve the firewall list.



API Endpoint
https://dl.ip2location.com/v1/firewall

Usage Example by using curl
curl -o firewall.gz 'https://dl.ip2location.com/v1/firewall?token={DOWNLOAD_TOKEN}&country=US|CN&format=cidr'


Supported Parameters

Field Description
token Required An unique download token that assign to you.
country Required ISO-3166 country code separated by pipe. E.g. US|CN|MY|SG
Maximum 10 countries per request.
format Required cidr | apache2.2 | apache2.4 | nginx | iptables | netmask | invert-netmask | web-config | cisco-acl | peerguardian | network-object | cisco-bit-bucket | juniper-junos | mikrotik | csf
action Optional allow | deny. Default value is deny if not provided.
ip_version Optional 4 | 6. IP address version. Return v4 IP addresses if not provided.
file_type Optional gzip | txt. File type. Define to return a compressed file or plain text. Default is gzip.

Block malicious and spam traffic in a couple of clicks

How to Automate Download of Firewall IP List into ipset

Report of Firewall List in Year 2020