Docs Home Return to Homepage
Get Started Login

How to Block an IP Address in cPanel

Last updated Changelog

On this page

If someone keeps spamming your forms or hammering your site, you can block their IP address. They’ll see a 403 Forbidden error instead of your website. In this example we block 162.244.93.3.

Block an address

  1. Log in to cPanel and click IP Blocker in the Security section.

    The cPanel Security section with IP Blocker highlighted

  2. Type the address into IP Address or Domain and click Add.

    IP Blocker with 162.244.93.3 typed in and Add highlighted

    You can also block several addresses at once:

    To block Type
    One address 162.244.93.3 or an IPv6 address like 2001:db8::1
    A range 162.244.93.1-162.244.93.40, or the short form 162.244.93.1-40
    A whole network 162.244.93.0/24
  3. cPanel confirms that users from that address can no longer reach your site. Click Go Back.

    The message “Users from the IP address(es) 162.244.93.3 will not be able to access your site” with Go Back highlighted

  4. The address is listed under Currently-Blocked IP Addresses. In our test, that address got a 403 error straight away, while everyone else could still see the site.

    Currently-Blocked IP Addresses listing 162.244.93.3

cPanel adds the block to the .htaccess file of each of your websites, so it covers all of them. In our test, our subdomain blog.cpanel.cranedemo.com was blocked too. It only blocks your websites: email and FTP aren’t affected.

Note: Many visitors can reach your site over IPv6 as well as IPv4, and each has its own address. Block both if you know them. In our test, the blocked server still got in over IPv6.

Unblock an address

Click Delete next to the address. It can take up to a minute before that visitor can see your site again.

Troubleshooting

Problem What to do
The visitor can still reach my site They may be using IPv6 or a different address. Check your visitor logs for the address they use and block that too. See Logs and visitor stats.
I blocked myself You can still log in to cPanel. Open IP Blocker and click Delete next to your address.
I’m being attacked from lots of different addresses Blocking them one by one won’t keep up. Contact support and we’ll take a look.

Snagged on something? Contact support and we’ll get you sorted.

Snagged on something?

Our sysadmins answer tickets around the clock.