Pessoal pesquisando consegui montar esse script pra um provedor wireless, mas esta acontecendo que quando coloco ele pra funcionar alguns clintes para de navegar, pinga a rede, pinga o site mas não navega são poucos dos 280 clientes mas para e não consigo descobrir por que...
Deem uma olhada pra ver se as qdisc class e filters estão corretas... podem ver que esta controlando down e up...
E mais uma duvida tem um link de 6 megas, o htb divide os 6 megas pra cada cliente tipo 280 clientes vai ficar 21,42 Kbits pra cada um ou quando o cliente precisar ele manda??
desde ja agradeço...
+ ID=1
+ ifconfig ifb0 down
+ sleep 2
+ ifconfig ifb0 up
+ echo 'Gerando Novo Controle de Banda...'
Gerando Novo Controle de Banda...
+ CONF=/opt/controle/mac.conf
+ TEMP=/tmp/mac.conf.tmp
+ TEMP_CLIENT=/tmp/mac.conf.client.tmp
+ cat /opt/controle/mac.conf
+ grep -v '[#/]'
++ wc -l /tmp/mac.conf.tmp
++ cut -d/ -f1
+ QUANT='10 '
+ CLIENT=2
+ down=eth1
+ up=ifb0
+ tc qdisc del dev eth1 root
+ tc qdisc del dev eth1 ingress
+ tc qdisc del dev ifb0 root
+ tc qdisc add dev eth1 root handle 1 htb default 0 r2q 100
+ tc qdisc add dev eth1 handle ffff ingress
+ tc class add dev eth1 parent 1:0 classid 1:2 htb rate 6Mbit ceil 6Mbit burst 6k quantum 2536
+ tc filter add dev eth1 parent 1:2 protocol ip prio 1 u32 match ip protocol 0x6 0xff match ip tos 0x10 0xff flowid 1:
+ tc qdisc add dev ifb0 root handle 1 htb default 0 r2q 100
+ tc filter add dev eth1 parent ffff: protocol ip prio 10 u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev ifb0
Action 4 device ifb0 ifindex 4
+ '[' 2 -le 10 ']'
+ head -n2 /tmp/mac.conf.tmp
+ tail -n2
++ head -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f4
++ cut '-d;' -f1
+ HOST=Teste-de-Banda
++ head -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f4
++ cut '-d;' -f4
+ HTB=NOHTB
++ head -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f2
+ NUM=000
++ tail -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f1
+ IP=192.168.30.2
++ tail -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f6
+ BANDA=32
+ PESO=3
++ tail -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f8
+ BAND_MIN=16
+ PESO_MIN=1
++ tail -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f7
+ IFACE=eth1
+ '[' 1 -le 9 ']'
+ '[' -x NOHTB ']'
+ '[' 1 -gt 9 ']'
+ '[' 1 -gt 99 ']'
+ echo '+++++ Teste-de-Banda Sem HTB.+++++'
+++++ Teste-de-Banda Sem HTB.+++++
+ let CLIENT+=2
+ let ID++
+ '[' 4 -le 10 ']'
+ head -n4 /tmp/mac.conf.tmp
+ tail -n2
++ head -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f4
++ cut '-d;' -f1
+ HOST=Teste-de-Banda2
++ head -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f4
++ cut '-d;' -f4
+ HTB=
++ head -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f2
+ NUM=000
++ tail -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f1
+ IP=192.168.30.3
++ tail -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f6
+ BANDA=32
+ PESO=3
++ tail -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f8
+ BAND_MIN=16
+ PESO_MIN=1
++ tail -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f7
+ IFACE=eth1
+ '[' 2 -le 9 ']'
+ '[' -x ']'
+ (( count++ ))
+ tc class add dev eth1 parent 1:1 classid 1:1 htb rate 32Kbit ceil 32Kbit prio 5 burst 1k
+ tc qdisc add dev eth1 parent 1:1 handle 1 sfq perturb 10
RTNETLINK answers: File exists
+ tc filter add dev eth1 parent 1:1 protocol ip prio 10 u32 match ip dst 192.168.30.3 flowid 1:1
+ tc class add dev ifb0 parent 1:1 classid 1:1 htb rate 16Kbit prio 5 burst 1k
+ tc qdisc add dev ifb0 parent 1:1 handle 1 sfq perturb 10
RTNETLINK answers: File exists
+ tc filter add dev ifb0 parent 1:1 protocol ip prio 10 u32 match ip src 192.168.30.3 flowid 1:1
+ echo 'Teste-de-Banda2 32 kbps X 16 kbps'
Teste-de-Banda2 32 kbps X 16 kbps
+ let CLIENT+=2
+ let ID++
+ '[' 6 -le 10 ']'
+ head -n6 /tmp/mac.conf.tmp
+ tail -n2
++ head -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f4
++ cut '-d;' -f1
+ HOST=Teste-de-Banda3
++ head -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f4
++ cut '-d;' -f4
+ HTB=
++ head -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f2
+ NUM=000
++ tail -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f1
+ IP=192.168.30.4
++ tail -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f6
+ BANDA=32
+ PESO=3
++ tail -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f8
+ BAND_MIN=16
+ PESO_MIN=1
++ tail -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f7
+ IFACE=eth1
+ '[' 3 -le 9 ']'
+ '[' -x ']'
+ (( count++ ))
+ tc class add dev eth1 parent 1:1 classid 1:2 htb rate 32Kbit ceil 32Kbit prio 5 burst 1k
RTNETLINK answers: File exists
+ tc qdisc add dev eth1 parent 1:1 handle 2 sfq perturb 10
+ tc filter add dev eth1 parent 1:1 protocol ip prio 10 u32 match ip dst 192.168.30.4 flowid 1:2
+ tc class add dev ifb0 parent 1:1 classid 1:2 htb rate 16Kbit prio 5 burst 1k
+ tc qdisc add dev ifb0 parent 1:1 handle 2 sfq perturb 10
RTNETLINK answers: No such file or directory
+ tc filter add dev ifb0 parent 1:1 protocol ip prio 10 u32 match ip src 192.168.30.4 flowid 1:2
+ echo 'Teste-de-Banda3 32 kbps X 16 kbps'
Teste-de-Banda3 32 kbps X 16 kbps
+ let CLIENT+=2
+ let ID++
+ '[' 8 -le 10 ']'
+ head -n8 /tmp/mac.conf.tmp
+ tail -n2
++ head -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f4
++ cut '-d;' -f1
+ HOST=Teste-de-Banda4
++ head -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f4
++ cut '-d;' -f4
+ HTB=
++ head -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f2
+ NUM=000
++ tail -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f1
+ IP=192.168.30.5
++ tail -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f6
+ BANDA=32
+ PESO=3
++ tail -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f8
+ BAND_MIN=16
+ PESO_MIN=1
++ tail -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f7
+ IFACE=eth1
+ '[' 4 -le 9 ']'
+ '[' -x ']'
+ (( count++ ))
+ tc class add dev eth1 parent 1:1 classid 1:3 htb rate 32Kbit ceil 32Kbit prio 5 burst 1k
+ tc qdisc add dev eth1 parent 1:1 handle 3 sfq perturb 10
RTNETLINK answers: No such file or directory
+ tc filter add dev eth1 parent 1:1 protocol ip prio 10 u32 match ip dst 192.168.30.5 flowid 1:3
+ tc class add dev ifb0 parent 1:1 classid 1:3 htb rate 16Kbit prio 5 burst 1k
+ tc qdisc add dev ifb0 parent 1:1 handle 3 sfq perturb 10
RTNETLINK answers: No such file or directory
+ tc filter add dev ifb0 parent 1:1 protocol ip prio 10 u32 match ip src 192.168.30.5 flowid 1:3
+ echo 'Teste-de-Banda4 32 kbps X 16 kbps'
Teste-de-Banda4 32 kbps X 16 kbps
+ let CLIENT+=2
+ let ID++
+ '[' 10 -le 10 ']'
+ head -n10 /tmp/mac.conf.tmp
+ tail -n2
++ head -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f4
++ cut '-d;' -f1
+ HOST=Teste-de-Banda5
++ head -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f4
++ cut '-d;' -f4
+ HTB=
++ head -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f2
+ NUM=000
++ tail -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f1
+ IP=192.168.30.6
++ tail -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f6
+ BANDA=32
+ PESO=3
++ tail -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f8
+ BAND_MIN=16
+ PESO_MIN=1
++ tail -n1 /tmp/mac.conf.client.tmp
++ cut '-d ' -f7
+ IFACE=eth1
+ '[' 5 -le 9 ']'
+ '[' -x ']'
+ (( count++ ))
+ tc class add dev eth1 parent 1:1 classid 1:4 htb rate 32Kbit ceil 32Kbit prio 5 burst 1k
+ tc qdisc add dev eth1 parent 1:1 handle 4 sfq perturb 10
RTNETLINK answers: No such file or directory
+ tc filter add dev eth1 parent 1:1 protocol ip prio 10 u32 match ip dst 192.168.30.6 flowid 1:4
+ tc class add dev ifb0 parent 1:1 classid 1:4 htb rate 16Kbit prio 5 burst 1k
+ tc qdisc add dev ifb0 parent 1:1 handle 4 sfq perturb 10
RTNETLINK answers: No such file or directory
+ tc filter add dev ifb0 parent 1:1 protocol ip prio 10 u32 match ip src 192.168.30.6 flowid 1:4
+ echo 'Teste-de-Banda5 32 kbps X 16 kbps'
Teste-de-Banda5 32 kbps X 16 kbps
+ let CLIENT+=2
+ let ID++
+ '[' 12 -le 10 ']'
+ echo
+ echo 'Arquivos criados com êxito !'
Arquivos criados com êxito !
+ echo