<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.hostek.com/index.php?action=history&amp;feed=atom&amp;title=IPTables_Tips_and_Tricks</id>
		<title>IPTables Tips and Tricks - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.hostek.com/index.php?action=history&amp;feed=atom&amp;title=IPTables_Tips_and_Tricks"/>
		<link rel="alternate" type="text/html" href="https://wiki.hostek.com/index.php?title=IPTables_Tips_and_Tricks&amp;action=history"/>
		<updated>2026-04-15T03:12:48Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.24.2</generator>

	<entry>
		<id>https://wiki.hostek.com/index.php?title=IPTables_Tips_and_Tricks&amp;diff=2676&amp;oldid=prev</id>
		<title>Kalebl at 04:57, 17 July 2015</title>
		<link rel="alternate" type="text/html" href="https://wiki.hostek.com/index.php?title=IPTables_Tips_and_Tricks&amp;diff=2676&amp;oldid=prev"/>
				<updated>2015-07-17T04:57:56Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 04:57, 17 July 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Linux VPS]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Linux&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;-&lt;/ins&gt;VPS]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Connecting to Server==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Connecting to Server==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;These commands are ran in a shell session. You can connect to a shell session using the following suggestions depending on your operation system.&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;These commands are ran in a shell session. You can connect to a shell session using the following suggestions depending on your operation system.&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Kalebl</name></author>	</entry>

	<entry>
		<id>https://wiki.hostek.com/index.php?title=IPTables_Tips_and_Tricks&amp;diff=2675&amp;oldid=prev</id>
		<title>Kalebl at 04:55, 17 July 2015</title>
		<link rel="alternate" type="text/html" href="https://wiki.hostek.com/index.php?title=IPTables_Tips_and_Tricks&amp;diff=2675&amp;oldid=prev"/>
				<updated>2015-07-17T04:55:16Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 04:55, 17 July 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;TipsAndTricks&lt;/del&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Linux VPS&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Connecting to Server==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Connecting to Server==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;These commands are ran in a shell session. You can connect to a shell session using the following suggestions depending on your operation system.&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;These commands are ran in a shell session. You can connect to a shell session using the following suggestions depending on your operation system.&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Kalebl</name></author>	</entry>

	<entry>
		<id>https://wiki.hostek.com/index.php?title=IPTables_Tips_and_Tricks&amp;diff=2674&amp;oldid=prev</id>
		<title>Kalebl at 04:53, 17 July 2015</title>
		<link rel="alternate" type="text/html" href="https://wiki.hostek.com/index.php?title=IPTables_Tips_and_Tricks&amp;diff=2674&amp;oldid=prev"/>
				<updated>2015-07-17T04:53:53Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 04:53, 17 July 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 51:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 51:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;After deleting the rule, you should be able to list the IP tables rule's again, &amp;lt;code&amp;gt;iptables -L --line-numbers&amp;lt;/code&amp;gt; and find that the rule number is missing, or has another rule in its place. IP tables will move all the rules lower that the deleted rule up in the list to compensate for the rule being removed.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;After deleting the rule, you should be able to list the IP tables rule's again, &amp;lt;code&amp;gt;iptables -L --line-numbers&amp;lt;/code&amp;gt; and find that the rule number is missing, or has another rule in its place. IP tables will move all the rules lower that the deleted rule up in the list to compensate for the rule being removed.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;''Keywords: iptables, IP Tables, ip tables, tips and tricks''&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Kalebl</name></author>	</entry>

	<entry>
		<id>https://wiki.hostek.com/index.php?title=IPTables_Tips_and_Tricks&amp;diff=2673&amp;oldid=prev</id>
		<title>Kalebl: Created page with &quot;Category:TipsAndTricks ==Connecting to Server== These commands are ran in a shell session. You can connect to a shell session using the following suggestions depending on...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.hostek.com/index.php?title=IPTables_Tips_and_Tricks&amp;diff=2673&amp;oldid=prev"/>
				<updated>2015-07-17T04:45:34Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&lt;a href=&quot;/index.php?title=Category:TipsAndTricks&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Category:TipsAndTricks (page does not exist)&quot;&gt;Category:TipsAndTricks&lt;/a&gt; ==Connecting to Server== These commands are ran in a shell session. You can connect to a shell session using the following suggestions depending on...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:TipsAndTricks]]&lt;br /&gt;
==Connecting to Server==&lt;br /&gt;
These commands are ran in a shell session. You can connect to a shell session using the following suggestions depending on your operation system.&amp;lt;br /&amp;gt;&lt;br /&gt;
=====Windows=====&lt;br /&gt;
[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] or [http://www.mremoteng.org/download mRemoteNG]&lt;br /&gt;
=====Mac or Linux=====&lt;br /&gt;
Open up terminal and run the following line, replacing &amp;quot;'''servername'''&amp;quot; with the IP address of the server, or it's hostname.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ssh root@servername&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Note: If the server has SSH running on a port other then port 22, you can specify the port number like in the example below.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ssh root@servername -p 22&amp;lt;/code&amp;gt;&lt;br /&gt;
==Common Commands==&lt;br /&gt;
===Open Port===&lt;br /&gt;
Opening a port in IP tables only takes one command. Below is an example of the to allow a port. replace &amp;quot;'''80'''&amp;quot; with the port number you wish to open.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;iptables -A INPUT -p tcp --dport 80 -j ACCEPT&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Close Port===&lt;br /&gt;
Closing a port in IP tables is much like opening a port. Below is an example of the to block a port. replace &amp;quot;'''80'''&amp;quot; with the port number you wish to block.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;iptables -A INPUT -p tcp --dport 80 -j DROP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List Active Rules===&lt;br /&gt;
Listing the active rules will output and of the entries in IP tables, as well as what chain the entries are listed under, and the default policy for that chain.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;iptables -L&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
If you want to search for something specific, such as an IP address or a hostname, you can append a &amp;quot;'''| grep x'''&amp;quot; (Seen in the example below) to the rule to filter for the string you are looking for.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;iptables -L | grep 123.45.67.89&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Delete Rule===&lt;br /&gt;
Deleting a rule requires a little bit more work than the other options. You will need to first list the IP tables entries, and find:&amp;lt;br /&amp;gt;&lt;br /&gt;
[1]: The chain that the rule is located in.&amp;lt;br /&amp;gt;&lt;br /&gt;
[2]: The number of the rule in the chain.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This can be done by running:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;iptables -L --line-numbers&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
If the output is to long to be able to see it all, run the following, and it will put the output into &amp;quot;Less&amp;quot; a text reader which you can scroll through with the arrow keys.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;iptables -L --line-numbers | less&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once you find the rule's chain name.&lt;br /&gt;
     Chain Name&lt;br /&gt;
         |&lt;br /&gt;
 Chain DENYIN (1 references)&lt;br /&gt;
And the rules number id in that chain.&lt;br /&gt;
 Rule Number&lt;br /&gt;
 |&lt;br /&gt;
 5    DROP       all  --  127.0.0.1    anywhere&lt;br /&gt;
you can piece the delete commend together like this:&amp;lt;br /&amp;gt;&lt;br /&gt;
        Chain Name  Rule Number&lt;br /&gt;
                |   |&lt;br /&gt;
 iptables -D DENYIN 5&lt;br /&gt;
&lt;br /&gt;
After deleting the rule, you should be able to list the IP tables rule's again, &amp;lt;code&amp;gt;iptables -L --line-numbers&amp;lt;/code&amp;gt; and find that the rule number is missing, or has another rule in its place. IP tables will move all the rules lower that the deleted rule up in the list to compensate for the rule being removed.&lt;/div&gt;</summary>
		<author><name>Kalebl</name></author>	</entry>

	</feed>