do some basic traffic shaping on soriano
[mirror/dsa-puppet.git] / modules / roles / templates / security-tracker / traffic-shape
1 #!/bin/bash
2
3 tc qdisc del dev eth0 root
4 tc qdisc add dev eth0 root handle 1:0 htb default 10
5 tc class add dev eth0 parent 1:0 classid 1:10 htb rate 1gbps prio 0
6 tc class add dev eth0 parent 1:0 classid 1:20 htb rate 20mbit ceil 16mbit prio 0
7 tc class add dev eth0 parent 1:0 classid 1:30 htb rate 1mbit ceil 1mbit prio 0
8
9 tc filter add dev eth0 parent 1:0 prio 0 protocol ip handle 20 fw flowid 1:20
10 tc filter add dev eth0 parent 1:0 prio 0 protocol ip handle 30 fw flowid 1:30
11
12 ipset -exist create http_abuser hash:ip timeout 3600
13
14 # iptables -I INPUT -p tcp --dport 80 -m string --algo bm --string 'GET /tor/status-vote/current/consensus HTTP' -j SET --add-set http_abuser src
15 #iptables -A OUTPUT -t mangle -p tcp --sport 443 -j MARK --set-mark 20
16 #iptables -A OUTPUT -t mangle -p tcp --sport 443 -m set --match-set http_abuser dst -j MARK --set-mark 30
17 #A=""
18 ## A="$A 192.0.2.1" # whitelist
19 #for i in $A; do
20  #iptables -I OUTPUT -t mangle -p tcp --sport 443 --destination $i -j ACCEPT
21 #done
22