From: Peggy Kam <ppkam@n-dsi.com>
To: netfilter@lists.netfilter.org
Subject: How to test synflood prevention
Date: Mon, 16 Feb 2004 17:52:17 -0500 [thread overview]
Message-ID: <403149A1.8000704@n-dsi.com> (raw)
Hi,
I have set up some rules for preventing the synflood attack, ie:
iptables -A SYN_FLOOD -m limit --limit 2/s --limit-burst 4 -j ACCEPT
iptables -A SYN_FLOOD -j DROP
iptables -A SYN_FLOOD -i eth1 -p tcp ! --syn -m state --state NEW -j DROP
However, the firewall does not seem to filter any packets. I have used
the following tcpflood.c program to generate the flood, however, when I
used tcpdump and checked the message log with the firewall with and
without the above rules, they gave me the same results. So, may I ask
how I can test the firewall for DoS attack?
Thanks in advance,
Peggy
#tcpflood.c
#include <unistd.h>
#include <stdio.h>
#include <netdb.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
int main(int argc, char **argv) {
struct sockaddr_in to_addr;
int s;
bzero(&to_addr, sizeof(to_addr));
to_addr.sin_family=AF_INET;
if ( argc == 3 ) {
to_addr.sin_addr.s_addr=inet_addr(argv[1]);
to_addr.sin_port=htons(atoi(argv[2]));
}
else {
fprintf(stderr, "Usage: %s <IP> <PORT>\n", argv[0]);
return 1;
}
printf("Flooding %s:%d ...\n", argv[1], atoi(argv[2]));
while (1) {
if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
fprintf(stderr, "Error: socket()\n");
return 1;
}
if ((connect(s, (struct sockaddr *)&to_addr, sizeof to_addr)) < 0) {
perror("connect()");
return 1;
}
printf(".");
fflush(stdout);
close(s);
}
return 0;
}
next reply other threads:[~2004-02-16 22:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-16 22:52 Peggy Kam [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-02-16 22:55 How to test synflood prevention Daniel Chemko
2004-02-18 19:01 ` Peggy Kam
2004-02-18 20:31 ` Peggy Kam
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=403149A1.8000704@n-dsi.com \
--to=ppkam@n-dsi.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.