Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Bill Fung <ccbill@ust.hk>
To: netfilter@lists.netfilter.org
Subject: use iptables to prevent DOS
Date: Fri, 02 Jan 2004 16:11:18 +0800	[thread overview]
Message-ID: <3FF527A6.4070205@ust.hk> (raw)

Hi all,

I want to use ipchains to prevent dos and log some dos packets.

 From netfilter documentation:

Syn-flood protection:

    ||

# iptables -A FORWARD -p tcp --syn -m limit --limit 1/s -j ACCEPT
  

I wonder why it add to FORWARD chain? The dos should be against the local machine, so I guess it should add to INPUT chain, right?

I have used the following rules to prevent dos to my machine. I have search the web and can't find any dos tool to try my rules. May I ask if the following suit my purpose?
The following mainly limit the rate of syn to 1 per second. It logs the excessive syn flood packet information to log and then drop that packet.

iptables -A INPUT -p tcp --syn -m limit --limit 1/s -j ACCEPT
iptables -A INPUT -p tcp --syn -j LOG --log-prefix "SYN FLOOD "
iptables -A INPUT -p tcp --syn -j DROP
iptables -L

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere           tcp flags:SYN,RST,ACK/SYN limit: avg 1/sec burst 5
LOG        tcp  --  anywhere             anywhere           tcp flags:SYN,RST,ACK/SYN LOG level warning prefix `DEF '
DROP       tcp  --  anywhere             anywhere           tcp flags:SYN,RST,ACK/SYN

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination


Thanks a lot.

Besides, I would like to use "echo 1 > /proc/sys/net/ipv4/tcp_syncookies" too. Why approach is better for prevent dos? What is the differences? Is it the best to use both simultaneourly?

Bill
HKUST




                 reply	other threads:[~2004-01-02  8:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3FF527A6.4070205@ust.hk \
    --to=ccbill@ust.hk \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox