Author: Eduardor
Add-on State: Testing
Add-on Version: 0.1beta
System Version Required: tested 2.30/2.31
Other Packages Required: QoS, Cron
Other Packages Conflict: Any bridge proxy that merge all traffic a the same IP.
NOTE: As script add-on, don't need to download anything. Only cut'n paste the code!
Description: Based in QoS "BrazilFW init scripts (manual class config)", but automatically select the terminals and bandwidth processing the ARP table.
Each terminal may have a bandwidth of non junked divide by the total of terminals connected.
Processing the ARP table make a manual class file, then reload QoS.
Ideal for some low quantity terminals network
Very well performance balance between P2P(Ares, Bittorrent, etc.), Rapidshare, multi session download, normal Web and Chat.
Belive It or Not!
Installation Instructions:
*) Go to: QOS Init Configuration - Edit Custom QOS Script
Paste the code:
- Código: Selecionar todos
#!/bin/sh
# Custom QOS Script
# Past your own QOS script here
# ARP-QOS
# Eduardo Ricobaldi 2008-08-18
ARP_TABLE="/proc/net/arp"
QOS_CLASSES="/etc/coyote/qos.classes"
treat_line_arp() {
LINE=`echo $1`
IP=`echo "$LINE" | cut -f 1 -d " "`
IPF4=`echo "$IP" | cut -f 4 -d "."`
echo "define_class_qos "1:1" "1:1$IPF4" $QOS_DOWNSTREAM_INDIVIDUAL $QOS_DOWNSTREAM_INDIVIDUAL $QOS_UPSTREAM_INDIVIDUAL $QOS_UPSTREAM_INDIVIDUAL $IP" >> $QOS_CLASSES
}
individual() {
res=$((${1}*(100-${2})/100))
if [ $3 -gt 3 ] ; then # > 2 + (total excluded machines)
res=$((${res}/(${3}-2))) # wc- (1 + (total excluded machines)
fi
echo $res
}
echo "Processing ARP Table..."
echo -n > $QOS_CLASSES
MACHINES=`wc -l <$ARP_TABLE`
QOS_DOWNSTREAM_INDIVIDUAL=$(individual $QOS_DOWNSTREAM $QOS_DOWNSTREAM_JUNK $MACHINES)
QOS_UPSTREAM_INDIVIDUAL=$(individual $QOS_UPSTREAM $QOS_UPSTREAM_JUNK $MACHINES)
if [ -n "$ARP_TABLE" -a -e "$ARP_TABLE" ] ; then
echo "Scanning ARP Table"
cat $ARP_TABLE | while read TMPLINE ; do
case "$TMPLINE" in
IP*|"") continue;;
"192.168.0.20 "*) continue;; # Exclude some known low traffic machine
*) treat_line_arp "$TMPLINE";;
esac
done
fi
QOS_TYPE="COYOTE_MANUAL" # Simulating MANUAL QOS
[ -x /etc/rc.d/rc.qos.coyote ] && . /etc/rc.d/rc.qos.coyote
QOS_TYPE="CUSTOM" # End of simulation of MANUAL QOS
And press OK
*) Select (*) Custom QOS Script
*) Set Real Downstream and Upstream bandwidth
*) Set the Upstream junk and Downstream junk at Default classes settings.
The default 5% may be too low. Try 10% to 20%.
And Save.
*) Try reload QoS to look for errors.
Maybe need to exclude some IP with too low traffic, but connected to server (making ARP presence).
Comment o modify the excluded IP adding # at "192.168.0.20 ...
To add more excluded IP, repeat the line.
Note the space character after IP number
Change the "2" and "3" as total excluded machines plus one and plus two
*) Go to: Scheduled Tasks - Add a New Task
Paste in: Command To Run:
- Código: Selecionar todos
/etc/rc.d/rc.qos
Reload Cron
*) Wait a minute.
Thanks: Claudio for the mkethers script
Note: As this script is manual-class based tables, BACKUP your tables BEFORE activate this script. Will be replaced.
ToDo:
* Add a table of excluded IP. Now hardcoded
* Detect no changes at ARP table avoiding reload QoS again and again
* Priorizing low traffic. Some day...
ESPAÑOL
Description: Basado en el QoS de clases manuales, pero selecciona automaticamente que terminales y ancho de banda procesando la tabla ARP.
Cada terminal tendrá el ancho de banda (menos el porcentaje de "Junk") dividido la catidad de terminales.
Procesa la tabla ARP para crear la tabla de clases manuales, y luego reinicia el QoS
Es ideal para ambiente con pocas máquinas,
Realiza muy buen balance entre programas de descrga masiva como Ares, Bittorrent, etc.), Rapidshare, descarga multi sesión , Web normal y Chat.
Aunque no lo crean funciona!
Instrucciones de instalación:
*) Ir a: Configuración de Inicio de QOS - Editar Guión QOS personalizado
Pegar el código (sección en Inglés)
Y pulsar Guardar
*) Seleccionar (*) Guión QOS personalizado
*) Ajustar Capacidad Real de Bajada y subida
*) Ajusta el Exceso en el canal de subida y bajada en Configuración por Defecto de las clases
El valor por original de 5% puede ser demasiado bajo. Pruebe entre 10% a 20%.
Y Guardar.
*) Pruebe Recargar QoS para ver ei hay errores
Puede ser posible excluir algunos IP con muy poco tráfico, pero conectados al server (creando presencia en tabla ARP)
Comente o modifique los IP excluidos agregando # en "192.168.0.20 ...
Para agregar mas IP excluidos, repita la línea.
Note que hay un espacio luego del número IP
Cambie el 2 y 3 como el total de máquinas excluidas mas uno y mas dos
*) Ir a: Scheduled Tasks/(Tareas programadas) - Add a New Task/(Agregar tarea nueva)
Pegar en: Command To Run/(Comando a ejecutar):
- Código: Selecionar todos
/etc/rc.d/rc.qos
Recargar Cron
*) Esperar un minuto y puede ir a ver la tabla de clases manuales como se ha regenerado con las máquinas de su red. Actualice la página (F5) para ver las modificaciones.
Note: Como este script está basado en tablas de clases manuales, RESPALDE sus tablas ANTES de activar el script. Serán reemplazadas.
USO ALTERNATIVO
Puede usar el script para generar una tabla de QOS manuales, activando el script en el momento que sepa que todas las máquinas de su red están en uso. Cuando note que la tabla se regeneró con todos los IP, puede volver a QOS manual y recargar QOS, para detener el proceso de regeneración de la tabla.
Comentar barbaridades typografikas, bugs, please.