Blocking an IP address is a security method that allows you to selectively prevent access to your website. cPanel allows us to block a specific IP address or group of addresses so that they cannot visit your website.
Let’s see how to block an IP address and for what reasons you might need to do it.
Block IP address: what is it for?
Why should you block one or more IP addresses? The main reason to block an IP is to prevent unwanted actions on your website.
For example, you may find spam comments or access by unwanted bots, but also hackers attempting to attack your website.
In other cases, you may want to block the IP addresses of a specific country and thus prevent users from that country from connecting to your website.
This always makes sense in case you are receiving spam or an excessive number of unwanted requests to your website. For example, services like Cloudflare allow you to manage access rules and block visits from a certain country.
How to block IP address
With cPanel, we can block one or more IP addresses thanks to the IP Blocker tool. First, login to cPanel and click on the IP Blocker item you see in the Security section.
After opening the tool to block the IP address, simply enter the IP address you want to prevent access in the Add an IP or Range field.
Let’s see which formats are accepted:
- single IP address (IPV4)such as: 192.168.0.1
- single IP address (IPV6)like this: 2001: db8 :: 1
- IP address range can be entered in the format: 192.168.0.1-192.168.0.50 or in the format 192.168.0.1-50 (refers to the same range of values)
- CIDR format: 192.168.0.1/32
- implicit address, use an address like 1. to indicate 1. *. *. * where each asterisk represents any integer, this means that in this example all IPs starting with 1 will be blocked.
Enter the IP address or range of addresses to be denied access to the website and click the Add button as you see in this example.
A success message like this will show you that the IP address you specified has been blocked.
Manage blocked IP addresses
To check which IP addresses have been blocked and remove the block, just log into cPanel and open the IP Blocker tool.
Scroll to the Currently blocked IP addresses section to see the list of blocked IPs. As you see in this example, if a single IP address has been blocked you will see the starting and ending IPs coincide.
If, on the other hand, a range has been blocked, you will see the first IP in the beginning IP column and the last of the range in the ending IP column.
Remove the block for an IP address
If you have decided to block an IP address, but later on, you change your mind and want to allow access to the website again, use the IP Blocker tool.
Scroll down to the Currently blocked IP addresses section and click Delete next to the address you want to remove the block from.
You will be asked to confirm the IP address removal from the list of blocked IPs. Click on Remove IP to confirm.
A success message will confirm that you have successfully deleted the address and that therefore that IP is now able to access your site again.