All pastes #737415 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-10-15 12:39 UTC
rendered paste body
# This is outgoing traffic on primary interface 
# $1 is the name of the primary interface
# 448Kbit is the theoretical maximum upload speed

tc qdisc  del dev $1 root 2>/dev/null || true
tc qdisc  add dev $1 root handle 1: htb default 30
tc class  add dev $1 parent 1:   classid 1:1  htb rate 448kbit ceil 448kbit burst 2560
tc class  add dev $1 parent 1:1  classid 1:10 htb rate 150kbit ceil 448kbit quantum 1200 burst 2560 cburst 1280 prio 0
tc class  add dev $1 parent 1:1  classid 1:11 htb rate 298kbit ceil 448kbit quantum 1200 burst 2560 cburst 1280 prio 0
tc class  add dev $1 parent 1:11 classid 1:20 htb rate 150kbit ceil 448kbit quantum 1200 burst 2560 cburst 1280 prio 2
tc class  add dev $1 parent 1:11 classid 1:30 htb rate  80kbit ceil 448kbit quantum 1200 burst 2560 cburst 1280 prio 4
tc class  add dev $1 parent 1:11 classid 1:40 htb rate  48kbit ceil 448kbit quantum 1200 burst 2560 cburst 1280 prio 6
#tc qdisc  add dev $1 parent 1:10 handle 10: sfq perturb 10
tc qdisc  add dev $1 parent 1:10 handle 10: pfifo limit 10
tc qdisc  add dev $1 parent 1:20 handle 20: sfq perturb 10
tc qdisc  add dev $1 parent 1:30 handle 30: sfq perturb 10
tc qdisc  add dev $1 parent 1:40 handle 40: sfq perturb 10

# This rule matches esp traffic for ipsec
tc filter add dev $1 protocol ip parent 1: prio 1 u32 match ip protocol 50   0xff   flowid 1:10
# and this rule matches an ip
tc filter add dev $1 protocol ip parent 1: prio 1 u32 match ip dst 216.158.52.64/32 flowid 1:10
# and this rule matches icmp
tc filter add dev $1 protocol ip parent 1: prio 2 u32 match ip protocol 1    0xff   flowid 1:10
# Some port based rules
tc filter add dev $1 protocol ip parent 1: prio 3 u32 match ip dport 53      0xffff flowid 1:20
tc filter add dev $1 protocol ip parent 1: prio 3 u32 match ip dport 123     0xffff flowid 1:20
tc filter add dev $1 protocol ip parent 1: prio 4 u32 match ip dport 1194    0xffff flowid 1:20
tc filter add dev $1 protocol ip parent 1: prio 4 u32 match ip sport 1194    0xffff flowid 1:20
tc filter add dev $1 protocol ip parent 1: prio 4 u32 match ip dport 22      0xffff flowid 1:20
tc filter add dev $1 protocol ip parent 1: prio 4 u32 match ip sport 22      0xffff flowid 1:20
tc filter add dev $1 protocol ip parent 1: prio 4 u32 match ip sport 16881   0xffff flowid 1:40
tc filter add dev $1 protocol ip parent 1: prio 4 u32 match ip dport 16881   0xffff flowid 1:40
tc filter add dev $1 protocol ip parent 1: prio 4 u32 match ip sport 16882   0xffff flowid 1:40
tc filter add dev $1 protocol ip parent 1: prio 4 u32 match ip dport 16882   0xffff flowid 1:40
tc filter add dev $1 protocol ip parent 1: prio 5 u32 match ip dport 25      0xffff flowid 1:30

# experimental - should match contentless ack's
tc filter add dev $1 protocol ip parent 1: prio 6 u32 match ip protocol 6    0xff  \
                                                        match u8 0x05 0x0f     at 0  \
                                                        match u16 0x0000 0xffc0 at 2 \
                                                        match u8 0x10 0xff     at 33  flowid 1:20