<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Guy Rutenberg &#187; iptables</title>
	<atom:link href="http://www.guyrutenberg.com/tag/iptables/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.guyrutenberg.com</link>
	<description>Keeping track of what I do</description>
	<lastBuildDate>Sat, 14 Jan 2012 11:30:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Iptables Cheatsheet</title>
		<link>http://www.guyrutenberg.com/2009/02/26/iptables-cheatsheet/</link>
		<comments>http://www.guyrutenberg.com/2009/02/26/iptables-cheatsheet/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 06:19:47 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[iptables]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=273</guid>
		<description><![CDATA[From time to time I find myself having to go through man pages and googling for some simple iptable rules. This post is meant as a cheatsheet for me, so I can concentrate here various rules and remarks. I hope others will benefit from this cheatsheet as well. Intend to expand it over time as [...]]]></description>
			<content:encoded><![CDATA[<p>From time to time I find myself having to go through man pages and googling for some simple iptable rules. This post is meant as a cheatsheet for me, so I can concentrate here various rules and remarks.</p>
<p>I hope others will benefit from this cheatsheet as well. Intend to expand it over time as I gather more rules and tips, so bookmarking the post might be a good idea. Last but not least, if you have some useful iptables rules I&#8217;ve missed please send them using the comments.<br />
<span id="more-273"></span></p>
<h3>Blocking specific IPs</h3>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">iptables -I INPUT -s &quot;207.58.140.12&quot; -j DROP</pre></div></div>

<h3>Blocking a range of IPs (IP block)</h3>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">iptables -I INPUT -s &quot;207.58.140.0/24&quot; -j DROP</pre></div></div>

<p>The number after the slash (/) determines the number of bits (starting with the most significant one) considered when matching an IP address. For example the above rule will block any packets from 207.58.140.* . Other useful number of bits are 16 (for matching the first two octets) and 8 (only the first octet).</p>
<h3>Deleting rules</h3>
<p>Just specify the rule after a <code>-D</code> flag. E.g.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">iptables -D INPUT -s &quot;207.58.140.12&quot; -j DROP</pre></div></div>

<h3>Saving new rules</h3>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/etc/init.d/iptables save</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/02/26/iptables-cheatsheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.265 seconds -->

