How to block ip addresses with iptables

I have an ip address attacking my server or taking up all my httpd connections so none of my sites work.

In order to correct this you will want to use the netstat -n command to see the ip addresses connected to your server. Once you have the ip address you want to block you can use the following command to block them from accessing your server using iptables

iptables -I INPUT 1 -s IP.ADD.RES.SS -j DROP

-I INPUT 1 means to insert the rule at the top of the INPUT table (which means it will get looked at first)

-s IP.ADD.RES.SS is the source address of the packets we want to deal with

-j DROP means dump the packets into the void, and forget they ever happened.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.