This article goes over how to blacklist an IP address with the firewall you have installed on your server. By blacklisting an IP address on the server you will be able to block connections that are attempted from the specific IP address or IP range.
Related Articles
How to SSH into VPS or Dedicated Servers
Log into Root WHM Using AMP
Blacklist an IP Address
IMPORTANT: This solution will require root access. If this needs to be obtained, follow the guide on requesting root access.
NOTE: Blacklisting an IP will completely block the address from the server, so it should only be used on IP addresses that should be prevented from connecting to the server.
- For APF Firewall
- SSH into the server as root
- Run the following command to Deny an IP
apf -d [ip] "Comment"
Replace: Use the IP address that is being blocked in place of "[ip]" and replace "Comment" with an actual comment related to why the IP address is being blocked.- Alternatively, you can also edit the
/etc/apf/deny_host.rules
list directly, but make sure you restart the firewall using to command below after saving your change:apf -r
- Alternatively, you can also edit the
- For CSF Firewall
- Steps for blacklisting IP using Root WHM
- Log into Root WHM
- Click on ConfigServer Security & Firewall, located in the Plugins section
- Scroll down to the csf - Quick Actions section
- Locate the Quick Deny option and enter the IP address you wish to block, then click the Quick Deny button
NOTE: It is recommended to create a comment related to the IP for future reference.
- Steps for blacklisting IP in CSF using SSH
- SSH into the server as root
- Run the following command to Deny an IP
csf -d [ip] "Comment"
Replace: Use the IP address that is being blocked in place of "[ip]" and replace "Comment" with an actual comment related to why the IP address is being blocked.- Alternatively, you can also edit the
/etc/csf/csf.deny
list directly, but make sure you restart the firewall using the command below after saving your change
csf -r
- Alternatively, you can also edit the
- Steps for blacklisting IP using Root WHM
- For cPHulk
- Steps for blacklisting IP using SSH
- SSH into the server as root
- Blacklist the specific IP by running the following command
/scripts/cphulkdblacklist [IP]
REPLACE: '[IP]' with the relevant IP.
- Steps for blacklisting IP using Root WHM
- Log into Root WHM
- Navigate to cPHulk Brute Force Protection, located in the Security Center section
- Select the Blacklist Management tab
- Add the IP under New Blacklist Records
TIP: It is recommended to add a Comment to note the specific IP. - Click Add
- Steps for blacklisting IP using SSH
Comments
0 comments
Article is closed for comments.