Some common commands for using iptables to block ip segments under Linux

  
 

The command to block a single IP is: iptables -I INPUT -s 211.1.0.0 -j The command for the DROP IP segment is: iptables -I INPUT -s 211.1.0.0/16 -j DROPiptables -I INPUT -s 211.2. 0.0/16 -j DROPiptables -I INPUT -s 211.3.0.0/16 -j DROP The command to seal the entire segment is: iptables -I INPUT -s 211.0.0.0/8 -j DROP The command for several segments is: iptables - I INPUT -s 61.37.80.0/24 -j DROPiptables -I INPUT -s 61.37.81.0/24 -j DROP 80 port: iptables -I INPUT -p tcp –dport 80 -s 124.115.0.0/24 -j DROP Unblocked words: iptables -D INPUT -s IP address -j REJECTiptables -F Cleared off If you want to boot automatically to block an IP, then edit the /etc/sysconfig/iptables file, add a line -I INPUT -s IP The address -j DROP then executes /etc/init.d/iptables restart to restart iptables.

Copyright © Windows knowledge All Rights Reserved