summaryrefslogtreecommitdiffstats
path: root/examples/SYN-DoS.rate.limit
blob: 8766b679ce36d1868c19d54963181c5c7fa30acf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#! /bin/sh -x
#
# sample script on using the ingress capabilities
# this script shows how one can rate limit incoming SYNs
# Useful for TCP-SYN attack protection. You can use
# IPchains to have more powerful additions to the SYN (eg 
# in addition the subnet)
#
#path to various utilities;
#change to reflect yours.
#
IPROUTE=/root/DS-6-beta/iproute2-990530-dsing
TC=$IPROUTE/tc/tc
IP=$IPROUTE/ip/ip
IPCHAINS=/root/DS-6-beta/ipchains-1.3.9/ipchains
INDEV=eth2
#
# tag all incoming SYN packets through $INDEV as mark value 1
############################################################ 
$IPCHAINS -A input -i $INDEV -y -m 1
############################################################ 
#
# install the ingress qdisc on the ingress interface
############################################################ 
$TC qdisc add dev $INDEV handle ffff: ingress
############################################################ 

#
# 
# SYN packets are 40 bytes (320 bits) so three SYNs equals
# 960 bits (approximately 1kbit); so we rate limit below
# the incoming SYNs to 3/sec (not very sueful really; but
#serves to show the point - JHS
############################################################ 
$TC filter add dev $INDEV parent ffff: protocol ip prio 50 handle 1 fw \
police rate 1kbit burst 40 mtu 9k drop flowid :1
############################################################ 


#
echo "---- qdisc parameters Ingress  ----------"
$TC qdisc ls dev $INDEV
echo "---- Class parameters Ingress  ----------"
$TC class ls dev $INDEV
echo "---- filter parameters Ingress ----------"
$TC filter ls dev $INDEV parent ffff:

#deleting the ingress qdisc
#$TC qdisc del $INDEV ingress
005-06-181-14/+9 * [PKT_SCHED]: Cleanup fifo qdisc and remove unnecessary codeThomas Graf2005-06-181-38/+12 * [PKT_SCHED]: Transform fifo qdisc to use generic queue management interfaceThomas Graf2005-06-181-88/+14 * [SCTP]: Replace spin_lock_irqsave with spin_lock_bhHerbert Xu2005-06-181-6/+2 * [IPV4/IPV6]: Replace spin_lock_irq with spin_lock_bhHerbert Xu2005-06-185-14/+14 * [NETLINK]: Set correct pid for ioctl originating netlink eventsJamal Hadi Salim2005-06-184-7/+7 * [NETLINK]: Explicit typingJamal Hadi Salim2005-06-184-20/+16 * [DECNET]: Remove unnecessary initilization of unused variable entriesThomas Graf2005-06-181-1/+0 * [IPSEC]: Add XFRMA_SA/XFRMA_POLICY for delete notificationHerbert Xu2005-06-181-4/+43 * [NETLINK]: Correctly set NLM_F_MULTI without checking the pidJamal Hadi Salim2005-06-1814-78/+83 * [NETLINK]: Introduce NLMSG_NEW macro to better handle netlink flagsThomas Graf2005-06-182-7/+9 * [PKT_SCHED]: Logic simplifications and codingstyle/whitespace cleanupsThomas Graf2005-06-181-86/+88 * [PKT_SCHED]: Make dsmark use the new dumping macrosThomas Graf2005-06-181-28/+24 * [PKT_SCHED]: Fix dsmark to apply changes consistentThomas Graf2005-06-181-49/+82 * [NEIGH]: Fix use of uninitialized variable when trimming in neightbl_fill_parmsThomas Graf2005-06-181-1/+3 * [NETLINK]: Kill bogus NLMSG_SET_MULTIPART uses.Thomas Graf2005-06-181-4/+4 * [NETLINK]: Neighbour table configuration and statistics via rtnetlinkThomas Graf2005-06-182-11/+326 * [NET]: Move sysctl_max_syn_backlog into request_sock.cDavid S. Miller2005-06-182-16/+16 * [NET] rename struct tcp_listen_opt to struct listen_sockArnaldo Carvalho de Melo2005-06-186-9/+9 * [NET] Generalise tcp_listen_optArnaldo Carvalho de Melo2005-06-188-92/+94 * [NET] Rename open_request to request_sockArnaldo Carvalho de Melo2005-06-188-74/+74 * [NET] Generalise TCP's struct open_request minisock infrastructureArnaldo Carvalho de Melo2005-06-189-151/+200 * [IPSEC] Use NLMSG_LENGTH in xfrm_exp_state_notifyJamal Hadi Salim2005-06-181-2/+2 * [IPSEC] Fix xfrm_state leaks in error pathPatrick McHardy2005-06-182-4/+4 * [IPSEC] Use XFRM_MSG_* instead of XFRM_SAP_*Herbert Xu2005-06-183-77/+50 * [IPSEC] Set byid for km_event in xfrm_get_policyHerbert Xu2005-06-181-0/+1 * [IPSEC] Turn km_event.data into a unionHerbert Xu2005-06-183-20/+11 * [IPSEC] Fix xfrm to pfkey SA state conversionHerbert Xu2005-06-181-5/+10 * [IPSEC] Kill spurious hard expire messagesHerbert Xu2005-06-182-12/+12 * [IPSEC] Add complete xfrm event notificationJamal Hadi Salim2005-06-183-115/+588 * Merge master.kernel.org:/pub/scm/linux/kernel/git/dwmw2/audit-2.6Linus Torvalds2005-06-181-2/+7 |\ | * Merge with master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6.gitDavid Woodhouse2005-06-18