To unblock or delete an IP address listed in the iptables
tables, follow these steps:
- Check the
iptables
rules for the IP address you want to unblock by running the following command:sudo iptables -L -n --line-numbers
This will display a list of all
iptables
rules, along with their line numbers. Look for the rule that blocks the IP address you want to unblock. - Note the line number of the rule that blocks the IP address. For example, if the rule blocking the IP address has a line number of 3, note the number 3.
- To unblock the IP address, delete the corresponding rule using the following command:
sudo iptables -D INPUT <line-number>
Replace
<line-number>
with the line number of the rule that blocks the IP address. For example, if the rule blocking the IP address has a line number of 3, run the following command:sudo iptables -D INPUT 3
- Verify that the rule has been deleted by running the following command:
sudo iptables -L -n --line-numbers
The output should not contain the rule that was blocking the IP address.
That’s it! The IP address you want to unblock has been removed from the iptables
tables and should now be able to access your server.