How Do I Block an IP Address on Centos 6 via IPTables

Written by Ian Carnaghan · 15 sec read >
  1. Open a new Terminal Window
  2. Type the following command replacing IPADDRESSTOBLOCK with the IP Address that you wish to block.

    Explanation of above command:

    -A = Append one or more rules to the end of the selected chain
    -s = Source, in this case the IP address to block
    -j = This indicates what to do if the rule matches

  3. Save the Rule to the IPTables
    service iptables save

Last Updated On April 07, 2018
Written by Ian Carnaghan
I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment. In my spare time I teach undergraduate classes in web development. Profile

Leave a Reply

Notify of