LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 09-14-2016, 02:01 AM   #1
Davisn23
LQ Newbie
 
Registered: Sep 2016
Posts: 5

Rep: Reputation: Disabled
IPTables hashlimit-above incorrect count


Hi,

I'm currently having trouble trying to setup a rule on IPTables to rate-limit certain packets. I can't just use the normal limit mode on iptables as this has to be per dstip and dstport.

The rule looks like this:
Code:
iptables -A PREROUTING -t raw -p udp -m hashlimit -m u32 --u32 "0x0>>0x16&0x3c@0x9&0xff=0x55" --dport 27015:27105 --hashlimit-mode dstip,dstport --hashlimit-above 500/sec --hashlimit-name PLAYERQUERY -j DROP
This seems to work correctly and will rate-limit when a significant amount comes in, however I can see random packets being dropped even when under the 500/sec limit. I'm verifying this by using wireshark across our nodes and I'm only seeing maybe 20~ a second.

Regards,
David

Last edited by Davisn23; 09-14-2016 at 02:02 AM.
 
Old 09-15-2016, 08:50 AM   #2
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
You are seeing packets being dropped but you are not logging why they are being dropped. You should log all packets being dropped and label them as to what they are being dropped for then you would have a better understanding what is being dropped and why. Presently you are shooting in the dark and hoping to find the target.

Just because packets are being dropped doesn't mean the above rule is dropping them.
 
Old 09-20-2016, 02:53 AM   #3
EricStJEan
LQ Newbie
 
Registered: Sep 2016
Posts: 1

Rep: Reputation: Disabled
Question

Hi

lazydog, it's easy to see that the rule drop paquets with the "-v" argument of iptables. Maybe Davisn23 did that....


i have the same probleme of Davisn23 with another similar rule:
rule "B":
iptables -I INPUT 1 -m hashlimit -m tcp -p tcp --dport 80 -i eth0 --hashlimit-above 256/sec --hashlimit-burst 512 --hashlimit-mode srcip --hashlimit-name reg_html1 -m state --state NEW -j DROP

I saw some ramdom packet drop with that rule (iptables -t filter -L -v)


A rule "A", before this one, shows that the rate limit is not the reason of the drops:
iptables -I INPUT 1 -p tcp --dport ssh -m state --state NEW -m recent --set

So if i test the rules with a rate of a few packets per second (less than 256/sec ) i see that paskets in the rule A, and from time to time, rule "B" drops some packets.

Regards,
Eric
 
Old 09-21-2016, 02:56 PM   #4
Davisn23
LQ Newbie
 
Registered: Sep 2016
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by EricStJEan View Post
Hi

lazydog, it's easy to see that the rule drop paquets with the "-v" argument of iptables. Maybe Davisn23 did that....


i have the same probleme of Davisn23 with another similar rule:
rule "B":
iptables -I INPUT 1 -m hashlimit -m tcp -p tcp --dport 80 -i eth0 --hashlimit-above 256/sec --hashlimit-burst 512 --hashlimit-mode srcip --hashlimit-name reg_html1 -m state --state NEW -j DROP

I saw some ramdom packet drop with that rule (iptables -t filter -L -v)


A rule "A", before this one, shows that the rate limit is not the reason of the drops:
iptables -I INPUT 1 -p tcp --dport ssh -m state --state NEW -m recent --set

So if i test the rules with a rate of a few packets per second (less than 256/sec ) i see that paskets in the rule A, and from time to time, rule "B" drops some packets.

Regards,
Eric
Hi,

Yes, I was verifying this with the -nvL option.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] iptables/ipset configuration with hashlimit/limit not behaving properly freeindy Linux - Security 1 03-06-2014 06:29 AM
IPTables (connLimit vs hashlimit) nanogoo Linux - Security 3 01-24-2011 04:51 AM
Incorrect post count Redshift LQ Suggestions & Feedback 8 02-26-2007 11:12 AM
RHEL4 - Memory count incorrect? logosys Linux - Newbie 1 08-09-2005 10:29 PM
Slackware ISO Block count incorrect? wh33t Slackware 5 02-01-2005 07:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 04:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration