<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule">

<channel>
<title>Topic &#x27;firewall rule question&#x27; in forum &#x27;Wireless Service Providers&#x27; - dslreports.com</title>
<link>http://www.dslreports.com/forum/firewall-rule-question-22683653</link>
<description></description>
<language>en</language>
<pubDate>Sat, 11 Feb 2012 16:37:40 EDT</pubDate>
<lastBuildDate>Sat, 11 Feb 2012 16:37:40 EDT</lastBuildDate>

<item>
<title>Re: firewall rule question</title>
<link>http://www.dslreports.com/forum/Re-firewall-rule-question-22684275</link>
<description><![CDATA[matthardy posted : <div class="bquote"><small>said by <a href="/profile/1292795" onClick="this.blur(); return popup(event,'/uidpop?ajh=1&uid=1292795');">shorthairedp</a>:</small><br><br>So, from another thread:<br><br>iptables -A INPUT -p tcp --dport 22 -i eth1 -m state --state NEW -m recent --set<br>iptables -A INPUT -p tcp --dport 22 -i eth1 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 -j DROP<br><br>is the a term for all ports instead of tcp port 22 (or whatever the individual port is)<br><br> </div>To do this in particular (this rule for everything not on dport 22), you can specify an inverse rule like this:<br><br>iptables -A INPUT -p tcp --dport ! 22 -i eth1 -m state --state NEW -m recent --set<br><br>note the !. Basically this says, match where dport does not equal 22]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/Re-firewall-rule-question-22684275</guid>
<pubDate>Fri, 10 Jul 2009 07:05:49 EDT</pubDate>
</item>

<item>
<title>Re: firewall rule question</title>
<link>http://www.dslreports.com/forum/Re-firewall-rule-question-22683927</link>
<description><![CDATA[dr mongolia posted : The "-A" just means "add to this chain", which in that case is the INPUT chain. So the filter would be applied to packets arriving on interface eth1 (due to the -i flag).  <br><br>It looks like you're trying to limit P2P? If so, use the connlimit module, it's very effective: <br><br>iptables -I FORWARD -i br0 -p tcp --syn --dport 1: -m connlimit --connlimit-above 200 -j REJECT<br>iptables -I FORWARD -i br0 -p tcp --syn --dport 1024: -m connlimit --connlimit-above 7 -j REJECT<br>iptables -I FORWARD -i br0 -p udp --dport 1: -m connlimit --connlimit-above 200 -j REJECT <br>iptables -I FORWARD -i br0 -p udp --dport 1024: -m connlimit --connlimit-above 7 -j REJECT<br><br>Assuming you had a bridged interface br0 where client traffic was coming in on, this would allow 200 connections total per user for TCP and another 200 for UDP (lines #1 and #3). It also places a limit of 7 TCP and UDP connections per user on ports 1024 and above (lines #2 and #4).<br><br>The example you posted would add the user to a queue after only 20 new packets of any type were spotted in 1 minute. So the user would likely get queued after a single web page since they've got a few connections to the server, dns packets, etc. Using hitcount is usually best for preventing abusive activity targeted at a single host, or a single port -- portscans, brute force attacks, etc. <br><br>I had difficulty in finding a good iptables tutorial-type resource, so I just learned by looking at a bunch of examples, I think it's the easiest way. I'm falling asleep but I'll look reread this in the morning to see if i wasn't making much sense.]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/Re-firewall-rule-question-22683927</guid>
<pubDate>Fri, 10 Jul 2009 01:55:03 EDT</pubDate>
</item>

<item>
<title>Re: firewall rule question</title>
<link>http://www.dslreports.com/forum/Re-firewall-rule-question-22683707</link>
<description><![CDATA[shorthairedp posted : I found one:<br>&raquo;<A HREF="https://www.opensource.com/docs/manuals/linux/RHL-9-Manual/ref-guide/s1-iptables-options.html" >www.opensource.com/docs/manuals/&middot;&middot;&middot;ons.html</A><br><br>iptables -A INPUT -p all --dport 0:65535 -i eth1 -m state --state ESTABLISHED -m recent --set<br><br>iptables -A INPUT -p all --dport 0:65535 -i eth1 -m state --state NEW -m recent --update --seconds 60 --hitcount 20 -j DROP<br><br>by rights, this will drop all new connections whenever there are more than 20 active in a minute? is this correct?<br><br>now, if I set queue instead of drop, and theyre running P2P how much will queue before the router flips out? should I add another rule setting the queue to a certain level then drops?<br><br>iptables -A INPUT -p all --dport 0:65535 -i eth1 -m state --state ESTABLISHED -m recent --set<br><br>iptables -A INPUT -p all --dport 0:65535 -i eth1 -m state --state NEW -m recent --update --seconds 60 --hitcount 20 -j QUEUE<br><br>iptables -A INPUT -p all --dport 0:65535 -i eth1 -m state --state QUEUE -m recent --set<br><br>iptables -A INPUT -p all --dport 0:65535 -i eth1 -m state --state NEW -m recent --update --seconds 60 --hitcount 50 -j DROP<br><br>For reference, Im looking at custom abuser rules, not overall system rules<br><br>Or am I just WAY off base here?]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/Re-firewall-rule-question-22683707</guid>
<pubDate>Fri, 10 Jul 2009 00:36:23 EDT</pubDate>
</item>

<item>
<title>firewall rule question</title>
<link>http://www.dslreports.com/forum/firewall-rule-question-22683653</link>
<description><![CDATA[shorthairedp posted : So, from another thread:<br><br>iptables -A INPUT -p tcp --dport 22 -i eth1 -m state --state NEW -m recent --set<br>iptables -A INPUT -p tcp --dport 22 -i eth1 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 -j DROP<br><br>is the a term for all ports instead of tcp port 22 (or whatever the individual port is)<br><br>I wish I knew the syntax for iptables, is there a good cheaters quick reference anyone is aware of?]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/firewall-rule-question-22683653</guid>
<pubDate>Fri, 10 Jul 2009 00:19:33 EDT</pubDate>
</item>

</channel>
</rss>

