How To Block an IP Address Print

  • 0

How To Block an IP Address

Login to your Linux server via SSH.

Blocking an IP Address

To block a specific IP address, use the following command. Replace xx.xx.xx.xx with the IP address you want to block:

iptables -A INPUT -s xx.xx.xx.xx -j DROP

Saving the iptables Rules

Once you have blocked the IP address, you need to save the new rules to ensure they persist after a server restart. Use the following command to save the iptables configuration:

service iptables save

Was this answer helpful?

« Back