republican-creole
Search:  

 
 
   All ForumsHot TopicsGallery






how-to block ads


 
Forums » Industry Forums » Wireless Service Providers » firewall rule question
Search Topic:
Uniqs:
181
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  


Monday, 23-Nov 23:29:39 Terms of Use | Privacy Policy | Hosting by www.nac.net - DSL,Hosting & Co-lo | feedback | contact
over 10 years online! © 1999-2009 dslreports.com.
page compression OFF
Most commented news this week
· [83] New AT&T Ad Campaign Hits Back At Verizon
· [46] New Bill Takes Aim At Higher Verizon ETFs
· [29] Earthlink Suffers From Major E-mail Outage
· [29] AT&T Offers New Prepaid Wireless plans
· [25] Frontier Increases Modem Rental Fee
· [12] Vivendi In Way Of Comcast's NBC Desires
· [10] Charter Still Fighting With Creditors
· [7] Monday Morning Links
Most people now reading
· Connecting to Google Voice Via SIP [VOIP Tech Chat]
· Windows 7 boot manager editing questions [Microsoft Help]
· Atlanta 6MB DSL at 291kpbs down?! WTF?! [AT&T Southeast]
· 3.x Feral Druid - Bear Tanking Guide [World of Warcraft]
· Getting ready to pull the trigger, still have cold feet. [VOIP Tech Chat]
· Big Bank Alternative to Bank of America? [General Questions]
· Gizmo5 has added a Google Voice section in its members area. [VOIP Tech Chat]
· Firearms: Ammo question. [General Questions]
· netTalk tk6000 [VOIP Tech Chat]
· Killing the source - Google bans advertisers, not just ads [Security]