Linux Netfilter discussions
 help / color / mirror / Atom feed
* use iptables to prevent DOS
@ 2004-01-02  8:11 Bill Fung
  0 siblings, 0 replies; only message in thread
From: Bill Fung @ 2004-01-02  8:11 UTC (permalink / raw)
  To: netfilter

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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-01-02  8:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-02  8:11 use iptables to prevent DOS Bill Fung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox