shopify analytics ecommerce

Linux block ip with iptables

If you want to block ip of network traffic, you can achieve through iptables under Linux, instructions are as follows:

iptables -A INPUT -s IP_ADDRESS -j DROP

Just want to block the ip method above IP_ADDRESS position before it.

There is a case that you do not want all traffic on an ip blockade, just blockade designated port port number, you can do this:

iptables -A INPUT -s IP_ADDRESS -p tcp -destination-port 25 -j DROP

More instructions through the iptables -destination-port option, the command block only port 25 traffic.

But if simply enter iptables blocking IP, when the host reboot or restart iptables, the added rule will delete all under Redhat / Centos can use the following command to rule stored within config file:

service iptables save

If you want to remove the blockade, so long as the above command iptables -A -D can be changed, for example:

iptables -D INPUT -s IP_ADDRESS -j DROP
service iptables save

Leave a Reply