1 | 2 | simandl | #!/bin/sh |
2 | | | # |
3 | | | # CZFree.Net RFC-QoS script |
4 | | | # |
5 | 26 | simandl | # date: 30/06/2008 |
6 | 28 | simandl | # authors: Rakerihoo, Fyzik, Libor, Dzus, Bonez, Simandl, Danny, Sinda |
7 | 2 | simandl | # references: http://www.lartc.org/ |
8 | | | # http://luxik.cdi.cz/~devik/qos/htb/ |
9 | 28 | simandl | # http://connected.prosek.czf/forum/showthread.php?s=&threadid=9 |
10 | 13 | simandl | # http://www.simandl.cz/stranky/linux/qos/soubory/qos_base |
11 | 4 | simandl | # version: 2.1.6 |
12 | 28 | simandl | # ps ver : 0.1.8 |
13 | 2 | simandl | # |
14 | | | # Changelog |
15 | | | # |
16 | 28 | simandl | # 28/09/08 [simandl] doplneni chybejicich autoru a zmena v references 10.24.1.2 na connected.prosek.czf |
17 | 27 | simandl | # 05/08/08 [simandl] podpora pro Americas Army |
18 | 26 | simandl | # 30/06/08 [simandl] podpora pro L2TP port 1701 UDP |
19 | 25 | simandl | # 09/03/08 [simandl] podpora pro noncontrib |
20 | 23 | simandl | # 01/12/07 [simandl] doplnena podpora pro hru "World Of Warcraft" 8085 3724 |
21 | 19 | simandl | # 09/08/07 [sinda] doplnena podpora pro hru "Counter-Strike Source" UDP 270xx |
22 | 18 | simandl | # 26/07/07 [sinda] doplnena podpora pro RTP ha-vel.cz a 802.cz dle ip adresy rtp serveru operatora |
23 | 15 | simandl | # 31/08/06 [simandl] doplnena podpora pro definici rychlosti a delitelu pro kazdy iface zvlast v souboru iface_conf |
24 | 14 | simandl | # 14/07/06 [sinda] doplneny porty pro hru Quake 3 arena |
25 | 13 | simandl | # 17/01/06 [simandl] doplneny TOSy pro ha-vel a hlas.802.cz do VoIP tridy 50 |
26 | | | # 12/12/05 [simandl] preskupeny protokoly trid - 40 mail&data 50 voip 60 web&squid - tak aby byly rovnomerne vyuzite |
27 | 10 | simandl | # 23/11/05 [simandl] doplneny porty pro Lineage2 a Teamspeak |
28 | 9 | simandl | # 22/11/05 [danny] DSCP/ToS filtry pro SIP/RTP (VoIP), maximum reliability [DEV] |
29 | 8 | simandl | # 20/11/05 [simandl] doplnen port pro RTP |
30 | 6 | simandl | # 14/11/05 [simandl] doplneny porty pro SIP a gnomemeeting |
31 | 5 | simandl | # 08/11/05 [simandl] doplneny porty pro H.323 |
32 | | | # 19/08/05 [simandl] doplneny porty pro hru DarkEden |
33 | 4 | simandl | # 30/10/04 [dzus] oprava parseru MTU, vylepseni kontroly konfig. souboru |
34 | | | # 27/10/04 [bonez] OpenVPN pridano do data transfer class |
35 | | | # 05/06/04 [dzus] do interactive class pridan BZFlag, uprava parseru konfig souboru |
36 | 2 | simandl | # 18/02/04 [dzus] SCP zarazeno do download class (rozliseno podle TOS maximize throughput) |
37 | | | # 04/01/04 [dzus] podpora pro Jedi Knight, oprava prio u filtru, oprava filtru na FTP, zruseni PPTP class |
38 | | | # 20/11/03 [dzus] zrusena H323 class, pridan filtr na TCP ACK, nastaveni quantum podle MTU |
39 | | | # 28/09/03 [dzus] oprava bugu ve filtrech (bez prio to nechodi dobre) |
40 | | | # 27/09/03 [dzus] konfigurace interfacu se nacita z ext souboru, pridan TOS minimize delay filtr |
41 | | | # 20/09/03 [dzus] vyhazeni marku z IPtables, nyni pouze filtry v tc |
42 | | | # 01/09/03 [dzus] vynechani internetoveho rozhrani z konfigurace |
43 | | | # 07/08/03 [fyzik] preference Inetoveho traffiku |
44 | | | # 31/07/03 [fyzik] podpora pro HL@tchor, airfree, fixes |
45 | | | # 05/05/03 [fyzik] podpora pro IRC, PPTP, H323, LDAP, DC, NTP |
46 | | | # 04/05/03 [fyzik] napsal uvod |
47 | | | # 01/05/03 [fyzik] non-CZF-RFC, inspirovan Liborovym Heaven QoS |
48 | | | # 00/03/03 [Rakerihoo] napsal RFC-QoS :) |
49 | | | # |
50 | | | # ToDo |
51 | | | # * zkusit a otestovat podtridy CZF-transfer, CZF-klient, CZF-shared a markovanat podle MAC |
52 | | | # * pridat podporu ostatnich interaktivnich games |
53 | | | |
54 | | | |
55 | | | ### Configuration START |
56 | | | |
57 | 21 | simandl | IFACECONFFILE='/etc/qos/iface_conf' |
58 | | | IPADDRFILE="/etc/qos/ip_adresy" |
59 | 2 | simandl | |
60 | 15 | simandl | #default speeds and dividers |
61 | | | DNONCZFSPD='64' |
62 | 25 | simandl | DNONCONTRIBSPD='64' |
63 | 18 | simandl | DAIRFREESPD='2048' |
64 | 15 | simandl | DSSHDIV='2' |
65 | | | DPINGDIV='2' |
66 | | | DINTERACTDIV='2' |
67 | | | DVOIPDIV='2' |
68 | | | DWWWDIV='2' |
69 | | | DXFERDIV='4' |
70 | | | DDFLTDIV='8' |
71 | 13 | simandl | |
72 | 2 | simandl | ### Configuration STOP |
73 | | | |
74 | | | if [ ! -f $IFACECONFFILE ] |
75 | | | then |
76 | | | echo "Interface configuration file doesn't exist - program terminated" 1>&2 |
77 | | | exit 1 |
78 | | | fi |
79 | | | |
80 | 4 | simandl | IFACECONF=`grep -v '^[[:space:]]*#' $IFACECONFFILE` |
81 | | | IFACECONF=`echo $IFACECONF | sed -e 's/[[:space:]]*}[[:space:]]*/}\\\n/g'` |
82 | | | FACES=`echo -e $IFACECONF | sed -e 's/^[[:space:]]*interface[[:space:]]\+\([[:alnum:]]\+\).*/\1/;t;d'` |
83 | 2 | simandl | |
84 | | | echo "Applying CZF-QOS rules" |
85 | | | |
86 | | | echo "-Set global variables" |
87 | | | IPTABLES="`which iptables`" |
88 | | | TC="`which tc`" |
89 | | | IP="`which ip`" |
90 | | | IPT_RESTORE="`which iptables-restore`" |
91 | | | |
92 | | | STOCHASIS="sfq perturb 10" |
93 | | | |
94 | | | QUANTUMOFFS="500" |
95 | | | |
96 | | | #$IPT_RESTORE < /etc/network/iptables |
97 | | | |
98 | | | echo "-Remove Qdisc root classes" |
99 | | | for FACE in ${FACES} ; do |
100 | | | $TC qdisc del dev ${FACE} root &>/dev/null |
101 | 15 | simandl | #echo $FACE |
102 | 2 | simandl | done |
103 | | | |
104 | | | ## qoseni podle IP - priklad |
105 | | | if [ -f $IPADDRFILE ] |
106 | | | then |
107 | 4 | simandl | NONCZF="`sed -e 's/^[[:space:]]*\([[:digit:].,/]\+\)[[:space:]].*NONCZF[[:space:]]*\+/\1/;t repl;d;: repl;y/,/ /' $IPADDRFILE`" |
108 | | | NONCZF="$NONCZF `sed -e 's/^.*[[:space:]]\+NONCZF[[:space:]]\+\([[:digit:].,/]\+\)[[:space:]]*/\1/;t repl;d;: repl;y/,/ /' $IPADDRFILE`" |
109 | 25 | simandl | NONCONTRIB="`sed -e 's/^[[:space:]]*\([[:digit:].,/]\+\)[[:space:]].*NONCONTRIB[[:space:]]*\+/\1/;t repl;d;: repl;y/,/ /' $IPADDRFILE`" |
110 | | | NONCONTRIB="$NONCONTRIB `sed -e 's/^.*[[:space:]]\+NONCONTRIB[[:space:]]\+\([[:digit:].,/]\+\)[[:space:]]*/\1/;t repl;d;: repl;y/,/ /' $IPADDRFILE`" |
111 | 4 | simandl | AIRFREE="`sed -e 's/^[[:space:]]*\([[:digit:].,/]\+\)[[:space:]].*AIRFREE[[:space:]]*\+/\1/;t repl;d;: repl;y/,/ /' $IPADDRFILE`" |
112 | | | AIRFREE="$AIRFREE `sed -e 's/^.*[[:space:]]\+AIRFREE[[:space:]]\+\([[:digit:].,/]\+\)[[:space:]]*/\1/;t repl;d;: repl;y/,/ /' $IPADDRFILE`" |
113 | 2 | simandl | fi |
114 | | | |
115 | | | set_qos_classes () { |
116 | | | echo "-Initializing QoS_base rules on interface $FACE (speed $SPEED)" |
117 | | | |
118 | | | $TC qdisc add dev ${FACE} root handle 1: htb default 300 r2q 2 |
119 | | | $TC class add dev ${FACE} parent 1: classid 1:1 htb rate $((${SPEED}/2))kbit ceil ${SPEED}kbit burst 15k quantum ${QUANTUM} |
120 | 14 | simandl | $TC class add dev ${FACE} parent 1:1 classid 1:5 htb rate 64kbit ceil $((${SPEED}/${SSHDIV}))kbit burst 5k prio 0 # SSH class |
121 | | | $TC class add dev ${FACE} parent 1:1 classid 1:10 htb rate 64kbit ceil $((${SPEED}/${INTERACTDIV}))kbit burst 5k prio 1 # interactive class |
122 | | | $TC class add dev ${FACE} parent 1:1 classid 1:20 htb rate 32kbit ceil $((${SPEED}/${PINGDIV}))kbit burst 5k prio 0 |
123 | | | $TC class add dev ${FACE} parent 1:1 classid 1:30 htb rate 32kbit ceil 128kbit burst 5k prio 0 # routing class |
124 | 13 | simandl | $TC class add dev ${FACE} parent 1:1 classid 1:40 htb rate 32kbit ceil $((${SPEED}/${XFERDIV}))kbit burst 5k prio 4 # email & data transfer class |
125 | | | $TC class add dev ${FACE} parent 1:1 classid 1:50 htb rate 32kbit ceil $((${SPEED}/${VOIPDIV}))kbit burst 5k prio 1 # voip class |
126 | | | $TC class add dev ${FACE} parent 1:1 classid 1:60 htb rate 32kbit ceil $((${SPEED}/${WWWDIV}))kbit burst 8k prio 3 # web & squid class |
127 | | | $TC class add dev ${FACE} parent 1:1 classid 1:300 htb rate 32kbit ceil $((${SPEED}/${DFLTDIV}))kbit burst 1k prio 5 # default trafic class |
128 | 2 | simandl | $TC class add dev ${FACE} parent 1:1 classid 1:666 htb rate 32kbit ceil ${NONCZFSPD}kbit burst 1k prio 5 # unsupported trafic class |
129 | | | $TC class add dev ${FACE} parent 1:1 classid 1:667 htb rate 32kbit ceil ${AIRFREESPD}kbit burst 1k prio 4 # local wireless free band |
130 | 25 | simandl | $TC class add dev ${FACE} parent 1:1 classid 1:668 htb rate 32kbit ceil ${NONCONTRIBSPD}kbit burst 1k prio 5 # non contributors trafic class |
131 | 4 | simandl | # $TC class add dev ${FACE} parent 1:1 classid 1:999 htb rate 32kbit ceil $((${SPEED}/2))kbit burst 8k prio 4 # Inet traffic class |
132 | 2 | simandl | |
133 | | | $TC qdisc add dev ${FACE} parent 1:5 handle 5: $STOCHASIS # SSH sub-classes |
134 | | | $TC qdisc add dev ${FACE} parent 1:10 handle 10: $STOCHASIS # interactive sub-classes |
135 | | | $TC qdisc add dev ${FACE} parent 1:20 handle 20: $STOCHASIS # ping sub-classes |
136 | | | $TC qdisc add dev ${FACE} parent 1:30 handle 30: $STOCHASIS # routing sub-classes |
137 | 13 | simandl | $TC qdisc add dev ${FACE} parent 1:40 handle 40: $STOCHASIS # email & data transfer sub-classes |
138 | | | $TC qdisc add dev ${FACE} parent 1:50 handle 50: $STOCHASIS # voip sub-classes |
139 | | | $TC qdisc add dev ${FACE} parent 1:60 handle 60: $STOCHASIS # web & squid sub-classes |
140 | 2 | simandl | $TC qdisc add dev ${FACE} parent 1:300 handle 300: $STOCHASIS # default class |
141 | 25 | simandl | $TC qdisc add dev ${FACE} parent 1:666 handle 666: $STOCHASIS # unsupported |
142 | | | $TC qdisc add dev ${FACE} parent 1:667 handle 667: $STOCHASIS # local wireless |
143 | | | $TC qdisc add dev ${FACE} parent 1:668 handle 668: $STOCHASIS # non contributor class |
144 | 4 | simandl | # $TC qdisc add dev ${FACE} parent 1:999 handle 999: $STOCHASIS # Inet traffic |
145 | 2 | simandl | |
146 | | | |
147 | | | ## SSH class |
148 | | | # SSH |
149 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 3 u32 match ip sport 22 0xffff match ip protocol 0x6 0xff flowid 1:5 |
150 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 3 u32 match ip dport 22 0xffff match ip protocol 0x6 0xff flowid 1:5 |
151 | | | |
152 | | | ## Interactive class |
153 | 13 | simandl | # NTP |
154 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 123 0xffff match ip protocol 0x6 0xff flowid 1:10 |
155 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 123 0xffff match ip protocol 0x6 0xff flowid 1:10 |
156 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 123 0xffff match ip protocol 0x11 0xff flowid 1:10 |
157 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 123 0xffff match ip protocol 0x11 0xff flowid 1:10 |
158 | 9 | simandl | # DNS |
159 | 2 | simandl | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 53 0xffff match ip protocol 0x6 0xff flowid 1:10 |
160 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 53 0xffff match ip protocol 0x6 0xff flowid 1:10 |
161 | | | # IRC |
162 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 194 0xffff match ip protocol 0x6 0xff flowid 1:10 |
163 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 194 0xffff match ip protocol 0x6 0xff flowid 1:10 |
164 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 6667 0xffff match ip protocol 0x6 0xff flowid 1:10 |
165 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 6667 0xffff match ip protocol 0x6 0xff flowid 1:10 |
166 | | | # LDAP, LDAPs |
167 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 389 0xffff match ip protocol 0x6 0xff flowid 1:10 |
168 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 389 0xffff match ip protocol 0x6 0xff flowid 1:10 |
169 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 636 0xffff match ip protocol 0x6 0xff flowid 1:10 |
170 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 636 0xffff match ip protocol 0x6 0xff flowid 1:10 |
171 | | | # GAMES |
172 | 23 | simandl | # World Of Warcraft |
173 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 8085 0xffff match ip protocol 0x11 0xff flowid 1:10 |
174 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 8085 0xffff match ip protocol 0x11 0xff flowid 1:10 |
175 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 3724 0xffff match ip protocol 0x11 0xff flowid 1:10 |
176 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 3724 0xffff match ip protocol 0x11 0xff flowid 1:10 |
177 | 14 | simandl | # vietcong |
178 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 5425 0xffff match ip protocol 0x11 0xff flowid 1:10 |
179 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 5425 0xffff match ip protocol 0x11 0xff flowid 1:10 |
180 | 7 | simandl | # LINEAGE2 |
181 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 2106 0xffff match ip protocol 0x11 0xff flowid 1:10 |
182 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 2106 0xffff match ip protocol 0x11 0xff flowid 1:10 |
183 | 2 | simandl | # Half-life |
184 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 27015 0xffff match ip protocol 0x11 0xff flowid 1:10 |
185 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 27015 0xffff match ip protocol 0x11 0xff flowid 1:10 |
186 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 27016 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
187 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 27016 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
188 | 4 | simandl | # UT2003, UT2004 |
189 | 2 | simandl | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 7777 0xffff match ip protocol 0x11 0xff flowid 1:10 |
190 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 7777 0xffff match ip protocol 0x11 0xff flowid 1:10 |
191 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 7778 0xffff match ip protocol 0x11 0xff flowid 1:10 |
192 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 7778 0xffff match ip protocol 0x11 0xff flowid 1:10 |
193 | 4 | simandl | # BZFlag |
194 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 5154 0xffff match ip protocol 0x11 0xff flowid 1:10 |
195 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 5154 0xffff match ip protocol 0x11 0xff flowid 1:10 |
196 | 2 | simandl | # JEDI KNIGHT |
197 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 28060 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
198 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 28060 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
199 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 28062 0xffff match ip protocol 0x11 0xff flowid 1:10 |
200 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 28062 0xffff match ip protocol 0x11 0xff flowid 1:10 |
201 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 28070 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
202 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 28070 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
203 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 28072 0xfff8 match ip protocol 0x11 0xff flowid 1:10 |
204 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 28072 0xfff8 match ip protocol 0x11 0xff flowid 1:10 |
205 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 28080 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
206 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 28080 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
207 | 5 | simandl | # Dark Eden |
208 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 9997 0xffff match ip protocol 0x11 0xff flowid 1:10 |
209 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 9997 0xffff match ip protocol 0x11 0xff flowid 1:10 |
210 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 9998 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
211 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 9998 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
212 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 9858 0xffff match ip protocol 0x11 0xff flowid 1:10 |
213 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 9858 0xffff match ip protocol 0x11 0xff flowid 1:10 |
214 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 9650 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
215 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 9650 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
216 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 4056 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
217 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 4056 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
218 | 14 | simandl | # Quake 3 arena |
219 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 27960 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
220 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 27960 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
221 | 19 | simandl | # Counter-Strike Source |
222 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 27000 0xfff8 match ip protocol 0x11 0xff flowid 1:10 |
223 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 27008 0xffc0 match ip protocol 0x11 0xff flowid 1:10 |
224 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 27072 0xfff0 match ip protocol 0x11 0xff flowid 1:10 |
225 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 27088 0xfff8 match ip protocol 0x11 0xff flowid 1:10 |
226 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 27096 0xfffc match ip protocol 0x11 0xff flowid 1:10 |
227 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 27000 0xfff8 match ip protocol 0x11 0xff flowid 1:10 |
228 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 27008 0xffc0 match ip protocol 0x11 0xff flowid 1:10 |
229 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 27072 0xfff0 match ip protocol 0x11 0xff flowid 1:10 |
230 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 27088 0xfff8 match ip protocol 0x11 0xff flowid 1:10 |
231 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 27096 0xfffc match ip protocol 0x11 0xff flowid 1:10 |
232 | 5 | simandl | # H323 |
233 | 9 | simandl | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 389 0xffff match ip protocol 0x11 0xff flowid 1:10 |
234 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 389 0xffff match ip protocol 0x11 0xff flowid 1:10 |
235 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 522 0xffff match ip protocol 0x11 0xff flowid 1:10 |
236 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 522 0xffff match ip protocol 0x11 0xff flowid 1:10 |
237 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 1503 0xffff match ip protocol 0x11 0xff flowid 1:10 |
238 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 1503 0xffff match ip protocol 0x11 0xff flowid 1:10 |
239 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 1720 0xffff match ip protocol 0x11 0xff flowid 1:10 |
240 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 1720 0xffff match ip protocol 0x11 0xff flowid 1:10 |
241 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 1731 0xffff match ip protocol 0x11 0xff flowid 1:10 |
242 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 1731 0xffff match ip protocol 0x11 0xff flowid 1:10 |
243 | 6 | simandl | # SIP |
244 | 9 | simandl | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 5060 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
245 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 5060 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
246 | 8 | simandl | # RTP |
247 | 9 | simandl | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 8000 0xffff match ip protocol 0x11 0xff flowid 1:10 |
248 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 8000 0xffff match ip protocol 0x11 0xff flowid 1:10 |
249 | 6 | simandl | # gnomemeeting |
250 | 9 | simandl | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 30000 0xfff8 match ip protocol 0x11 0xff flowid 1:10 |
251 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 30000 0xfff8 match ip protocol 0x11 0xff flowid 1:10 |
252 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 30008 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
253 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 30008 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
254 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 30010 0xffff match ip protocol 0x11 0xff flowid 1:10 |
255 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 30010 0xffff match ip protocol 0x11 0xff flowid 1:10 |
256 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 5000 0xfff8 match ip protocol 0x11 0xff flowid 1:10 |
257 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 5000 0xfff8 match ip protocol 0x11 0xff flowid 1:10 |
258 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 5010 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
259 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 5010 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
260 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 5012 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
261 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 5012 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
262 | 10 | simandl | # Lineage2 |
263 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 7777 0xffff match ip protocol 0x6 0xff flowid 1:10 |
264 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 7777 0xffff match ip protocol 0x6 0xff flowid 1:10 |
265 | | | # Teamspeak |
266 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 8767 0xffff match ip protocol 0x11 0xff flowid 1:10 |
267 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 8767 0xffff match ip protocol 0x11 0xff flowid 1:10 |
268 | 26 | simandl | # L2TP |
269 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 1701 0xffff match ip protocol 0x11 0xff flowid 1:10 |
270 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 1701 0xffff match ip protocol 0x11 0xff flowid 1:10 |
271 | 27 | simandl | # Americas Army |
272 | | | #UDP |
273 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 1716 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
274 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 1716 0xfffe match ip protocol 0x11 0xff flowid 1:10 |
275 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 1718 0xffff match ip protocol 0x11 0xff flowid 1:10 |
276 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 1718 0xffff match ip protocol 0x11 0xff flowid 1:10 |
277 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 8777 0xffff match ip protocol 0x11 0xff flowid 1:10 |
278 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 8777 0xffff match ip protocol 0x11 0xff flowid 1:10 |
279 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 27900 0xffff match ip protocol 0x11 0xff flowid 1:10 |
280 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 27900 0xffff match ip protocol 0x11 0xff flowid 1:10 |
281 | | | #TCP |
282 | | | #14200 |
283 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 14200 0xffff match ip protocol 0x6 0xff flowid 1:10 |
284 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 14200 0xffff match ip protocol 0x6 0xff flowid 1:10 |
285 | | | #20024 .. 20031 |
286 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 20024 0xfff8 match ip protocol 0x6 0xff flowid 1:10 |
287 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 20024 0xfff8 match ip protocol 0x6 0xff flowid 1:10 |
288 | | | #20032 .. 20047 |
289 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 20032 0xfff0 match ip protocol 0x6 0xff flowid 1:10 |
290 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 20032 0xfff0 match ip protocol 0x6 0xff flowid 1:10 |
291 | | | #20048 |
292 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 20048 0xffff match ip protocol 0x6 0xff flowid 1:10 |
293 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 20048 0xffff match ip protocol 0x6 0xff flowid 1:10 |
294 | | | |
295 | | | |
296 | | | |
297 | 2 | simandl | # TCP ACK packets smaller than 64 bytes |
298 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 \ |
299 | | | match ip protocol 6 0xff \ |
300 | | | match u8 0x05 0x0f at 0 \ |
301 | | | match u16 0x0000 0xffc0 at 2 \ |
302 | | | match u8 0x10 0xff at 33 \ |
303 | | | flowid 1:10 |
304 | | | |
305 | | | ## Ping class |
306 | | | # ICMP |
307 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip protocol 0x01 0xff flowid 1:20 |
308 | | | |
309 | | | ## Routing class |
310 | | | # BGP |
311 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 179 0xffff match ip protocol 0x6 0xff flowid 1:30 |
312 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 179 0xffff match ip protocol 0x6 0xff flowid 1:30 |
313 | | | # OSPF |
314 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip protocol 0x59 0xff flowid 1:30 |
315 | | | |
316 | 13 | simandl | ## Email & Data transfer class |
317 | 2 | simandl | # FTP |
318 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 20 0xfffe match ip protocol 0x6 0xff flowid 1:40 |
319 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 20 0xfffe match ip protocol 0x6 0xff flowid 1:40 |
320 | | | # PPTP |
321 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 1723 0xffff match ip protocol 0x6 0xff flowid 1:40 |
322 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 1723 0xffff match ip protocol 0x6 0xff flowid 1:40 |
323 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 1723 0xffff match ip protocol 0x11 0xff flowid 1:40 |
324 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 1723 0xffff match ip protocol 0x11 0xff flowid 1:40 |
325 | 4 | simandl | # OpenVPN |
326 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 5000 0xffff match ip protocol 0x11 0xff flowid 1:40 |
327 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 5000 0xffff match ip protocol 0x11 0xff flowid 1:40 |
328 | 2 | simandl | # SCP |
329 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 22 0xffff match ip protocol 0x6 0xff match ip tos 0x08 0xff flowid 1:40 |
330 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 22 0xffff match ip protocol 0x6 0xff match ip tos 0x08 0xff flowid 1:40 |
331 | | | # POP3 |
332 | 13 | simandl | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 110 0xffff match ip protocol 0x6 0xff flowid 1:40 |
333 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 110 0xffff match ip protocol 0x6 0xff flowid 1:40 |
334 | 2 | simandl | # IMAP |
335 | 13 | simandl | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 143 0xffff match ip protocol 0x6 0xff flowid 1:40 |
336 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 143 0xffff match ip protocol 0x6 0xff flowid 1:40 |
337 | 2 | simandl | # SMTP |
338 | 13 | simandl | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 25 0xffff match ip protocol 0x6 0xff flowid 1:40 |
339 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 25 0xffff match ip protocol 0x6 0xff flowid 1:40 |
340 | 2 | simandl | # POP3S |
341 | 13 | simandl | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 995 0xffff match ip protocol 0x6 0xff flowid 1:40 |
342 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 995 0xffff match ip protocol 0x6 0xff flowid 1:40 |
343 | 2 | simandl | # IMAPS |
344 | 13 | simandl | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 993 0xffff match ip protocol 0x6 0xff flowid 1:40 |
345 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 993 0xffff match ip protocol 0x6 0xff flowid 1:40 |
346 | 2 | simandl | # SSMTP |
347 | 13 | simandl | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 465 0xffff match ip protocol 0x6 0xff flowid 1:40 |
348 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 465 0xffff match ip protocol 0x6 0xff flowid 1:40 |
349 | 2 | simandl | # rsync |
350 | 13 | simandl | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 673 0xffff match ip protocol 0x6 0xff flowid 1:40 |
351 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 673 0xffff match ip protocol 0x6 0xff flowid 1:40 |
352 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 673 0xffff match ip protocol 0x11 0xff flowid 1:40 |
353 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 673 0xffff match ip protocol 0x11 0xff flowid 1:40 |
354 | 2 | simandl | # CVS |
355 | 13 | simandl | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 873 0xffff match ip protocol 0x6 0xff flowid 1:40 |
356 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 873 0xffff match ip protocol 0x6 0xff flowid 1:40 |
357 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 873 0xffff match ip protocol 0x11 0xff flowid 1:40 |
358 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 873 0xffff match ip protocol 0x11 0xff flowid 1:40 |
359 | 2 | simandl | |
360 | 13 | simandl | ## VOIP class |
361 | | | # VoIP typeofservice mark |
362 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip tos 0x68 0xff flowid 1:50 #SIP |
363 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip tos 0xb8 0xff flowid 1:50 #RTP |
364 | | | # VoIP typeofservice mark for RTP ha-vel.cz |
365 | 18 | simandl | #$TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip tos 0x16 0xff flowid 1:50 #RTP |
366 | 13 | simandl | # TOS mimimize delay - VoIP typeofservice mark for RTP vox.802.cz |
367 | 18 | simandl | #$TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip tos 0x10 0xff flowid 1:50 |
368 | | | # VoIP IP addr for RTP ha-vel.cz |
369 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip src 217.66.161.0/28 flowid 1:50 #RTP |
370 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dst 217.66.161.0/28 flowid 1:50 #RTP |
371 | | | # VoIP IP addr for RTP 802.cz |
372 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip src 212.71.146.178 flowid 1:50 #RTP rtp.802.cz |
373 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dst 212.71.146.178 flowid 1:50 #RTP rtp.802.cz |
374 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip src 212.71.146.184/31 flowid 1:50 # rtp[23].802.cz |
375 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dst 212.71.146.184/31 flowid 1:50 # rtp[23].802.cz |
376 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip src 212.71.146.163 flowid 1:50 #RTP rtp4.802.cz |
377 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dst 212.71.146.163 flowid 1:50 #RTP rtp4.802.cz |
378 | 13 | simandl | |
379 | | | ## Web & Squid class |
380 | | | # HTTP |
381 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 80 0xffff match ip protocol 0x6 0xff flowid 1:60 |
382 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 80 0xffff match ip protocol 0x6 0xff flowid 1:60 |
383 | | | # HTTPS |
384 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 443 0xffff match ip protocol 0x6 0xff flowid 1:60 |
385 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 443 0xffff match ip protocol 0x6 0xff flowid 1:60 |
386 | | | # WebCache |
387 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 8080 0xffff match ip protocol 0x6 0xff flowid 1:60 |
388 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 8080 0xffff match ip protocol 0x6 0xff flowid 1:60 |
389 | 2 | simandl | # HTTP port |
390 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 3128 0xffff match ip protocol 0x6 0xff flowid 1:60 |
391 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 3128 0xffff match ip protocol 0x6 0xff flowid 1:60 |
392 | | | # ICP port |
393 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 3130 0xffff match ip protocol 0x6 0xff flowid 1:60 |
394 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 3130 0xffff match ip protocol 0x6 0xff flowid 1:60 |
395 | | | |
396 | | | ## Unsupported class |
397 | | | # Kazaa |
398 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip sport 1214 0xffff match ip protocol 0x6 0xff flowid 1:666 |
399 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 2 u32 match ip dport 1214 0xffff match ip protocol 0x6 0xff flowid 1:666 |
400 | | | |
401 | | | # IP range of DHCP for airfree AP on this router |
402 | | | for ipaddr in $AIRFREE |
403 | | | do |
404 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 1 u32 match ip src $ipaddr flowid 1:667 |
405 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 1 u32 match ip dst $ipaddr flowid 1:667 |
406 | | | done |
407 | | | # non-CZF-RFC - violators of RFCs |
408 | | | for ipaddr in $NONCZF |
409 | | | do |
410 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 1 u32 match ip src $ipaddr flowid 1:666 |
411 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 1 u32 match ip dst $ipaddr flowid 1:666 |
412 | | | done |
413 | 25 | simandl | # non-contributors |
414 | | | for ipaddr in $NONCONTRIB |
415 | | | do |
416 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 1 u32 match ip src $ipaddr flowid 1:668 |
417 | | | $TC filter add dev ${FACE} parent 1:0 protocol ip prio 1 u32 match ip dst $ipaddr flowid 1:668 |
418 | | | done |
419 | 2 | simandl | |
420 | 4 | simandl | ## Internet class |
421 | 2 | simandl | # IPtables rule |
422 | | | # $IPTABLES -t mangle -A FORWARD -s ! 10.0.0.0/8 -o ${FACE} -j MARK --set-mark 999 |
423 | | | # $IPTABLES -t mangle -A FORWARD -d ! 10.0.0.0/8 -o ${FACE} -j MARK --set-mark 999 |
424 | | | # IPtables mark filter |
425 | | | # $TC filter add dev ${FACE} parent 1:0 protocol ip prio 1 handle 999 fw flowid 1:999 |
426 | | | } |
427 | | | |
428 | | | for FACE in $FACES |
429 | | | do |
430 | 4 | simandl | if [ -z "`$IP l | grep $FACE[:@]`" ] |
431 | | | then |
432 | | | echo "Interface $FACE doesn't exist" |
433 | | | continue |
434 | | | fi |
435 | 2 | simandl | TYPE=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*type[[:space:]]\+\([[:alpha:]]\+\).*}.*/\1/"` |
436 | | | if [ "$TYPE" != 'transit' ] |
437 | | | then |
438 | | | continue |
439 | | | fi |
440 | | | SPEED=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*speed[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"` |
441 | | | QUANTUM=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*quantum[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"` |
442 | | | |
443 | | | if [ -z "$QUANTUM" ] |
444 | | | then |
445 | 4 | simandl | MTU=`$IP l | grep $FACE[:@] | sed -e "s/^.*mtu[[:space:]]\+\([[:digit:]]\+\).*/\1/"` |
446 | 2 | simandl | QUANTUM=$(($QUANTUMOFFS+$MTU)) |
447 | | | fi |
448 | 15 | simandl | |
449 | | | NONCZFSPD=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*NONCZFSPD[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"` |
450 | | | if [ -z $NONCZFSPD ] ; then NONCZFSPD=$DNONCZFSPD ; fi |
451 | | | |
452 | | | AIRFREESPD=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*AIRFREESPD[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"` |
453 | | | if [ -z $AIRFREESPD ] ; then AIRFREESPD=$DAIRFREESPD ; fi |
454 | | | |
455 | 25 | simandl | NONCONTRIBSPD=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*NONCONTRIBSPD[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"` |
456 | | | if [ -z $NONCONTRIBSPD ] ; then NONCONTRIBSPD=$DNONCONTRIBSPD ; fi |
457 | | | |
458 | 15 | simandl | SSHDIV=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*SSHDIV[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"` |
459 | | | if [ -z $SSHDIV ] ; then SSHDIV=$DSSHDIV ; fi |
460 | | | |
461 | | | PINGDIV=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*PINGDIV[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"` |
462 | | | if [ -z $PINGDIV ] ; then PINGDIV=$DPINGDIV ; fi |
463 | | | |
464 | | | INTERACTDIV=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*INTERACTDIV[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"` |
465 | | | if [ -z $INTERACTDIV ] ; then INTERACTDIV=$DINTERACTDIV ; fi |
466 | | | |
467 | | | VOIPDIV=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*VOIPDIV[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"` |
468 | | | if [ -z $VOIPDIV ] ; then VOIPDIV=$DVOIPDIV ; fi |
469 | | | |
470 | | | WWWDIV=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*WWWDIV[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"` |
471 | | | if [ -z $WWWDIV ] ; then WWWDIV=$DWWWDIV ; fi |
472 | | | |
473 | | | XFERDIV=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*XFERDIV[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"` |
474 | | | if [ -z $XFERDIV ] ; then XFERDIV=$DXFERDIV ; fi |
475 | | | |
476 | | | DFLTDIV=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*DFLTDIV[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"` |
477 | | | if [ -z $DFLTDIV ] ; then DFLTDIV=$DDFLTDIV ; fi |
478 | | | |
479 | | | #echo $SPEED $NONCZFSPD $AIRFREESPD $SSHDIV $PINGDIV $INTERACTDIV $VOIPDIV $WWWDIV $XFERDIV $DFLTDIV |
480 | 2 | simandl | set_qos_classes |
481 | | | done |
482 | | | |
483 | | | exit 0 |