Jak skrócić skrypt sensowanie (stawiam czteropack)
|
kill649 |
Dodano 30-04-2008 23:32
|
User
Posty: 26
Dołączył: 19/06/2007 13:47
|
TCA="tc class add dev br0"
TFA="tc filter add dev br0"
TQA="tc qdisc add dev br0"
SFQ="sfq perturb 10"
tc qdisc del dev br0 root
tc qdisc add dev br0 root handle 1: htb
tc class add dev br0 parent 1: classid 1:1 htb rate 5530kbit
$TCA parent 1:1 classid 1:10 htb rate 393kbit ceil 5530kbit prio 2
$TCA parent 1:1 classid 1:11 htb rate 788kbit ceil 5530kbit prio 2
$TCA parent 1:1 classid 1:12 htb rate 393kbit ceil 5530kbit prio 2
$TCA parent 1:1 classid 1:13 htb rate 197kbit ceil 5530kbit prio 2
$TCA parent 1:1 classid 1:14 htb rate 197kbit ceil 5530kbit prio 2
$TCA parent 1:1 classid 1:15 htb rate 197kbit ceil 5530kbit prio 2
$TCA parent 1:1 classid 1:16 htb rate 197kbit ceil 5530kbit prio 2
$TCA parent 1:1 classid 1:17 htb rate 197kbit ceil 5530kbit prio 2
$TCA parent 1:1 classid 1:18 htb rate 197kbit ceil 5530kbit prio 2
$TCA parent 1:1 classid 1:19 htb rate 197kbit ceil 5530kbit prio 2
$TCA parent 1:1 classid 1:20 htb rate 197kbit ceil 5530kbit prio 2
$TCA parent 1:1 classid 1:21 htb rate 197kbit ceil 5530kbit prio 2
$TCA parent 1:1 classid 1:22 htb rate 197kbit ceil 5530kbit prio 2
$TCA parent 1:1 classid 1:23 htb rate 197kbit ceil 5530kbit prio 2
$TCA parent 1:1 classid 1:24 htb rate 197kbit ceil 5530kbit prio 2
$TCA parent 1:1 classid 1:25 htb rate 197kbit ceil 5530kbit prio 2
$TCA parent 1:1 classid 1:26 htb rate 197kbit ceil 5530kbit prio 2
$TCA parent 1:1 classid 1:27 htb rate 197kbit ceil 5530kbit prio 2
$TCA parent 1:1 classid 1:28 htb rate 197kbit ceil 5530kbit prio 2
$TCA parent 1:1 classid 1:29 htb rate 197kbit ceil 5530kbit prio 2
$TQA parent 1:10 handle 10: $SFQ
$TQA parent 1:11 handle 11: $SFQ
$TQA parent 1:12 handle 12: $SFQ
$TQA parent 1:13 handle 13: $SFQ
$TQA parent 1:14 handle 14: $SFQ
$TQA parent 1:15 handle 15: $SFQ
$TQA parent 1:16 handle 16: $SFQ
$TQA parent 1:17 handle 17: $SFQ
$TQA parent 1:18 handle 18: $SFQ
$TQA parent 1:19 handle 19: $SFQ
$TQA parent 1:20 handle 20: $SFQ
$TQA parent 1:21 handle 21: $SFQ
$TQA parent 1:22 handle 22: $SFQ
$TQA parent 1:23 handle 23: $SFQ
$TQA parent 1:24 handle 24: $SFQ
$TQA parent 1:25 handle 25: $SFQ
$TQA parent 1:26 handle 26: $SFQ
$TQA parent 1:27 handle 27: $SFQ
$TQA parent 1:28 handle 28: $SFQ
$TQA parent 1:29 handle 29: $SFQ
$TFA parent 1:0 prio 2 protocol ip handle 10 fw flowid 1:10
$TFA parent 1:0 prio 2 protocol ip handle 11 fw flowid 1:11
$TFA parent 1:0 prio 2 protocol ip handle 12 fw flowid 1:12
$TFA parent 1:0 prio 2 protocol ip handle 13 fw flowid 1:13
$TFA parent 1:0 prio 2 protocol ip handle 14 fw flowid 1:14
$TFA parent 1:0 prio 2 protocol ip handle 15 fw flowid 1:15
$TFA parent 1:0 prio 2 protocol ip handle 16 fw flowid 1:16
$TFA parent 1:0 prio 2 protocol ip handle 17 fw flowid 1:17
$TFA parent 1:0 prio 2 protocol ip handle 18 fw flowid 1:18
$TFA parent 1:0 prio 2 protocol ip handle 19 fw flowid 1:19
$TFA parent 1:0 prio 2 protocol ip handle 20 fw flowid 1:20
$TFA parent 1:0 prio 2 protocol ip handle 21 fw flowid 1:21
$TFA parent 1:0 prio 2 protocol ip handle 22 fw flowid 1:22
$TFA parent 1:0 prio 2 protocol ip handle 23 fw flowid 1:23
$TFA parent 1:0 prio 2 protocol ip handle 24 fw flowid 1:24
$TFA parent 1:0 prio 2 protocol ip handle 25 fw flowid 1:25
$TFA parent 1:0 prio 2 protocol ip handle 26 fw flowid 1:26
$TFA parent 1:0 prio 2 protocol ip handle 27 fw flowid 1:27
$TFA parent 1:0 prio 2 protocol ip handle 28 fw flowid 1:28
$TFA parent 1:0 prio 2 protocol ip handle 29 fw flowid 1:29
iptables -t mangle -A POSTROUTING -d 172.28.10.10 -j MARK --set-mark 10
iptables -t mangle -A POSTROUTING -d 172.28.10.11 -j MARK --set-mark 11
iptables -t mangle -A POSTROUTING -d 172.28.10.12 -j MARK --set-mark 12
iptables -t mangle -A POSTROUTING -d 172.28.10.18 -j MARK --set-mark 13
iptables -t mangle -A POSTROUTING -d 172.28.10.30 -j MARK --set-mark 14
iptables -t mangle -A POSTROUTING -d 172.28.10.31 -j MARK --set-mark 15
iptables -t mangle -A POSTROUTING -d 172.28.10.32 -j MARK --set-mark 16
iptables -t mangle -A POSTROUTING -d 172.28.10.33 -j MARK --set-mark 17
iptables -t mangle -A POSTROUTING -d 172.28.10.34 -j MARK --set-mark 18
iptables -t mangle -A POSTROUTING -d 172.28.10.35 -j MARK --set-mark 19
iptables -t mangle -A POSTROUTING -d 172.28.10.36 -j MARK --set-mark 20
iptables -t mangle -A POSTROUTING -d 172.28.10.37 -j MARK --set-mark 21
iptables -t mangle -A POSTROUTING -d 172.28.10.38 -j MARK --set-mark 22
iptables -t mangle -A POSTROUTING -d 172.28.10.39 -j MARK --set-mark 23
iptables -t mangle -A POSTROUTING -d 172.28.10.40 -j MARK --set-mark 24
iptables -t mangle -A POSTROUTING -d 172.28.10.41 -j MARK --set-mark 25
iptables -t mangle -A POSTROUTING -d 172.28.10.42 -j MARK --set-mark 26
iptables -t mangle -A POSTROUTING -d 172.28.10.43 -j MARK --set-mark 27
iptables -t mangle -A POSTROUTING -d 172.28.10.44 -j MARK --set-mark 28
iptables -t mangle -A POSTROUTING -d 172.28.10.45 -j MARK --set-mark 29
TCAU="tc class add dev imq0"
TFAU="tc filter add dev imq0"
TQAU="tc qdisc add dev imq0"
modprobe imq
modprobe ipt_IMQ
ip link set imq0 up
tc qdisc del dev imq0 root
tc qdisc add dev imq0 root handle 1: htb
tc class add dev imq0 parent 1: classid 1:1 htb rate 461kbit
$TCAU parent 1:1 classid 1:10 htb rate 32kbit ceil 461kbit prio 2
$TCAU parent 1:1 classid 1:11 htb rate 64kbit ceil 461kbit prio 2
$TCAU parent 1:1 classid 1:12 htb rate 32kbit ceil 461kbit prio 2
$TCAU parent 1:1 classid 1:13 htb rate 64kbit ceil 461kbit prio 2
$TCAU parent 1:1 classid 1:14 htb rate 16kbit ceil 461kbit prio 2
$TCAU parent 1:1 classid 1:15 htb rate 16kbit ceil 461kbit prio 2
$TCAU parent 1:1 classid 1:16 htb rate 16kbit ceil 461kbit prio 2
$TCAU parent 1:1 classid 1:17 htb rate 16kbit ceil 461kbit prio 2
$TCAU parent 1:1 classid 1:18 htb rate 16kbit ceil 461kbit prio 2
$TCAU parent 1:1 classid 1:19 htb rate 16kbit ceil 461kbit prio 2
$TCAU parent 1:1 classid 1:20 htb rate 16kbit ceil 461kbit prio 2
$TCAU parent 1:1 classid 1:21 htb rate 16kbit ceil 461kbit prio 2
$TCAU parent 1:1 classid 1:22 htb rate 16kbit ceil 461kbit prio 2
$TCAU parent 1:1 classid 1:23 htb rate 16kbit ceil 461kbit prio 2
$TCAU parent 1:1 classid 1:24 htb rate 16kbit ceil 461kbit prio 2
$TCAU parent 1:1 classid 1:25 htb rate 16kbit ceil 461kbit prio 2
$TCAU parent 1:1 classid 1:26 htb rate 16kbit ceil 461kbit prio 2
$TCAU parent 1:1 classid 1:27 htb rate 16kbit ceil 461kbit prio 2
$TCAU parent 1:1 classid 1:28 htb rate 16kbit ceil 461kbit prio 2
$TCAU parent 1:1 classid 1:29 htb rate 16kbit ceil 461kbit prio 2
$TQAU parent 1:10 handle 10: $SFQ
$TQAU parent 1:11 handle 11: $SFQ
$TQAU parent 1:12 handle 12: $SFQ
$TQAU parent 1:13 handle 13: $SFQ
$TQAU parent 1:14 handle 14: $SFQ
$TQAU parent 1:15 handle 15: $SFQ
$TQAU parent 1:16 handle 16: $SFQ
$TQAU parent 1:17 handle 17: $SFQ
$TQAU parent 1:18 handle 18: $SFQ
$TQAU parent 1:19 handle 19: $SFQ
$TQAU parent 1:20 handle 20: $SFQ
$TQAU parent 1:21 handle 21: $SFQ
$TQAU parent 1:22 handle 22: $SFQ
$TQAU parent 1:23 handle 23: $SFQ
$TQAU parent 1:24 handle 24: $SFQ
$TQAU parent 1:25 handle 25: $SFQ
$TQAU parent 1:26 handle 26: $SFQ
$TQAU parent 1:27 handle 27: $SFQ
$TQAU parent 1:28 handle 28: $SFQ
$TQAU parent 1:29 handle 29: $SFQ
$TFAU parent 1:0 prio 2 protocol ip handle 10 fw flowid 1:10
$TFAU parent 1:0 prio 2 protocol ip handle 11 fw flowid 1:11
$TFAU parent 1:0 prio 2 protocol ip handle 12 fw flowid 1:12
$TFAU parent 1:0 prio 2 protocol ip handle 13 fw flowid 1:13
$TFAU parent 1:0 prio 2 protocol ip handle 14 fw flowid 1:14
$TFAU parent 1:0 prio 2 protocol ip handle 15 fw flowid 1:15
$TFAU parent 1:0 prio 2 protocol ip handle 16 fw flowid 1:16
$TFAU parent 1:0 prio 2 protocol ip handle 17 fw flowid 1:17
$TFAU parent 1:0 prio 2 protocol ip handle 18 fw flowid 1:18
$TFAU parent 1:0 prio 2 protocol ip handle 19 fw flowid 1:19
$TFAU parent 1:0 prio 2 protocol ip handle 20 fw flowid 1:20
$TFAU parent 1:0 prio 2 protocol ip handle 21 fw flowid 1:21
$TFAU parent 1:0 prio 2 protocol ip handle 22 fw flowid 1:22
$TFAU parent 1:0 prio 2 protocol ip handle 23 fw flowid 1:23
$TFAU parent 1:0 prio 2 protocol ip handle 24 fw flowid 1:24
$TFAU parent 1:0 prio 2 protocol ip handle 25 fw flowid 1:25
$TFAU parent 1:0 prio 2 protocol ip handle 26 fw flowid 1:26
$TFAU parent 1:0 prio 2 protocol ip handle 27 fw flowid 1:27
$TFAU parent 1:0 prio 2 protocol ip handle 28 fw flowid 1:28
$TFAU parent 1:0 prio 2 protocol ip handle 29 fw flowid 1:29
iptables -t mangle -A PREROUTING -s 172.28.10.10 -j MARK --set-mark 10
iptables -t mangle -A PREROUTING -s 172.28.10.11 -j MARK --set-mark 11
iptables -t mangle -A PREROUTING -s 172.28.10.12 -j MARK --set-mark 12
iptables -t mangle -A PREROUTING -s 172.28.10.18 -j MARK --set-mark 13
iptables -t mangle -A PREROUTING -s 172.28.10.30 -j MARK --set-mark 14
iptables -t mangle -A PREROUTING -s 172.28.10.31 -j MARK --set-mark 15
iptables -t mangle -A PREROUTING -s 172.28.10.32 -j MARK --set-mark 16
iptables -t mangle -A PREROUTING -s 172.28.10.33 -j MARK --set-mark 17
iptables -t mangle -A PREROUTING -s 172.28.10.34 -j MARK --set-mark 18
iptables -t mangle -A PREROUTING -s 172.28.10.35 -j MARK --set-mark 19
iptables -t mangle -A PREROUTING -s 172.28.10.36 -j MARK --set-mark 20
iptables -t mangle -A PREROUTING -s 172.28.10.37 -j MARK --set-mark 21
iptables -t mangle -A PREROUTING -s 172.28.10.38 -j MARK --set-mark 22
iptables -t mangle -A PREROUTING -s 172.28.10.39 -j MARK --set-mark 23
iptables -t mangle -A PREROUTING -s 172.28.10.40 -j MARK --set-mark 24
iptables -t mangle -A PREROUTING -s 172.28.10.41 -j MARK --set-mark 25
iptables -t mangle -A PREROUTING -s 172.28.10.42 -j MARK --set-mark 26
iptables -t mangle -A PREROUTING -s 172.28.10.43 -j MARK --set-mark 27
iptables -t mangle -A PREROUTING -s 172.28.10.44 -j MARK --set-mark 28
iptables -t mangle -A PREROUTING -s 172.28.10.45 -j MARK --set-mark 29
iptables -t mangle -A PREROUTING -j IMQ --todev 0
Kombinuje i kombinuje ale mam wrażenie że moje kombinacje nie przynoszą skutku.
Najlepiej by było wpisy o poszczególnych adresach wpisać w jakieś 4 reguły (grupy) a nie każdy adres osobno (proszę zauważyć że z końcówką 10,11,12,18 maja inne wartości niż reszta adresów jeżeli chodzi o prędkość gwarantowana)
no i oczywiście takie dwa wpisy na sam koniec też chciałem dorzucić ale nie wiem czy są dobrze ułożone.
modprobe ipt_length
iptables -I FORWARD -p udp -m length --length 1501: -j DROP
iptables -I FORWARD -m iprange --src-range 172.28.10.140-172.28.10.200 -p tcp -m connlimit --connlimit-above 150 -j DROP
Proszę jakąś dobra dusze o rade, pomoc i podziękuje jakimś zimnym piwkiem (czteropack ;-) ) lub finansami na niego bo mi coś z długim weekedem myślenie chyba wyłączyło a tak w ciągu roku nie mam czasu tym sie już zająć.
OT: Czy wpisy blokujące netbios,ewentualne wirusy itp. maja sens w tomato? |
|
|
|
arteq |
Dodano 30-04-2008 23:50
|
VIP
Posty: 1918
Dołączył: 04/03/2006 17:42
|
IMO trzeba zastosowac petle "for"
Pozdrawiam, Artur
http://digi-led.pl Elementy elektroniczne | urz?dzenia sieciowe | us?ugi informatyczne
http://openwrt.pl - Polskie Centrum OpenWrt
o p e n (your) r o u t e r . p l
|
|
|
|
kill649 |
Dodano 01-05-2008 09:11
|
User
Posty: 26
Dołączył: 19/06/2007 13:47
|
Ok to już doczytałem i chyba zdecydowanie więcej o Iptables ale jak zrobić na przykład ten skrypt tak żeby działał z pomidorem. Bo zauważyłem że nie każda reguła z iptables działa w pomidorku. |
|
|
|
oZmO |
Dodano 02-05-2008 15:11
|
User
Posty: 12
Dołączył: 02/03/2008 18:34
|
TCA="tc class add dev br0"
TFA="tc filter add dev br0"
TQA="tc qdisc add dev br0"
SFQ="sfq perturb 10"
PPP="parent 1:0 prio 2 protocol ip handle"
IPT="iptables -t mangle -A POSTROUTING -d"
IPD="iptables -t mangle -A PREROUTING -s"
PCL="parent 1:1 classid"
tc qdisc del dev br0 root
tc qdisc add dev br0 root handle 1: htb
tc class add dev br0 parent 1: classid 1:1 htb rate 5530kbit
$TCA $PCL 1:10 htb rate 393kbit ceil 5530kbit prio 2
$TCA $PCL 1:11 htb rate 788kbit ceil 5530kbit prio 2
$TCA $PCL 1:12 htb rate 393kbit ceil 5530kbit prio 2
$TCA $PCL 1:13 htb rate 197kbit ceil 5530kbit prio 2
$TCA $PCL 1:14 htb rate 197kbit ceil 5530kbit prio 2
$TCA $PCL 1:15 htb rate 197kbit ceil 5530kbit prio 2
$TCA $PCL 1:16 htb rate 197kbit ceil 5530kbit prio 2
$TCA $PCL 1:17 htb rate 197kbit ceil 5530kbit prio 2
$TCA $PCL 1:18 htb rate 197kbit ceil 5530kbit prio 2
$TCA $PCL 1:19 htb rate 197kbit ceil 5530kbit prio 2
$TCA $PCL 1:20 htb rate 197kbit ceil 5530kbit prio 2
$TCA $PCL 1:21 htb rate 197kbit ceil 5530kbit prio 2
$TCA $PCL 1:22 htb rate 197kbit ceil 5530kbit prio 2
$TCA $PCL 1:23 htb rate 197kbit ceil 5530kbit prio 2
$TCA $PCL 1:24 htb rate 197kbit ceil 5530kbit prio 2
$TCA $PCL 1:25 htb rate 197kbit ceil 5530kbit prio 2
$TCA $PCL 1:26 htb rate 197kbit ceil 5530kbit prio 2
$TCA $PCL 1:27 htb rate 197kbit ceil 5530kbit prio 2
$TCA $PCL 1:28 htb rate 197kbit ceil 5530kbit prio 2
$TCA $PCL 1:29 htb rate 197kbit ceil 5530kbit prio 2
$TQA parent 1:10 handle 10: $SFQ
$TQA parent 1:11 handle 11: $SFQ
$TQA parent 1:12 handle 12: $SFQ
$TQA parent 1:13 handle 13: $SFQ
$TQA parent 1:14 handle 14: $SFQ
$TQA parent 1:15 handle 15: $SFQ
$TQA parent 1:16 handle 16: $SFQ
$TQA parent 1:17 handle 17: $SFQ
$TQA parent 1:18 handle 18: $SFQ
$TQA parent 1:19 handle 19: $SFQ
$TQA parent 1:20 handle 20: $SFQ
$TQA parent 1:21 handle 21: $SFQ
$TQA parent 1:22 handle 22: $SFQ
$TQA parent 1:23 handle 23: $SFQ
$TQA parent 1:24 handle 24: $SFQ
$TQA parent 1:25 handle 25: $SFQ
$TQA parent 1:26 handle 26: $SFQ
$TQA parent 1:27 handle 27: $SFQ
$TQA parent 1:28 handle 28: $SFQ
$TQA parent 1:29 handle 29: $SFQ
$TFA $PPP 10 fw flowid 1:10
$TFA $PPP 11 fw flowid 1:11
$TFA $PPP 12 fw flowid 1:12
$TFA $PPP 13 fw flowid 1:13
$TFA $PPP 14 fw flowid 1:14
$TFA $PPP 15 fw flowid 1:15
$TFA $PPP 16 fw flowid 1:16
$TFA $PPP 17 fw flowid 1:17
$TFA $PPP 18 fw flowid 1:18
$TFA $PPP 19 fw flowid 1:19
$TFA $PPP 20 fw flowid 1:20
$TFA $PPP 21 fw flowid 1:21
$TFA $PPP 22 fw flowid 1:22
$TFA $PPP 23 fw flowid 1:23
$TFA $PPP 24 fw flowid 1:24
$TFA $PPP 25 fw flowid 1:25
$TFA $PPP 26 fw flowid 1:26
$TFA $PPP 27 fw flowid 1:27
$TFA $PPP 28 fw flowid 1:28
$TFA $PPP 29 fw flowid 1:29
$IPT 172.28.10.10 -j MARK --set-mark 10
$IPT 172.28.10.11 -j MARK --set-mark 11
$IPT 172.28.10.12 -j MARK --set-mark 12
$IPT 172.28.10.18 -j MARK --set-mark 13
$IPT 172.28.10.30 -j MARK --set-mark 14
$IPT 172.28.10.31 -j MARK --set-mark 15
$IPT 172.28.10.32 -j MARK --set-mark 16
$IPT 172.28.10.33 -j MARK --set-mark 17
$IPT 172.28.10.34 -j MARK --set-mark 18
$IPT 172.28.10.35 -j MARK --set-mark 19
$IPT 172.28.10.36 -j MARK --set-mark 20
$IPT 172.28.10.37 -j MARK --set-mark 21
$IPT 172.28.10.38 -j MARK --set-mark 22
$IPT 172.28.10.39 -j MARK --set-mark 23
$IPT 172.28.10.40 -j MARK --set-mark 24
$IPT 172.28.10.41 -j MARK --set-mark 25
$IPT 172.28.10.42 -j MARK --set-mark 26
$IPT 172.28.10.43 -j MARK --set-mark 27
$IPT 172.28.10.44 -j MARK --set-mark 28
$IPT 172.28.10.45 -j MARK --set-mark 29
TCAU="tc class add dev imq0"
TFAU="tc filter add dev imq0"
TQAU="tc qdisc add dev imq0"
modprobe imq
modprobe ipt_IMQ
ip link set imq0 up
tc qdisc del dev imq0 root
tc qdisc add dev imq0 root handle 1: htb
tc class add dev imq0 parent 1: classid 1:1 htb rate 461kbit
$TCAU $PCL 1:10 htb rate 32kbit ceil 461kbit prio 2
$TCAU $PCL 1:11 htb rate 64kbit ceil 461kbit prio 2
$TCAU $PCL 1:12 htb rate 32kbit ceil 461kbit prio 2
$TCAU $PCL 1:13 htb rate 64kbit ceil 461kbit prio 2
$TCAU $PCL 1:14 htb rate 16kbit ceil 461kbit prio 2
$TCAU $PCL 1:15 htb rate 16kbit ceil 461kbit prio 2
$TCAU $PCL 1:16 htb rate 16kbit ceil 461kbit prio 2
$TCAU $PCL 1:17 htb rate 16kbit ceil 461kbit prio 2
$TCAU $PCL 1:18 htb rate 16kbit ceil 461kbit prio 2
$TCAU $PCL 1:19 htb rate 16kbit ceil 461kbit prio 2
$TCAU $PCL 1:20 htb rate 16kbit ceil 461kbit prio 2
$TCAU $PCL 1:21 htb rate 16kbit ceil 461kbit prio 2
$TCAU $PCL 1:22 htb rate 16kbit ceil 461kbit prio 2
$TCAU $PCL 1:23 htb rate 16kbit ceil 461kbit prio 2
$TCAU $PCL 1:24 htb rate 16kbit ceil 461kbit prio 2
$TCAU $PCL 1:25 htb rate 16kbit ceil 461kbit prio 2
$TCAU $PCL 1:26 htb rate 16kbit ceil 461kbit prio 2
$TCAU $PCL 1:27 htb rate 16kbit ceil 461kbit prio 2
$TCAU $PCL 1:28 htb rate 16kbit ceil 461kbit prio 2
$TCAU $PCL 1:29 htb rate 16kbit ceil 461kbit prio 2
$TQAU parent 1:10 handle 10: $SFQ
$TQAU parent 1:11 handle 11: $SFQ
$TQAU parent 1:12 handle 12: $SFQ
$TQAU parent 1:13 handle 13: $SFQ
$TQAU parent 1:14 handle 14: $SFQ
$TQAU parent 1:15 handle 15: $SFQ
$TQAU parent 1:16 handle 16: $SFQ
$TQAU parent 1:17 handle 17: $SFQ
$TQAU parent 1:18 handle 18: $SFQ
$TQAU parent 1:19 handle 19: $SFQ
$TQAU parent 1:20 handle 20: $SFQ
$TQAU parent 1:21 handle 21: $SFQ
$TQAU parent 1:22 handle 22: $SFQ
$TQAU parent 1:23 handle 23: $SFQ
$TQAU parent 1:24 handle 24: $SFQ
$TQAU parent 1:25 handle 25: $SFQ
$TQAU parent 1:26 handle 26: $SFQ
$TQAU parent 1:27 handle 27: $SFQ
$TQAU parent 1:28 handle 28: $SFQ
$TQAU parent 1:29 handle 29: $SFQ
$TFAU $PPP 10 fw flowid 1:10
$TFAU $PPP 11 fw flowid 1:11
$TFAU $PPP 12 fw flowid 1:12
$TFAU $PPP 13 fw flowid 1:13
$TFAU $PPP 14 fw flowid 1:14
$TFAU $PPP 15 fw flowid 1:15
$TFAU $PPP 16 fw flowid 1:16
$TFAU $PPP 17 fw flowid 1:17
$TFAU $PPP 18 fw flowid 1:18
$TFAU $PPP 19 fw flowid 1:19
$TFAU $PPP 20 fw flowid 1:20
$TFAU $PPP 21 fw flowid 1:21
$TFAU $PPP 22 fw flowid 1:22
$TFAU $PPP 23 fw flowid 1:23
$TFAU $PPP 24 fw flowid 1:24
$TFAU $PPP 25 fw flowid 1:25
$TFAU $PPP 26 fw flowid 1:26
$TFAU $PPP 27 fw flowid 1:27
$TFAU $PPP 28 fw flowid 1:28
$TFAU $PPP 29 fw flowid 1:29
$IPD 172.28.10.10 -j MARK --set-mark 10
$IPD 172.28.10.11 -j MARK --set-mark 11
$IPD 172.28.10.12 -j MARK --set-mark 12
$IPD 172.28.10.18 -j MARK --set-mark 13
$IPD 172.28.10.30 -j MARK --set-mark 14
$IPD 172.28.10.31 -j MARK --set-mark 15
$IPD 172.28.10.32 -j MARK --set-mark 16
$IPD 172.28.10.33 -j MARK --set-mark 17
$IPD 172.28.10.34 -j MARK --set-mark 18
$IPD 172.28.10.35 -j MARK --set-mark 19
$IPD 172.28.10.36 -j MARK --set-mark 20
$IPD 172.28.10.37 -j MARK --set-mark 21
$IPD 172.28.10.38 -j MARK --set-mark 22
$IPD 172.28.10.39 -j MARK --set-mark 23
$IPD 172.28.10.40 -j MARK --set-mark 24
$IPD 172.28.10.41 -j MARK --set-mark 25
$IPD 172.28.10.42 -j MARK --set-mark 26
$IPD 172.28.10.43 -j MARK --set-mark 27
$IPD 172.28.10.44 -j MARK --set-mark 28
$IPD 172.28.10.45 -j MARK --set-mark 29
iptables -t mangle -A PREROUTING -j IMQ --todev 0
moze tak sie zmiesci |
|
|
|
kill649 |
Dodano 03-05-2008 10:13
|
User
Posty: 26
Dołączył: 19/06/2007 13:47
|
No zmieściło sie i jeszcze miejsca jest :-) a co lepsze działa.
Ale z tym to mnie nawet troszke zaskoczyles :-) nawet mi to przez głowe nie przeszło zeby tak się zabrać do tego.
IPT="iptables -t mangle -A POSTROUTING -d"
IPD="iptables -t mangle -A PREROUTING -s"
Podrzuć mi na priv (o ile jest) jakiś namiar do siebie lub na maila poczta at maksymilian dot com, zasłużyłeś na patrz temat. |
|
|
|
NeoX |
Dodano 03-05-2008 10:40
|
Power User
Posty: 318
Dołączył: 15/11/2006 13:44
|
Ten skrypt można jeszcze duuuużo bardziej skrócić:
Pętla for x in seq 10 29 i tam umieścić wszystkie powtarzające się wpisy różniące się cyferkami
Do tego można ten trick powtórzyć i zrobić to samo ale dla adresów IP |
|
|
|
lyzwak |
Dodano 31-08-2008 20:20
|
User
Posty: 2
Dołączył: 27/01/2008 09:48
|
Co sądzicie o takim skrypcie? Czy to będzie działać?
TCA="tc class add dev br0"
TFA="tc filter add dev br0"
TQA="tc qdisc add dev br0"
SFQ="sfq perturb 10"
tc qdisc del dev br0 root
tc qdisc add dev br0 root handle 1: htb
tc class add dev br0 parent 1: classid 1:1 htb rate 900kbit
IP="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 50"
for x in $IP
do
$IPT $TCA parent 1:1 classid 1:$x htb rate 25kbit ceil 900kbit prio 2
$IPT $TQA parent 1:$x handle $x: $SFQ
$IPT $TFA parent 1:0 prio 2 protocol ip handle $x fw flowid 1:$x
$IPT iptables -t mangle -A POSTROUTING -d 192.168.1.$x -j MARK --set-mark $x
TCAU="tc class add dev imq0"
TFAU="tc filter add dev imq0"
TQAU="tc qdisc add dev imq0"
modprobe imq
modprobe ipt_IMQ
ip link set imq0 up
tc qdisc del dev imq0 root
tc qdisc add dev imq0 root handle 1: htb
tc class add dev imq0 parent 1: classid 1:1 htb rate 230kbit
$IPT $TCAU parent 1:1 classid 1:$x htb rate 6kbit ceil 230kbit prio 2
$IPT $TQAU parent 1:$x handle $x: $SFQ
$IPT $TFAU parent 1:0 prio 2 protocol ip handle $x fw flowid 1:$x
$IPT iptables -t mangle -A PREROUTING -s 192.168.1.$x -j MARK --set-mark $x
iptables -t mangle -A PREROUTING -j IMQ --todev 0
$IPT iptables -I FORWARD -s 192.168.1.$x -p tcp -m connlimit --connlimit-above 50 -j DROP
$IPT iptables -I FORWARD -s 192.168.1.$x -p udp -m limit --limit 7/sec -j DROP
done
|
|
|