Differences

This shows you the differences between two versions of the page.

Link to this comparison view

server-administration:blocking-using-iptables [2009-10-14 15:56:32]
garrett.plasky created
server-administration:blocking-using-iptables [2011-07-01 12:12:54] (current)
garrett.plasky Approved
Line 2: Line 2:
 The following article describes various ways to block IPs using the built-in RedHat firewall, iptables. The following command will drop all incoming connections from IP xx.xx.xx.xx:​ The following article describes various ways to block IPs using the built-in RedHat firewall, iptables. The following command will drop all incoming connections from IP xx.xx.xx.xx:​
  
-<code console>iptables -I INPUT -s xx.xx.xx.xx -j DROP</code>+<sxh shell>​iptables -I INPUT -s xx.xx.xx.xx -j DROP</sxh>
  
 To block a range, such as xx.xx.xx.* specify the CIDR block as follows: To block a range, such as xx.xx.xx.* specify the CIDR block as follows:
  
-<code console>iptables -I INPUT -s xx.xx.xx.0/​24 -j DROP</code>+<sxh shell>​iptables -I INPUT -s xx.xx.xx.0/​24 -j DROP</sxh>
  
 If you wanted to later remove this entry you would replace the -I with -D as follows: If you wanted to later remove this entry you would replace the -I with -D as follows:
  
-<code console>iptables -D INPUT -s xx.xx.xx.xx -j DROP +<sxh shell>​iptables -D INPUT -s xx.xx.xx.xx -j DROP 
-iptables -D INPUT -s xx.xx.xx.0/​24 -j DROP</code>+iptables -D INPUT -s xx.xx.xx.0/​24 -j DROP</sxh>
  
 {{tag>​iptables how-to}} {{tag>​iptables how-to}}