Search:  

 
 
   All ForumsHot TopicsGallery






how-to block ads


 
Forums » Industry Forums » Wireless Service Providers » firewall rule question
Search Topic:
Uniqs:
197
Share Topic:
RSS topic:
toggle:
flat / full
normal / watch
Posting:
Post a:
Post a:
Paint Mastic Tape »
« GPS conversion help  
AuthorAll Replies

shorthairedp

join:2005-11-21
united state

firewall rule question

So, from another thread:

iptables -A INPUT -p tcp --dport 22 -i eth1 -m state --state NEW -m recent --set
iptables -A INPUT -p tcp --dport 22 -i eth1 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 -j DROP

is the a term for all ports instead of tcp port 22 (or whatever the individual port is)

I wish I knew the syntax for iptables, is there a good cheaters quick reference anyone is aware of?

shorthairedp

join:2005-11-21
united state


3 edits
I found one:
»https://www.opensource.com/docs/manuals/···ons.html

iptables -A INPUT -p all --dport 0:65535 -i eth1 -m state --state ESTABLISHED -m recent --set

iptables -A INPUT -p all --dport 0:65535 -i eth1 -m state --state NEW -m recent --update --seconds 60 --hitcount 20 -j DROP

by rights, this will drop all new connections whenever there are more than 20 active in a minute? is this correct?

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?

iptables -A INPUT -p all --dport 0:65535 -i eth1 -m state --state ESTABLISHED -m recent --set

iptables -A INPUT -p all --dport 0:65535 -i eth1 -m state --state NEW -m recent --update --seconds 60 --hitcount 20 -j QUEUE

iptables -A INPUT -p all --dport 0:65535 -i eth1 -m state --state QUEUE -m recent --set

iptables -A INPUT -p all --dport 0:65535 -i eth1 -m state --state NEW -m recent --update --seconds 60 --hitcount 50 -j DROP

For reference, Im looking at custom abuser rules, not overall system rules

Or am I just WAY off base here?

dr mongolia

join:2008-07-03
United State
·Cox HSI

reply to shorthairedp
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).

It looks like you're trying to limit P2P? If so, use the connlimit module, it's very effective:

iptables -I FORWARD -i br0 -p tcp --syn --dport 1: -m connlimit --connlimit-above 200 -j REJECT
iptables -I FORWARD -i br0 -p tcp --syn --dport 1024: -m connlimit --connlimit-above 7 -j REJECT
iptables -I FORWARD -i br0 -p udp --dport 1: -m connlimit --connlimit-above 200 -j REJECT
iptables -I FORWARD -i br0 -p udp --dport 1024: -m connlimit --connlimit-above 7 -j REJECT

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).

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.

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.


hattmardy
Premium
join:2007-01-23
Atlanta, GA

reply to shorthairedp
said by shorthairedp See Profile :

So, from another thread:

iptables -A INPUT -p tcp --dport 22 -i eth1 -m state --state NEW -m recent --set
iptables -A INPUT -p tcp --dport 22 -i eth1 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 -j DROP

is the a term for all ports instead of tcp port 22 (or whatever the individual port is)

To do this in particular (this rule for everything not on dport 22), you can specify an inverse rule like this:

iptables -A INPUT -p tcp --dport ! 22 -i eth1 -m state --state NEW -m recent --set

note the !. Basically this says, match where dport does not equal 22
-
Forums » Industry Forums » Wireless Service ProvidersPaint Mastic Tape »
« GPS conversion help  


Sunday, 06-Dec 10:40:30 Terms of Use | Privacy Policy | Hosting by www.nac.net - DSL,Hosting & Co-lo | feedback | contact
over 10 years online! © 1999-2009 dslreports.com.republican-creole
page compression OFF
Most commented news this week
· [163] Comcast Releasing Promised Usage Meter
· [147] Avast Antivirus Has Gone Mad
· [128] Comcast Makes NBC Universal Acquisition Official
· [127] The Bandwidth Hog Does Not Exist
· [105] Graduate Student Unveils Sprint's GPS Sharing With Feds
· [101] Google Invades ISP, OpenDNS Turf With Google Public DNS
· [85] FCC Ponders Moving From PSTN To IP Voice
· [82] Latest Consumer Reports Survey Not Kind To AT&T
· [81] New Bill Aims To Limit ETFs
· [75] Sprint Defuses GPS Privacy Media Bomb
Most people now reading
· Problems with rlslog.net? [TekSavvy]
· False positive in Avast! or is it real? [Security]
· Wife might have to work in.... Iowa for a few months!!! [General Questions]
· Bulb for garage door opener [Home Repair & Improvement]
· Is there any true cure for, or way to prevent, a hangover? [General Questions]
· Dr. Tim Ball On the Significance of the CRU Hacked Documents [Canadian Chat]
· [DNS] Google's public DNS... performance increases? [Comcast HSI]
· hardest class for new player to level [World of Warcraft]
· [Newsgroups] Newzleech down? [Filesharing Software]
· How fast is your upstream internet connection? [General Questions]