Managing IP Access on Your Cloud or Dedicated Server

Controlling access to your server is key to keeping it secure. Whitelisting, blacklisting, and unblocking IP addresses lets you manage who can connect to your server. With these tools, you can ensure only trusted users access your resources and block unwanted or malicious traffic. In this guide, we’ll show you how to do this using the command line and the WHM panel on Cloud or Dedicated servers.

Why block, unblock, or whitelist IPs

Whitelisting IPs

  • Why: Allows trusted users or systems to connect freely to your server.
  • When: Use it for known, secure users or systems (e.g., your office network, partners).

Blacklisting IPs

  • Why: Blocks malicious users, bots, or unwanted traffic.
  • When: Use it to stop brute-force attacks, spammers, or suspicious activity.

Unblocking IPs

  • Why: Restores access for legitimate users who may have been mistakenly blocked.
  • When: Use it if a user needs access but was accidentally blocked.

Block, Unblock, and Whitelist IPs using SSH (CSF)

Warning: Blocking, unblocking, and whitelisting IPs using the command line is intended for advanced users. If you're not comfortable with command-line operations, use the WHM panel for easier management (see next section).

CSF (ConfigServer Security & Firewall) is a powerful firewall tool for Linux servers that lets you manage IP access. It allows you to whitelist, blacklist, and unblock IPs, helping you secure your server and ensure trusted users have uninterrupted access.

Before starting, you’ll need to access your server via SSH (Secure Shell). See: How to Connect by SSH to the Server (Shell Access).

Use the following CSF commands (replace IPADDRESS with the actual IP):

Action Command
Verify IP block csf -g IPADDRESS
Block IP address csf -d IPADDRESS
Unblock IP address csf -dr IPADDRESS
Whitelist IP address csf -a IPADDRESS

For more commands, see this list of essential CSF commands.

Block, Unblock, and Whitelist IPs using WHM

You can also manage IP addresses directly through the WHM panel. Use the ConfigServer Security & Firewall interface to quickly block, unblock, and whitelist IPs:

  1. Access your WHM panel.
  2. In the WHM dashboard, open ConfigServer Security & Firewall.
  3. Click csf.
  4. Use the available options to block, unblock, and whitelist IP addresses.

Using cPHulk Brute Force Protection

While command-line IP management is important, cPHulk adds extra protection for cPanel servers. It automatically blocks IPs that attempt too many failed logins. Using cPHulk alongside manual IP management gives your server stronger, all-around security.

Key capabilities of cPHulk:

  1. Brute force protection: Blocks IPs after a set number of failed login attempts.
  2. Whitelist/blacklist management: Allow trusted IPs and deny malicious ones.
  3. Customizable thresholds: Set limits and block durations.
  4. Real-time email alerts: Get notified when an IP is blocked.
  5. Easy WHM management: Configure settings and view blocks in WHM.

See the official docs: cPHulk Brute Force Protection.

 
Was this answer helpful?