+ Responder ao Tópico



  1. Olá pessoal, pela primeira vez vou contribuir, estava com dificuldades em ter o controle de banda dos clientes, queria que a noite eles tivessem um ganho na conexão, no meu caso 20%, só que os cliente conectados não mudavam, a não ser que eu resetava mas através de um comando q foi postado por um membro do fórum (rgoesjr - https://under-linux.org/f226/limitac...orario-132352/) consegui criar e parece q ficou bom, fiquem a vontade em usar e caso alguém tenha uma melhoria vou ficar muito grato se compartilhar. vamos lá.

    tenho os seguintes planos aqui:
    200kbps, 400kbps e 600kbps

    uso hotspot, tenho um script q dá os 20% aos usuários nos horários, modificando o User Profile mas somente quem conectava apos o horário da mudança podia usufruir.

    [admin@RB01] /ip hotspot user profile
    add name="600K" idle-timeout=30m keepalive-timeout=2m status-autorefresh=1m shared-users=1 rate-limit="234k/780k 305k/1014k 176k/585k 16 8 59k/195k" transparent-proxy=no
    add name="400K" idle-timeout=30m keepalive-timeout=2m status-autorefresh=1m shared-users=1 rate-limit="156k/520k 203k/676k 117k/390k 16 8 39k/130k" transparent-proxy=no
    add name="200K" idle-timeout=30m keepalive-timeout=2m status-autorefresh=1m shared-users=1 rate-limit="78k/260k 102k/338k 59k/195k 16 8 20k/65k" transparent-proxy=no


    [admin@RB01] /system script
    add name="HS_Diurno" owner="admin" policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive last-started=dec/27/2011 23:38:23 run-count=34 source=
    /ip hotspot user profile set "200K" rate-limit="60k/200k 78k/260k 45k/150k 16 8 15k/50k"
    /ip hotspot user profile set "400K" rate-limit="120k/400k 156k/520k 90k/300k 16 8 30k/100k"
    /ip hotspot user profile set "600K" rate-limit="180k/600k 234k/780k 135k/450k 16 8 45k/150k"


    add name="HS_Domingo" owner="admin" policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive last-started=aug/11/2011 08:01:00 run-count=4 source=
    /ip hotspot user profile set "200K" rate-limit="78k/260k 102k/338k 59k/195k 16 8 20k/65k"
    /ip hotspot user profile set "400K" rate-limit="156k/520k 203k/676k 117k/390k 16 8 39k/130k"
    /ip hotspot user profile set "600K" rate-limit="234k/780k 305k/1014k 176k/585k 16 8 59k/195k"


    add name="HS_Noturno" owner="admin" policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive last-started=dec/28/2011 01:16:39 run-count=35 source=
    /ip hotspot user profile set "200K" rate-limit="78k/260k 102k/338k 59k/195k 16 8 20k/65k"
    /ip hotspot user profile set "400K" rate-limit="156k/520k 203k/676k 117k/390k 16 8 39k/130k"
    /ip hotspot user profile set "600K" rate-limit="234k/780k 305k/1014k 176k/585k 16 8 59k/195k"


    [admin@RB01] /system scheduler
    # NAME START-DATE START-TIME INTERVAL ON-EVENT
    0 HS_Domingo oct/09/2011 08:00:10 1w /system script run HS_Domingo
    1 HS_Noturno oct/03/2011 23:00:00 1d /system script run HS_Noturno
    2 HS_Diurno oct/03/2011 08:00:00 1d /system script run HS_Diurno

    Com isso conseguimos mudar os profiles dos usuários, agora para quem já está conectados segue abaixo.

  2. [admin@RB01] /system script
    name="Queue_Noturno" owner="admin" policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive last-started=dec/28/2011 01:19:44 run-count=59 source=
    #Plano 200k Noturno
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i max-limit] = "60k/200k") do={ :put [/queue simple set $i max-limit=78k/260k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i burst-limit] = "78k/260k") do={ :put [/queue simple set $i burst-limit=102k/338k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i burst-threshold] = "45k/150k") do={ :put [/queue simple set $i burst-threshold=59k/195k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i limit-at] = "15k/50k") do={ :put [/queue simple set $i limit-at=20k/65k] }}
    #Plano 400k Noturno
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i max-limit] = "120k/400k") do={ :put [/queue simple set $i max-limit=156k/520k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i burst-limit] = "156k/520k") do={ :put [/queue simple set $i burst-limit=203k/676k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i burst-threshold] = "90k/300k") do={ :put [/queue simple set $i burst-threshold=117k/390k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i limit-at] = "30k/100k") do={ :put [/queue simple set $i limit-at=39k/130k] }}
    #Plano 600k Noturno
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i max-limit] = "180k/600k") do={ :put [/queue simple set $i max-limit=234k/780k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i burst-limit] = "234k/780k") do={ :put [/queue simple set $i burst-limit=305k/1014k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i burst-threshold] = "135k/450k") do={ :put [/queue simple set $i burst-threshold=176k/585k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i limit-at] = "45k/150k") do={ :put [/queue simple set $i limit-at=59k/195k] }}


    name="Queue_Diurno" owner="admin" policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive last-started=dec/28/2011 01:13:09 run-count=21 source=
    #Plano 200k Diurno
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i max-limit] = "78k/260k") do={ :put [/queue simple set $i max-limit=60k/200k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i burst-limit] = "102k/338k") do={ :put [/queue simple set $i burst-limit=78k/260k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i burst-threshold] = "59k/195k") do={ :put [/queue simple set $i burst-threshold=45k/150k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i limit-at] = "20k/65k") do={ :put [/queue simple set $i limit-at=15k/50k] }}
    #Plano 400k Diurno
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i max-limit] = "156k/520k") do={ :put [/queue simple set $i max-limit=120k/400k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i burst-limit] = "203k/676k") do={ :put [/queue simple set $i burst-limit=156k/520k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i burst-threshold] = "117k/390k") do={ :put [/queue simple set $i burst-threshold=90k/300k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i limit-at] = "39k/130k") do={ :put [/queue simple set $i limit-at=30k/100k] }}
    #Plano 600k Diurno
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i max-limit] = "234k/780k") do={ :put [/queue simple set $i max-limit=180k/600k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i burst-limit] = "305k/1014k") do={ :put [/queue simple set $i burst-limit=234k/780k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i burst-threshold] = "176k/585k") do={ :put [/queue simple set $i burst-threshold=135k/450k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i limit-at] = "59k/195k") do={ :put [/queue simple set $i limit-at=45k/150k] }}

    name="Queue_Domingo" owner="admin" policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive run-count=0 source=
    #Plano 200k Noturno
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i max-limit] = "60k/200k") do={ :put [/queue simple set $i max-limit=78k/260k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i burst-limit] = "78k/260k") do={ :put [/queue simple set $i burst-limit=102k/338k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i burst-threshold] = "45k/150k") do={ :put [/queue simple set $i burst-threshold=59k/195k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i limit-at] = "15k/50k") do={ :put [/queue simple set $i limit-at=20k/65k] }}
    #Plano 400k Noturno
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i max-limit] = "120k/400k") do={ :put [/queue simple set $i max-limit=156k/520k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i burst-limit] = "156k/520k") do={ :put [/queue simple set $i burst-limit=203k/676k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i burst-threshold] = "90k/300k") do={ :put [/queue simple set $i burst-threshold=117k/390k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i limit-at] = "30k/100k") do={ :put [/queue simple set $i limit-at=39k/130k] }}
    #Plano 600k Noturno
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i max-limit] = "180k/600k") do={ :put [/queue simple set $i max-limit=234k/780k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i burst-limit] = "234k/780k") do={ :put [/queue simple set $i burst-limit=305k/1014k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i burst-threshold] = "135k/450k") do={ :put [/queue simple set $i burst-threshold=176k/585k] }}
    :foreach i in=[/queue simple find ] do={ :if ([/queue simple get $i limit-at] = "45k/150k") do={ :put [/queue simple set $i limit-at=59k/195k] }}

    [admin@RB01] /system scheduler
    # NAME START-DATE START-TIME INTERVAL ON-EVENT
    3 Queue_Diurno oct/03/2011 08:00:05 1d /system script run Queue_Diurno
    4 Queue_Noturno oct/03/2011 23:00:05 1d /system script run Queue_Noturno
    5 Queue_Domingo oct/09/2011 08:00:15 1w /system script run Queue_Domingo




    Antes de colocar para funcionar, tem que habilitar as colunas na janela do Simple Queues:
    Burst/Burst Limit
    Burst/Burst Threshold
    RX Limit At
    TX Limit At


    Agora sim, eh só habilitar tudo e pronto!


    De imediato é uma boa solução, caso alguém tenha algo mais simples e prático pode compartilhar.



  3. Muito bom, funcionou perfeitamente esse post deveria ficar fixo ou ir pra wiki

  4. Olá Aredeprovedor,

    Boa iniciativa! Para rodar direto no Mikrotik é interessante, mas p/ um volume maior de clientes ou planos fica bem trabalhoso...seria interessante ter isso automático num sistema de gerenciamento.

    O Altarede System tem esse controle de plano turbo, liberando a banda do cliente por horário ou multiplicando a banda do cliente, do jeito que vc desejar.
    Tudo isso sem desconectar o cliente, apenas alterando a queue do mesmo direto no Mikrotik sem a intervenção do usuário.

    Também temos controle de planos para PNBL (franquia) no Altarede System.

    Se precisar, entre no nosso site pra conhecer o Altarede System.

    - Planos com franquia
    - Central de Assinante
    - Financeiro Completo
    - Cobrança Registrada e Simples
    - Suporte Eficiente

    Abraço,

    Eder Závoli
    Altarede System - Sistema Completa de Gerência de Provedor



  5. Bom dia
    parabéns pela tópico

    tira uma duvida minha, estou fazendo este script mas ele nao funcionar todos no mesmo script,estou tendo que criar um script para cada velocidade.
    seria isto mesmo,um para cada velocidade?






Tópicos Similares

  1. Limitação de Banda por Horário
    Por rgoesjr no fórum Redes
    Respostas: 6
    Último Post: 09-12-2011, 22:03
  2. Limitação de banda por horário
    Por wireless&cia no fórum Redes
    Respostas: 9
    Último Post: 09-12-2011, 22:02
  3. Respostas: 4
    Último Post: 16-07-2006, 22:30
  4. Determinando quanto de banda por usuário
    Por fernandoc19 no fórum Redes
    Respostas: 3
    Último Post: 27-08-2004, 15:18
  5. Limitaçao de banda por interface, iptables.
    Por vandemberg no fórum Servidores de Rede
    Respostas: 2
    Último Post: 29-07-2002, 14:12

Visite: BR-Linux ·  VivaOLinux ·  Dicas-L