How to Block a Range of IP Addresses in cPanel

Learn how to block a range of IP addresses in cPanel to protect your website from unwanted traffic and malicious attacks. Follow our step-by-step guide and effective tips.

Updated: 29 Jun, 23 by Susith Nonis 9 Min

List of content you will read in this article:

Blocking IP addresses in cPanel is essential to website security, as it helps protect your website from malicious attacks, spam, and other unwanted traffic. With the ability to block individual IP addresses and even entire ranges, cPanel provides website owners with a powerful tool to safeguard their websites and ensure a smooth user experience for their visitors. In this article, we will guide you through blocking a range of IP addresses in cPanel, providing the necessary steps and tips to keep your website secure and running smoothly.

An IP address is a unique numerical identifier assigned to every device that is connected to the internet. It allows devices to communicate with each other on a network, and in the context of website management, it identifies the origin of website traffic. In cPanel, IP addresses are used to identify visitors, block unwanted traffic, and restrict access to certain parts of the website.

There are two main versions of IP addresses: IPv4 and IPv6. IPv4 is the most widely used version of IP addresses and consists of four sets of numbers separated by periods, for example, However, with the increasing number of devices connected to the internet, the number of available IPv4 addresses is becoming limited.

To address this issue, IPv6 was introduced. IPv6 is designed to provide a much larger number of unique addresses and uses a 128-bit address format consisting of eight sets of four hexadecimal digits separated by colons, for example, 2001:0db8:85a3:0000:0000:8a2e:0370:7334.

In cPanel, understanding IP addresses is essential for managing website traffic and protecting your website from unwanted visitors. With the IP Blocker tool in cPanel, you can easily block individual IP addresses or entire ranges of IP addresses to prevent malicious attacks, spam, and other unwanted traffic. By understanding the significance of IP addresses and the difference between IPv4 and IPv6, you can effectively manage your website's traffic and ensure a smooth user experience for your visitors.

💡💡Upgrade your website's performance and scalability with our powerful VPS hosting solutions, ensuring lightning-fast page load times and seamless user experiences.💡💡

Blocking IP addresses in cPanel is an important step in protecting your website and ensuring visitors' safe and secure online experience. Here are some reasons why you should consider blocking IP addresses in cPanel:

  • Preventing malicious attacks: Hackers and other malicious actors often use IP addresses to launch website attacks. By blocking known malicious IP addresses or ranges, you can prevent these attacks from occurring and protect your website and data.
  • Reducing spam: Spam comments and form submissions can be a major nuisance for website owners. By blocking IP addresses associated with spam, you can reduce the number of unwanted messages and save time moderating comments and submissions.
  • Restricting access to your website: If you have sensitive information or want to restrict access to certain pages, blocking specific IP addresses can be effective. For example, you could block IP addresses from certain countries or regions if you only want your website accessible to visitors from specific locations.
  • Preventing excessive bandwidth usage: Some users may attempt to download large amounts of data from your website, causing excessive bandwidth usage and potentially slowing down your website for other users. By blocking their IP addresses, you can prevent them from accessing your website and using valuable bandwidth.
  • Dealing with troublesome visitors: Sometimes, individual visitors may repeatedly attempt to access your website or engage in other unwanted behaviour. By blocking their IP address, you can prevent them from continuing to cause problems and ensure a positive user experience for your other visitors.

Examples of when blocking IP addresses may be necessary include situations where a particular IP address repeatedly attacks your website or when you notice a significant increase in spam comments or form submissions. By blocking IP addresses in cPanel, you can proactively protect your website and maintain a safe and secure online presence.

  1. Log in to cPanel: First, log in to cPanel using your username and password.
  2. Find the IP Blocker tool: In the cPanel dashboard, navigate to the "Security" section and click the "IP Blocker" icon.
  3. Add IP addresses to the Block List: Under "Add an IP or Range", enter the IP address or range you want to block in the "IP Address or Range" field. You can also add a comment to help you remember why you have blocked that IP address or range.
  4. Click "Add": Once you have entered the IP address or range and added a comment, click the "Add" button to add it to the Block List.
  5. Block an entire range of IP addresses: To block an entire range of IP addresses, use the "CIDR format" to specify the range. For example, to block all IP addresses between and, you would enter in the "IP Address or Range" field.
  6. Verify the blocked IP addresses: To verify that the IP addresses have been blocked, scroll down to the "Currently-Blocked IP Addresses" section. You should see the IP addresses you added to the Block List.
  7. Edit or remove blocked IP addresses: To edit or remove blocked IP addresses, locate the IP address in the "Currently-Blocked IP Addresses" section and click on the corresponding button (Edit or Remove).
  8. Test the blocking: Once you have blocked the IP addresses, test it to ensure it works as intended. Try accessing your website from a device with a blocked IP address to confirm that you cannot access your website.
  • Keep your Block List up-to-date: Regularly review and update it to ensure that it includes the latest known malicious IP addresses or ranges. You can also use third-party lists of known bad IP addresses to help keep your Block List current.
  • Use CIDR notation for IP ranges: When blocking a range of IP addresses, use CIDR notation to specify the range. This is a compact way of expressing a range of IP addresses using a single IP address and a prefix length. For example, instead of listing all IP addresses in a range, you can use CIDR notation like to block all IP addresses in the range.
  • Avoid blocking legitimate traffic: Make sure you are not blocking legitimate traffic or IP addresses belonging to search engines, monitoring services, or other trusted sources. You can use cPanel's "Access/ Error Logs" to help identify the traffic source and ensure you are not blocking legitimate traffic.
  • Monitor your website traffic: Use cPanel's "Awstats" or other web analytics tools to monitor your website traffic and identify any unusual patterns or spikes in traffic. This can help you identify potential attacks or other unwanted traffic and take proactive steps to block them.
  • Use caution when blocking entire countries: Blocking entire countries or regions can effectively prevent unwanted traffic, but it can also block legitimate visitors from those locations. Consider the impact on your website's traffic and audience before blocking entire countries or regions.
  • Use custom error messages: Customize the error messages displayed to visitors whose IP addresses are blocked. This can help prevent confusion and ensure visitors know why they cannot access your website.

Following these tips, you can block IP addresses using cPanel and protect your website from unwanted traffic and attacks.

By following the simple step-by-step guide outlined in this article, you can easily block IP addresses or ranges of IP addresses that you do not want to access your website. Additionally, by keeping your Block List up-to-date, using CIDR notation for IP ranges, avoiding blocking legitimate traffic, monitoring your website traffic, and using custom error messages, you can ensure that your IP blocking strategy is effective and does not negatively impact your website's legitimate traffic. With these tools and tips, you can better safeguard your website and keep it secure.

  • IP blocking is an effective way to protect your website from unwanted traffic and attacks.
  • cPanel provides an easy-to-use interface for blocking IP addresses and ranges.
  • It's important to keep your Block List up-to-date to ensure that you are blocking known bad IP addresses.
  • Use caution when blocking entire countries or regions to avoid blocking legitimate traffic.
  • Customizing error messages can help prevent confusion and ensure visitors know why they cannot access your website.

People also read:

You can unblock an IP address in cPanel by removing it from your Block List.

No, blocking an IP address in cPanel only affects the website or account associated with the cPanel account where the block was set.

Yes, if you have access to cPanel for your website, you can block IP addresses using cPanel.

Yes, blocking a range of IP addresses in cPanel will block all traffic from those IP addresses, including legitimate traffic.

You can use cPanel to block IP addresses on a shared hosting plan, but it may impact other users on the same server. It's important to use caution and consider the potential impact on other users before blocking IP addresses on a shared hosting plan.

Susith Nonis

Susith Nonis

I'm fascinated by the IT world and how the 1's and 0's work. While I venture into the world of Technology, I try to share what I know in the simplest way with you. Not a fan of coffee, a travel addict, and a self-accredited 'master chef'.

user monovm

Drake Hegmann

2024, Jun, 24

Great article! Blocking IP addresses in cPanel is definitely a crucial step for enhancing website security. The detailed steps and tips provided make it easy to understand, even for those who are not tech-savvy. It's helpful to see such a comprehensive guide that covers various scenarios and best practices. Regularly updating the Block List and monitoring traffic can significantly reduce the risk of attacks and spam. Thanks for sharing!