Visit the LQ Articles and Editorials section
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 05-26-2009, 01:03 AM   #1
LQ Newbie
Registered: May 2009
Posts: 11

Rep: Reputation: 0
How to drop packets


I want to drop some packets based on their sequence number, which are coming to my system.

Can anybody suggest, how to do so?

Old 05-26-2009, 10:52 AM   #2
Senior Member
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
iptables software does that
man iptables
Old 06-18-2009, 11:56 AM   #3
Senior Member
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 232Reputation: 232Reputation: 232
Or http://iptables-tutorial.frozentux.n...-tutorial.html
Old 06-18-2009, 03:14 PM   #4
Registered: Sep 2005
Location: Bulgaria
Distribution: Debian, CentOS
Posts: 46

Rep: Reputation: 16
This is simple example how to drop tcp packets based on flags, this flag combination described bellow will never been send from "normal" (web browser, ftp client, etc. )software, they can be send from portscanner or something similar.

Creating new chain
iptables -N dropp
Setting rules in chain
iptables -A dropp -p tcp --tcp-flags ALL FIN,URG,PSH -j badflags
iptables -A dropp -p tcp --tcp-flags ALL ALL -j badflags
iptables -A dropp -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j badflags
iptables -A dropp -p tcp --tcp-flags ALL NONE -j badflags
iptables -A dropp -p tcp --tcp-flags SYN,RST SYN,RST -j badflags
iptables -A dropp -p tcp --tcp-flags SYN,FIN SYN,FIN -j badflags


iptables -N badflags
iptables -A badflags -m limit --limit 15/minute -j LOG --log-prefix Badflags:
iptables -A badflags -j DROP
But to understand how to wrote your own rules you must read man iptables carefully .
Iptables is very powerful tool and thats why the beginning is a little hard.
Old 07-06-2009, 05:15 AM   #5
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Originally Posted by satya_seth View Post
I want to drop some packets based on their sequence number, which are coming to my system.

Can anybody suggest, how to do so?
Iptables can do this with the u32 module.

There's a HOWTO for this here (jump to the section called Moving on to the TCP header).
Old 07-06-2009, 05:30 AM   #6
Registered: Jun 2009
Location: INDIA
Distribution: RHEL-5
Posts: 174
Blog Entries: 3

Rep: Reputation: 38
go for Iptables it works for u.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Capture, drop packets using C pumpkin Linux - Networking 12 03-14-2012 05:36 AM
Sudden drop of TX packets which unables me to browse Choucete Linux - Networking 1 09-18-2008 01:47 PM
drop packets for specific port with iptables ohcarol Linux - Security 1 07-03-2005 11:48 AM
How to intentionally drop packets? imarunner Linux - Networking 5 12-31-2003 09:10 AM
why does the kernel drop packets ? Linux - Networking 3 12-08-2002 01:47 AM

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

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