How to Check if IP is blocked from IPtables

Iptables is an application that uses policy chains to allow or block traffic using the IP packet filter rules of the Linux kernel firewall. For example, to secure your server workloads, you can install this firewall on your Linux Dedicated or Virtual Server. If a user tries to connect to your server using SSH, iptables will try to match the IP address and port to a rule in the input chain.

Checking if IP is blocked

iptables -L -n –line | grep [IP Address]

If IP appears as DROP or REJECT, the IP in the IPTable has been blocked

Therefore, you would need to unblock the IP Address:

iptables -I INPUT -s [IP Address] -j ACCEPT

And this is how to block back an IP Address:

iptables -A INPUT -d [IP Address] -j DROP
service iptables save

 Follow the instructions below to unblock an IP from the CSF using SSH

1st of 3 steps

To begin, run the following command to see if the IP has been banned by the CSF:

csf -g IP_address

NOTE: IP_address is the specific IP you wish to check.

Step 2 of 3

Second, if you want to remove an IP address that has been denied, run the following command:

csf -dr IP_address

Step 3 of 3

Finally, in order for the changes to take effect, CSF must be restarted to finish the process:

csf -r

Note: The full path of IPTABLES is /sbin/iptables, but you can use /sbin/iptables instead of command # iptables.