<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://beardedmaker.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Iptables</id>
		<title>Iptables - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://beardedmaker.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Iptables"/>
		<link rel="alternate" type="text/html" href="https://beardedmaker.com/wiki/index.php?title=Iptables&amp;action=history"/>
		<updated>2026-04-26T14:25:26Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.27.4</generator>

	<entry>
		<id>https://beardedmaker.com/wiki/index.php?title=Iptables&amp;diff=120&amp;oldid=prev</id>
		<title>Beard: Created page with &quot;&lt;pre&gt; packages: 	iptables 	system-config-firewall 	system-config-securitylevel 	 daemons: 	iptables 	ip6tables  configs: 	/etc/sysconfig/iptables-config - config file 	/etc/sy...&quot;</title>
		<link rel="alternate" type="text/html" href="https://beardedmaker.com/wiki/index.php?title=Iptables&amp;diff=120&amp;oldid=prev"/>
				<updated>2016-02-29T20:54:59Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt; packages: 	iptables 	system-config-firewall 	system-config-securitylevel 	 daemons: 	iptables 	ip6tables  configs: 	/etc/sysconfig/iptables-config - config file 	/etc/sy...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
packages:&lt;br /&gt;
	iptables&lt;br /&gt;
	system-config-firewall&lt;br /&gt;
	system-config-securitylevel&lt;br /&gt;
	&lt;br /&gt;
daemons:&lt;br /&gt;
	iptables&lt;br /&gt;
	ip6tables&lt;br /&gt;
&lt;br /&gt;
configs:&lt;br /&gt;
	/etc/sysconfig/iptables-config - config file&lt;br /&gt;
	/etc/sysconfig/iptables - list of rules. rules are listed the same as CLI arguments&lt;br /&gt;
	/etc/sysconfig/iptables.save - save/backup file&lt;br /&gt;
	/etc/sysconfig/iptables.old - manual backup file&lt;br /&gt;
&lt;br /&gt;
tutorials:&lt;br /&gt;
	http://www.routermods.com/2010/02/09/iptables-for-dummies-a-beginners-guide-to-iptables-firewall/&lt;br /&gt;
&lt;br /&gt;
commands:&lt;br /&gt;
&lt;br /&gt;
	*the order of arguments is unimportant&lt;br /&gt;
	*rules are applied using&lt;br /&gt;
&lt;br /&gt;
	service iptables save - saves rules currently in memory to /etc/sysconfig/iptables&lt;br /&gt;
&lt;br /&gt;
	iptables -L - list rules&lt;br /&gt;
		--line-numbers&lt;br /&gt;
	iptables -P &amp;lt;chain&amp;gt; &amp;lt;rule&amp;gt; - set default/implicit policy for the whole chain (ie iptables -P INPUT ACCEPT)&lt;br /&gt;
	iptables -D &amp;lt;chain&amp;gt; &amp;lt;rule&amp;gt; - delete rule. can be either a number startin at 1 or the rule itself. (ie iptables -D INPUT 2)&lt;br /&gt;
	iptables-save - saves rules to iptables.save and allows rules to be applied on restart&lt;br /&gt;
	iptables -t &amp;lt;table&amp;gt; -A &amp;lt;chain&amp;gt; -i &amp;lt;int&amp;gt; -o &amp;lt;int&amp;gt; -p &amp;lt;protocol&amp;gt; --sport &amp;lt;port&amp;gt; --dport &amp;lt;port&amp;gt; -s &amp;lt;source&amp;gt; -d &amp;lt;destination&amp;gt; -j &amp;lt;action&amp;gt;&lt;br /&gt;
		precede options with &amp;quot;!&amp;quot; to apply NOT logic (ie ! -s 0.0.0.0/0)&lt;br /&gt;
		-t &amp;lt;table&amp;gt; - table can be either:&lt;br /&gt;
			filter - default if no table specified&lt;br /&gt;
			nat - nat table&lt;br /&gt;
			mangle - mangle table&lt;br /&gt;
		-A &amp;lt;chain&amp;gt; - append to chain&lt;br /&gt;
			INPUT - packets destined to local machine&lt;br /&gt;
			OUTPUT - packets generated by local machine&lt;br /&gt;
			FORWARD - packets passing through box&lt;br /&gt;
			PREROUTING - packets as they enter local machine (nat and mangle only)&lt;br /&gt;
			POSTROUTING - packets as they leave local machine (nat and mangle only)&lt;br /&gt;
		-I &amp;lt;chain&amp;gt; &amp;lt;#&amp;gt; - same as -A but inserts rule as rule #&lt;br /&gt;
		-i &amp;lt;int&amp;gt; - input interface (optional)&lt;br /&gt;
		-o &amp;lt;int&amp;gt; - output interface (optional)&lt;br /&gt;
		-p &amp;lt;protocol&amp;gt;&lt;br /&gt;
			tcp&lt;br /&gt;
			udp&lt;br /&gt;
			udplite&lt;br /&gt;
			icmp&lt;br /&gt;
			esp&lt;br /&gt;
			ah&lt;br /&gt;
			sctp&lt;br /&gt;
			all&lt;br /&gt;
		-m &amp;lt;extension&amp;gt; &amp;lt;options&amp;gt; - match. adds extension with more options. (ie iptables -A INPUT -p tcp --dport 80 -m comment --comment &amp;quot;www request&amp;quot;)&lt;br /&gt;
			comment&lt;br /&gt;
				--comment &amp;lt;text&amp;gt;&lt;br /&gt;
			state - the state of the packet&lt;br /&gt;
				--state &amp;lt;state&amp;gt;&lt;br /&gt;
					NEW - packet has started new connection. most commonly used for incoming traffic&lt;br /&gt;
					RELATED - packet started new connection but is associated with an existing connection&lt;br /&gt;
					ESTABLISHED - packet is part of another connection&lt;br /&gt;
			limit - helps prevent dictionary attacks&lt;br /&gt;
				--limit &amp;lt;#&amp;gt;/&amp;lt;second/minute/hour/day&amp;gt; - (ie -m limit --limit 2/minute)&lt;br /&gt;
				--limit-burst &amp;lt;#&amp;gt; - limit number of packets to match.&lt;br /&gt;
			mac&lt;br /&gt;
				--mac-source &amp;lt;address&amp;gt;&lt;br /&gt;
			iprange - match a range of addresses&lt;br /&gt;
				--src-range &amp;lt;addr&amp;gt;-&amp;lt;addr&amp;gt;&lt;br /&gt;
				--dst-range &amp;lt;addr&amp;gt;-&amp;lt;addr&amp;gt;&lt;br /&gt;
		--sport &amp;lt;port&amp;gt; - source port&lt;br /&gt;
		--dport &amp;lt;port&amp;gt; - destination port&lt;br /&gt;
		--tcp-flags &amp;lt;flag&amp;gt; - comma separated list of flags&lt;br /&gt;
			SYN&lt;br /&gt;
			RST&lt;br /&gt;
			ACK&lt;br /&gt;
			FIN&lt;br /&gt;
		-s &amp;lt;source&amp;gt; - source address. can be host name or address/mask (ie 192.168.0.1/24)&lt;br /&gt;
		-d &amp;lt;destination&amp;gt; - destination address. can be host name or address/mask (ie 192.168.0.1/24)&lt;br /&gt;
		-j &amp;lt;action&amp;gt; - the action to take&lt;br /&gt;
			ACCEPT&lt;br /&gt;
			REJECT - rejects packet and sends error.&lt;br /&gt;
			DROP - same as REJECT except is sends no error&lt;br /&gt;
			LOG - logs when a packet matches rule. for rejected packets, place a log rule before the rejecting rule.&lt;br /&gt;
				--log-prefix &amp;lt;text&amp;gt;&lt;br /&gt;
				--log-level &amp;lt;#&amp;gt; - 7 is appropriate&lt;br /&gt;
&lt;br /&gt;
examples:&lt;br /&gt;
	allow priviously established connections: &lt;br /&gt;
		iptables -A INPUT -j ACCEPT -p tcp ! –syn -s 0/0 -d (outer ip/net) - pro firewall rule&lt;br /&gt;
	allow port 80: &lt;br /&gt;
		iptables -A INPUT -p tcp --dport 80 -j ACCEPT&lt;br /&gt;
	limitations on ssh: &lt;br /&gt;
		iptables -A INPUT -p tcp --dport ssh -m limit --limit 3/minute --limit-burst 2 -j ACCEPT&lt;br /&gt;
	allow ssh and all session-related packets:&lt;br /&gt;
		iptables –A FORWARD –i eth1 –o eth0 –m state -state NEW -dport 22 –j ACCEPT&lt;br /&gt;
		iptables –A FORWARD –i eth1 –o eth0 –m state -state ESTABLISHED,RELATED –j ACCEPT&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Beard</name></author>	</entry>

	</feed>