I'm looking for a strange rule !

I wish to match a string with iptables, maintain the connexion in order to start the download, but after 2 seconds downloading, I wish to drop the connexion. PS: I know that this concept will corrupt files, it is what i want !

All suggestions are welcome ! Thanks

  • Can you make your question clearly !!!
    – Kumar
    Dec 2, 2013 at 18:27
  • An iptables -L -v -n output in your question helped you a lot to get meaningful answers.
    – peterh
    Dec 2, 2013 at 19:31
  • So you want to allow the connection to start, but then stop. Have you thought about pulling out the ethernet cable part way through?
    – hookenz
    Dec 2, 2013 at 19:56
  • I will try to explain with more details. I need to stop during downloads some files that content special headers. These headers are matched with strings from iptables. My idea was to play with recent and seconds in order to start downloads. If the header is matched, in this case, I let few seconds and drop. I tried to play with fail2ban rules, but results are not what i am looking for. Any help ?
    – marco
    Dec 2, 2013 at 21:35

1 Answer 1


How about "few bytes and drop" instead "few seconds and drop"?

if ok, URL below may help your idea.

How to identify download traffic using iptables

  • Yes, it is useful, how to add a string matching condition in these chains ?
    – marco
    Dec 3, 2013 at 10:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.