Vous êtes sur la page 1sur 199

SISTEMA DE CONTROL DE TRFICO EN REDES DE

DATOS CON IMPLEMENTACIN DE NPU

HARVEY DEMIAN BASTIDAS CAICEDO


DIEGO ANDRS BELTRN ORDUZ

UNIVERSIDAD DE SAN BUENAVENTURA CALI


FACULTAD DE INGENIERA
PROGRAMA DE INGENIERA ELECTRNICA
SANTIAGO DE CALI, 2011
4

SISTEMA DE CONTROL DE TRFICO EN REDES DE


DATOS CON IMPLEMENTACIN DE NPU

HARVEY DEMIAN BASTIDAS CAICEDO


DIEGO ANDRS BELTRN ORDUZ

Informe final de trabajo de grado

Director
MG. ING. OSCAR CASAS GARCA

UNIVERSIDAD DE SAN BUENAVENTURA CALI


FACULTAD DE INGENIERA
PROGRAMA DE INGENIERA ELECTRNICA
SANTIAGO DE CALI, 2011
4

Este trabajo de grado, en la modalidad de


Proyecto de investigacin, es
aceptado
como uno de los requisitos para obtener el ttulo
de Ingeniero Electrnico en la Universidad de
San Buenaventura Cali.

____________________________________________
Ing. Oscar Casas Garca

____________________________________________
Ing. Erika Sarria Navarro

_____________________________________________
Ing. Fernando Vlez Varela

Santiago de Cali, 3 de Junio del 2011

CONTENIDO

CAPITULO 1
INTRODUCCIN ...............................................................................................................21
1.1 OBJETIVOS ..............................................................................................................23
1.1.1

Objetivo general. ....................................................................................23

1.1.2

Objetivos especficos. ...........................................................................23

1.2 CONTRIBUCIN .....................................................................................................23


1.3 ORGANIZACIN DEL LIBRO ...............................................................................25

CAPITULO 2
MARCO TERICO ............................................................................................................27
2.1 NETWORK PROCESSING UNIT (NPU) .............................................................27
2.2 QUALITY OF SERVICE ..........................................................................................28
2.3

ARQUITECTURA PARA SERVICIOS DIFERENCIADOS ..............29

2.3.1

Traffic shaper. .........................................................................................30

2.3.2

Disciplinas de encolamiento (queueing disciplines). ........................31

2.4 CURVA DE SERVICIO ...........................................................................................33


2.5 LA DISCIPLINA DE COLAS H-FSC (HIERARCHICAL FAIR
SERVICE CURVE) ...............................................................................35
2.5.1

Funcin

.............................................................37

2.5.2

Funcin

. ........................................................................38

2.5.3

funcin

. ........................................................................40

2.6 LA DISCIPLINA DE COLAS SFQ (STOCHASTIC FAIRNESS QUEUING)41

CAPITULO 3
DISEO E IMPLEMENTACIN DEL SISTEMA DE CONTROL
DE TRFICO EN REDES ETHERNET (SCTRE) ........................................................43
3.1 PLATAFORMA DE HARDWARE ..........................................................................43
3.2 DISEO DE SOLUCIN DE SOFTWARE ..........................................................47
3.2.1

Licencias..................................................................................................47

3.2.2

Seleccin del mtodo de desarrollo. ...................................................47

3.2.3

Interfaz de usuario. ................................................................................48

3.2.4

Funcionamiento del SCTRE.................................................................49

3.2.5

Diseo e implementacin de entorno de desarrollo. ........................52

3.3 CREACIN DE SISTEMA BASE ..........................................................................54


3.3.1

Instalacin de LTIB. ...............................................................................55

3.3.2

Generacin de imagen de GNU/LINUX. ............................................55

3.3.3

Instalacin de aplicaciones. .................................................................56

3.4 SOFTWARE DESARROLLADO...........................................................................57


3.4.1 Bases de datos.....................................................................................................58
3.4.2

Interfaz WEB...........................................................................................60

3.4.3

Generador de comandos. .....................................................................68

3.4.4

Scripts de inicio. .....................................................................................72

CAPITULO 4
PRUEBAS DE FUNCIONAMIENTO ..............................................................................75
4.1 ESTRUCTURA DEL SISTEMA DE PRUEBAS...................................................75
4.2 CONFIGURACIN DE SCTRE .............................................................................76
4.3 PROCEDIMIENTOS PARA REALIZAR MEDICIONES .....................................79
4.3.1

Mtodo de medicin de consumo de CPU y RAM. ..........................79

4.3.2

Mtodo de medicin de tasa de transferencia. .................................80

4.4 RESULTADOS DE LAS MEDICIONES ...............................................................81

CAPITULO 5
CONCLUSIONES Y TRABAJO FUTURO ....................................................................83
5.1 CONCLUSIONES ....................................................................................................83
5.2 TRABAJO FUTURO ................................................................................................84

REFERENCIAS..................................................................................................................87

ANEXOS .............................................................................................................................91

LISTA DE FIGURAS

Figura 2.1
Figura 2.2
Figura 2.3
Figura 2.4

Disciplina de colas con clases en estructura jerrquica ...........................32


Curvas de servicio lineal y no-lineal.............................................................34
Estructura jerrquica de distribucin de ancho de banda ........................35
Ejemplo de funcionamiento de SFQ ............................................................42

Figura 3.1 Procesador Freescale P2020 .......................................................................44


Figura 3.2 Fotografa de la board P2020RDB ...............................................................45
Figura 3.3 Chasis de Freescale P2020RDB-PA ...........................................................46
Figura 3.4 Sistema de control de trfico de redes ethernet (SCTRE).......................50
Figura 3.5 Configuracin de Interfaces de SCTRE ......................................................51
Figura 3.6 Configuracin de LTIB ..................................................................................56
Figura 3.7 Diagrama de la Interfaz Wed ........................................................................61
Figura 3.8 Captura de la pantalla de configuracin LAN.............................................62
Figura 3.9 Pantalla de configuracin WAN ....................................................................63
Figura 3.10 Pantalla de configuracin de rutas estticas............................................64
Figura 3.11 Pantalla de manejo de clases.....................................................................65
Figura 3.12 Listado de reglas existentes .......................................................................66
Figura 3.13 Formulario de adicin/modificacin de reglas ..........................................67
Figura 3.14 Funcionamiento de generador de comandos ..........................................69
Figura 4.1
Figura 4.2
Figura 4.3
Figura 4.4
Figura 4.5
Figura 4.6

Diagrama del sistema usado para pruebas ................................................76


Diagrama jerrquico de clases usadas para las mediciones ..................77
Captura de configuracin de clases utilizada para las pruebas ..............77
Listado de reglas usadas para las mediciones ..........................................78
Programa top usado para la medicin de CPU y Memoria RAM
79
Verificacin de limite ancho de banda de subida ......................................80

10

LISTA DE TABLAS

Tabla 1.1 Comparacin de precios de varias soluciones disponibles.......................22


Tabla 2.1 Principales disciplinas de colas con clases .................................................33
Tabla 3.1 Aplicaciones usadas para el proyecto ..........................................................57
Tabla 3.2 Estructura de la base de datos de configuracin ........................................58
Tabla 3.3 Estructura de la base de datos de control....................................................60
Tabla 4.1 Consumo de CPU y RAM con (CC) y sin (SC) control de trfico.............81
Tabla 4.2 Tiempos de respuesta del computador C hasta A ......................................82

11

12

LISTA DE ALGORITMOS

Algoritmo 1.1 Algoritmo H-FSC ......................................................................................37


Algoritmo 1.2 Funcin receive packet(i,p)......................................................................38
iAlgoritmo 1.3 Funcin update_ed() y update_d().........................................................39
Algoritmo 1.4 Algoritmo para calcular la curva Di .........................................................40
Algoritmo 1.5 Funcin update_v() ...................................................................................41

13

14

LISTA DE ANEXOS
ANEXO A MANUAL DE USUARIO .................................................................................93

15

16

GLOSARIO

LATENCIA: Es la suma de retardos temporales dentro de una red. Un retardo es


producido por la demora en la propagacin y transmisin de paquetes dentro de la
red.
CALIDAD DEL SERVICIO: (Quality of Service, en ingls) son las tecnologas que
garantizan la transmisin de cierta cantidad de informacin en un tiempo dado.
Calidad de servicio es la capacidad de dar un buen servicio. Es especialmente
importante para ciertas aplicaciones tales como la transmisin de vdeo o voz.
UNIDAD DE PROCESAMIENTO DE RED: (NPU) Es un procesador diseado
especificamente para funciones de red.
SISTEMA OPERATIVO: Un Sistema Operativo (SO) es el software bsico de una
computadora que provee una interfaz entre el resto de programas del ordenador,
los dispositivos hardware y el usuario.
ENCOLAMIENTO: (Queueing, en ingls) Se refiere a la accin de introducir
paquetes en colas (LIFO).
CURVA DE SERVICIO: Es un modelo de control de tasa de transferencia y
latencia. Sus set-points dependientes del tiempo pueden representarse como un
grfico de servicio(bytes) contra tiempo(s), por tanto la pendiente en cualquier
punto representa la tasa de transferencia.
PHP: (PHP Hypertext Preprocessor ) Lenguaje scripting de alto nivel cuyo cdigo
se inserta dentro del cdigo fuente HTML y se ejecuta en el servidor cada vez que
la pgina se consulta. Tiene sintaxis con ciertas similitudes a C. No se considera
un lenguaje de programacin puesto que no se genera cdigo ejecutable, sino que
se debe compilar el script cada vez que se necesita.
PERL: Lenguaje de programacin de alto nivel que facilita el procesamiento de
cadenas de texto como la salida de un comando, existe una extensa librera de
mdulos realizados por usuarios llamada CPAN (Comprehensive Perl Archive
Network) donde puede descargarse gran cantidad de herramientas.
17

SQL: (Structured Query Language) Lenguaje de consultas para bases de datos


relacionales, es decir, las que guardan los datos en tablas. Permite el manejo de
bases de datos residentes en un servidor que son manipuladas envindoles
comandos llamados consultas. Se pueden manipular los datos y la estructura de la
base de datos.
CLI: (Command Line Interface) Es un tipo de interfaz de usuario que perimite el
envo de comandos a un programa usando nicamente la lnea de comandos.
REENVO DE PAQUETES: (Packet forwarding) Es el proceso mediante el cul un
dispositivo de red intermedio transfiere paquetes desde un segmento de red a
otro. Usando este proceso, los routers deciden a que interfaz de red deben
reenviar un paquete recibido.

18

RESUMEN

La implementacin de Quality of Service (QoS) y la distribucin eficiente del ancho


de banda para acceso a Internet son problemas que tienen un papel importante en
las redes IP de mltiples servicios. Debido al costo de los equipos y la mano de
obra requerida para resolver estos problemas [1], se disea un sistema de control
de trfico de red que pretende reducir estos costos. El control de trfico en una red
IP, es el nombre que se le da al conjunto de mecanismos utilizados para clasificar,
priorizar o limitar ciertos tipos de trfico recibidos y transmitidos por un router [15]
que cuenta con esta funcionalidad. En el presente proyecto se implementa un
sistema de control de trfico, usando un NPU (Network Processing Unit) que
ejecuta un algoritmo de control usando informacin extrada de las capas de red y
transporte de los paquetes recibidos.
Un NPU es un chip que incluye procesadores, controladores ethernet, y otras
caractersticas integradas para realizar funciones de red como procesar las tramas
recibidas para extraer informacin. Debido a las ventajas en cuanto a consumo
energtico, a la reduccin de costo que implica la integracin en un chip y a las
optimizaciones para operaciones de red, se utiliza un NPU. Para que el sistema
sea fcil de usar, se utiliza configuracin va Web. Se utiliz GNU/Linux como
sistema operativo embebido para la plataforma seleccionada para la
implementacin.
Palabras clave: Bandwidth management, Traffic Shaping, Quality of Service (QoS),
Network Processor, Network Processing Unit (NPU), Arquitectura para servicios
diferenciados, Queueing discipline.

19

20

CAPITULO 1
INTRODUCCIN

Si la tasa de transferencia, tambin llamada ancho de banda, de un enlace de


datos a Internet, se ocupa por servicios de baja prioridad que requieren grandes
cantidades de ancho de banda (como programas p2p), se disminuir la calidad en
la prestacin de servicios que pueden ser prioritarios o que requieran baja latencia
como voz sobre IP (VoIP). Para garantizar la Calidad del Servicio (QoS) en redes
con congestin de trfico y para distribuir de una manera especfica el ancho de
banda entre los servicios se utilizan sistemas de control de trfico de red.
Las empresas y organizaciones que requieren para su funcionamiento acceso a
Internet, por ejemplo las que ofrecen servicios en lnea, necesitan distribuir su
velocidad de acceso a internet para que no sea consumida en su totalidad por una
sola conexin, dejando a otros usuarios sin servicio. Para un dispositivo intermedio
de red, un servicio es un flujo de paquetes con valores particulares de los datos
del encabezado de capa 3 o capa 4 del modelo OSI, estos valores lo diferencian
de otros servicios. Entre los valores que pueden diferenciar servicios, se
encuentran: protocolo de capa 4, puerto fuente y destino, IP fuente y destino, entre
otros.
Las soluciones que actualmente se emplean a nivel empresarial para realizar el
control de trfico de red; es decir, distribuir y priorizar el ancho de banda de una
conexin a Internet, van desde costosos routers Cisco que tienen funcionalidad de
QoS y Generic Traffic Shaping (GTS) como los de la serie 4000 o superiores con
mdulo de procesador de red (Network Processor Module - NPM) cuyo costo
conjunto generalmente est en el rango de decenas de millones de pesos [20][19],
hasta servidores econmicos con sistema operativo GNU/Linux configurados para
realizar estas tareas, cuyo costo est en el rango de algunos millones de pesos
[8], sin contar con gastos de configuracin y mantenimiento. Los costos de
algunos de los equipos comerciales se muestran en la Tabla 1.1, Los criterios
tcnicos usados para la comparacin fueron que soportaran al menos 500 reglas
de clasificacin, distribucin no-uniforme del ancho de banda, configuracin va
Web y que tengan interfaces de red GbE (Gigabit Ethernet).

21

Tabla 1 .1 Comparacin de precios de varias soluciones disponibles

Marca

Modelo

Precio

Dell [8]

PowerEdge 2900 III

$1,640.50 USD

Cisco Systems [19]


Xroads Networks [27]
Netequalizer [1]

AS5520CRF refurbished
EdgeXL-500

$10,040.20 USD
$9,995.00 USD

NE3000-1GB

$8,900.00 USD

Las soluciones de la Tabla 1.1, tienen diferentes funcionalidades aparte del control
de trfico, como VPN, tunneling o PoE (Power over Ethernet) entre otras. La
funcionalidad de los sistemas dedicados de control de trfico como Xroads o
Netequalizer no tienenen capacidades de expansin como los sistemas Cisco o
las soluciones basadas en software (servidor Dell). El sistema realizado en este
proyecto es exclusivamente para control de trfico y adems tiene funcionalidad
de router.
El problema con las soluciones mencionadas es que requieren mano de obra
altamente calificada para su configuracin, operacin y mantenimiento, lo que
ocasiona un costo mensual de operacin y adems se desperdician
funcionalidades de los equipos al ser utilizados nicamente para control de trfico.
Por los motivos anteriores, se decide realizar el diseo e implementacin de un
dispositivo especializado para control de trfico de red, con interfaz de
configuracin va Web que resulta ms fcil de usar que una configuracin por CLI
(Command-Line Interface).
Para la implementacin de un sistema de estas caractersticas, hace falta el
procesamiento de paquetes IPv4 a alta velocidad y al mismo tiempo la ejecucin
de algoritmos de control que pueden resultar en un uso intensivo del procesador o
inclusive, el procesador se puede convertir en un cuello de botella para manejar el
trfico limitando la capacidad mxima del enlace. Por esta razn se utiliza una
Unidad de Procesamiento de Red (NPU) que realiza las tareas de medicin y
clasificacin del trfico con gran eficiencia.

22

1.1

OBJETIVOS

1.1.1 Objetivo general.


Implementar un sistema de control de trfico para redes ethernet utilizando una
NPU; que sea de bajo costo, flexible y de fcil configuracin.

1.1.2 Objetivos especficos.

1.2

Seleccionar el mejor algoritmo para control de trfico en redes de datos,


mediante una bsqueda bibliogrfica del estado del arte de los mismos.

Disear de la arquitectura del sistema embebido para el control de trfico


en redes de datos.

Implementar un sistema de control de trfico usando el algoritmo


seleccionado.

Implementar una interfaz de configuracin va web de fcil uso.

Realizar pruebas del sistema de control de trfico en varias redes de datos,


para comprobar el funcionamiento del dispositivo.

Realizar pruebas de interfaz de usuario.

Escribir un artculo con los resultados del proyecto para su publicacin en


una revista especializada.

CONTRIBUCIN

La principal contribucin es la disminucin de costo del sistema desarrollado


respecto a sistemas comerciales que pueden realizar control de trfico, adems el
uso de la disciplina de colas H-FSC (Hierarchical Fair Service Curve) que permite
controlar independientemente la tasa de transferencia y el retardo.
23

En las redes de datos actuales, la cantidad de servicios ofrecidos es amplia y


algunos de ellos tienen requisitos mnimos de QoS (tiempo mximo de retardo y
tasa de transferencia). Si estos requisitos no se satisfacen, ocurren problemas en
el servicio, por ejemplo cortes en una comunicacin de VoIP o de
Videoconferencia, por lo tanto, en redes que manejan grandes cantidades de
trfico, especialmente de Internet, se hace necesario contar con un mecanismo de
distribucin eficiente del ancho de banda y a pesar de que una posible solucin
sera simplemente adquirir mayor ancho de banda para el enlace de salida a
Internet, esta solucin sera costosa y no se estara optimizando el uso del ancho
de banda, pudiendo incurrir de nuevo en una ocupacin total del canal por parte
de servicios no prioritarios. Una mejor alternativa es realizar el control de trfico,
puesto que se optimiza el uso del enlace, permitiendo distribuir de manera nouniforme el ancho de banda para acceso a internet, segn las necesidades de
cada servicio en la red, y priorizar servicios para mantener unos parmetros de
QoS adecuados para cada servicio.
Las alternativas de software son las ms atractivas desde el punto de vista
econmico, al necesitarse nicamente un servidor y una aplicacin de software
que en muchas ocasiones es Open Source o tiene un bajo costo [8]; sin embargo, la
alternativa de software tiene el inconveniente de que al ejecutarse el sistema de
control de trfico sobre un Sistema Operativo ampliamente usado, se corren
graves riesgos de seguridad debido a los riesgos de seguridad informfica,
causados por vulnerabilidades explotables tanto en el sistema operativo como en
el software de control de trfico, de esta manera, para considerar la alternativa de
software, se debe tener en cuenta la mano de obra altamente calificada requerida
para la instalacin y sobre todo la administracin y manejo de seguridad del
servidor.
Las alternativas de hardware son un poco ms costosas [1], pero requieren menos
mantenimiento. El problema con estas soluciones, es que generalmente tienen
muchas caractersticas que no son utilizadas y por tanto se subutilizan los
costosos equipos, adems la complejidad de sus diseos y sus amplias
funcionalidades se reflejan para el operador en cierta dificultad de uso, con lo que
se deben agregar cargos por entrenamiento para su uso o la contratacin de mano
de obra calificada.
Debido a las razones expuestas anteriormente, se considera adecuado el diseo e
implementacin de un sistema de trfico en hardware dedicado exclusivamente a
este propsito; adems, con una interfaz de usuario que permita una fcil
24

configuracin del sistema y conlleve a la reduccin de costos en cuanto a la


cualificacin del personal.

1.3

ORGANIZACIN DEL LIBRO

En el Captulo 2 se encuentran los conceptos y mtodos bsicos para realizar el


control de trfico de red.
En el Captulo 3 se describe todo el proceso para el diseo del controlador de
trfico de red con una explicacin de cada uno de los bloques que lo conforman
para tener una ptima implementacin.
En el Captulo 4 se encuentran las pruebas realizadas al equipo y se determinan
los lmites de su funcionamiento en una situacin de congestin.
Por ltimo, en el Capitulo 5 se encuentran las conclusiones que se han obtenido
tras el proceso de implementacion del controlador de trfico de red .

25

26

CAPITULO 2
MARCO TERICO

En ste captulo se describen los conceptos y tecnologas que sirven de base para
el diseo e implementacin del sistema de control de trfico.

2.1

NETWORK PROCESSING UNIT (NPU)

Un NPU, tambin llamado procesador de comunicaciones es un chip que integra


uno o varios procesadores, controladores de interfaces de red, controladores de
diferentes tipos de memoria y otra circuitera dedicada al procesamiento de trfico
de red. Todo el control de trfico, se lleva a cabo por software y por tanto se puede
implementar en cualquier computador con suficiente capacidad de procesamiento
y memoria (dependientes de la cantidad de trfico que se va a controlar), esta
capacidad requerida est determinada por el algoritmo de control usado, el
sistema operativo, la arquitectura a usar, las aplicaciones adicionales, entre otras;
sin embargo, para sistemas embebidos es ms conveniente el uso de un NPU
debido al bajo consumo energtico respecto a un servidor y por su tamao. En
este proyecto, se usa para realizar desencapsulamiento de los paquetes para
obtener los parmetros que definen el perfil del flujo de datos.
Adems de acelerar el desencapsulamiento, las NPU aceleran las tareas de
bsqueda de patrones en el paquete para llevar a cabo la medicin y clasificacin
(o marcado) del trfico de red. Estas mediciones pueden ser utilizadas por un
procesador o ncleo diferente en el algoritmo de Queueing (Encolamiento).
Algunas NPU como las Freescale PowerQUICC tambin realizan la funcin de
Scheduling (Programacin) para la cola de salida, adems estos dispositivos
pueden utilizar ms de un ncleo para realizar las tareas mencionadas en
paralelo.
Se pueden encontrar en el mercado diferentes marcas y arquitecturas. Los
procesadores de red en la actualidad tienen diferentes configuraciones con
interfaces de I/O de diversos tipos y arquitecturas como. PowerPC entre otras. Un
dispositivo de control de trfico al funcionar como router que selectivamente hace
27

forward de los paquetes recibidos, debe tener al menos dos interfaces de red,
controlador de memoria RAM, controladores de memoria Flash para almacenar las
configuraciones y otros requerimientos dependientes de la arquitectura o de la
aplicacin.
La capacidad de procesamiento requerida para medir, clasificar y controlar trfico
es difcil de determinar debido a que vara dependiendodepende de la eficiencia
del cdigo utilizado para implementar los algoritmos de control de trfico y de las
optimizaciones que tenga la arquitectura de la NPU para la medicin y
clasificacin. En sistemas comerciales que manejan Gigabit Ethernet, se utilizan
velocidades de reloj alrededor de los 600 MHZ para arquitectura Microprocessor
without Interlocked Pipeline Stages (MIPS) [2].
Existen varias marcas comerciales de NPUs y tienen diferentes precios
dependiendo de sus capacidades y caractersticas, entre las principales marcas
estn: Intel, LSI, Broadcom y Motorola (Freescale). Se pueden encontrar tambin
kits de desarrollo para algunas arquitecturas. Estos kits, contienen una board con
el procesador escogido, todas las interfaces que maneja y generalmente un
Software Development Kit (SDK) usado para facilitar la programacin y depuracin
[3].

2.2

QUALITY OF SERVICE

Quality Of Service (QoS) en redes de datos, consiste en la asignacin de


prioridades a diferentes flujos de datos de tal manera que se garantice un nivel de
calidad deseado, esto tiene que ver con la tasa de transferencia de un flujo de
datos, pero principalmente se relaciona con el retardo de los paquetes. Si el
retardo se hace mayor a un lmite se pierde la calidad del servicio, en algunos de
los algoritmos usados por sistemas de control de trfico se usan niveles de
prioridad para QoS. En algunos textos [14] se trata indistintamente como Grade of
Service (GoS); pero GoS es un trmino usado para la calidad de servicio en
telefona y es la probabilidad de que una llamada en curso sea bloqueada o
demorada durante una cierta cantidad de tiempo, mientras que QoS tiene que ver
con el retardo o latencia.

28

2.3 ARQUITECTURA PARA SERVICIOS DIFERENCIADOS


Las redes de datos actuales pueden usar mltiples servicios sobre una conexin,
algunos de estos, pueden afectar la latencia de otros haciendo que no se cumplan
sus requerimientos mnimos de QoS y ocasionando un desempeo deficiente. En
1998 el Internet Engineering Task Force (IETF) public el RFC2475 (An Architecture
for Differentiated Services) [15] y este se convirti rpidamente en el mecanismo
ms utilizado para garantizar la coexistencia de servicios con diferentes
requerimientos de QoS en un enlace.
La arquitectura para servicios diferenciados es un conjunto de mecanismos
mediante los cuales se pretende manejar y proveer QoS en redes IP, los servicios
se tratan como flujos de datos que se diferencian por valores obtenidos de los
encabezados de las capas del modelo OSI (generalmente capa 2 y superiores).
La parte del modelo de arquitectura de servicios diferenciados que se implementa
con este proyecto es la de Clasificacin y acondicionamiento de trfico, tambin
llamada Bandwidth Management (manejo de ancho de banda); este es un trmino
general que se refiere a una serie de herramientas y tcnicas, que permiten medir
y diferenciar los servicios usando clasificacin de perfiles de trfico para
finalmente controlar la tasa de transferencia y la latencia de un servicio en un
enlace de red compartido, de tal manera que no se sobrepase el ancho de banda
limite del enlace causando congestin de la red, problemas de transmisin de la
informacin y largos retardos.
La funcin de control realizada por el manejador de ancho de banda consiste en
medir la tasa de transferencia de cada flujo de datos usando una cantidad
configurable de tiempo, y con esta informacin realizar el clculo del error respecto
a la tasa de transferencia deseada para ese flujo en particular. Luego se aplican
mecanismos de buffering y limitacin de la tasa de transferencia, con la finalidad
de limitar la velocidad de ese flujo de datos hasta que se llega a la deseada,
tambin se garantiza un ancho de banda mayor para que se cumplan los
requerimientos de latencia usando mecanismos de scheduling o reordenamiento
del buffer de salida. En teora es posible controlar el retardo independientemente
de la tasa de transferencia, garantizando de esta manera los requerimientos
mnimos de QoS para servicios prioritarios. Esta funcin de control de trfico es
llamada Traffic shaping [15]. En el captulo tres se presentar la implementacin.

29

2.3.1 Traffic shaper.


Un Trafic shaper (controlador o conformador de trfico) es un mecanismo mediante
el cual se retardan algunos o todos los paquetes de un flujo de datos, usando para
este propsito un buffer de tamao conocido en el que se almacenarn los
paquetes mientras se retrasan. Si la capacidad del buffer se supera, los paquetes
comienzan a ser descartados y los mecanismos de retransmisin de los diferentes
protocolos son los responsables de que se entregue correctamente la informacin.
El conformador de trfico acta sobre un flujo de datos reduciendo su velocidad
para obtener el retardo y la tasa de transferencia deseados. Para controlar al
mismo tiempo la velocidad de varios flujos de datos presentes en el trfico, se
utilizan tres mecanismos:

El primero, llamado medicin, es el encargado de la actualizacin de la


medida de la tasa de transferencia y el retardo a la salida de cada paquete;
es decir, se encarga de medir las caractersticas temporales que son
usadas por la siguiente etapa.

La siguiente etapa, denominada encolamiento (queueing [5]), usa algoritmos


que realizan el buffering, dropping (descarte) o forward (routeo) del paquete
a la cola de salida o a cualquier otra cola, con el objetivo de alcanzar la
velocidad deseada. Tambin se utiliza el ancho de banda desocupado para
que se logren los requisitos de retardo.

Por ltimo se utiliza el mecanismo llamado Scheduling (programacin) que


aplica algoritmos de ordenamiento de la pila de salida tratando de alcanzar
justicia en la reparticin de ancho de banda entre conexio nes diferentes
existentes dentro de un flujo de datos.

El proceso de Queueing (Encolamiento) consiste en la seleccin de los paquetes


que se van a transmitir, su ubicacin en una cola y su demora o descartarte si no
se van a transmitir; se debe tener en c uenta que solamente se puede controlar el
trfico que se transmite, es decir, al que se hace Forward y no el que se recibe,
debido a que no se tiene control sobre el dispositivo que enva la informacin
recibida, solo se puede controlar lo que se enva.

30

Por tanto, para hacer control de trfico en los dos sentidos, en este proyecto, se
utilizan algoritmos de ordenamiento de colas para los paquetes que se transmiten
por las dos interfaces por separado. Otra caracterstica del proceso de Queueing es
que trabaja en la capa de protocolo (capa 3 del modelo OSI); es decir maneja
paquetes IP.

2.3.2 Disciplinas de encolamiento ( queueing disciplines).


Existen diferentes tipos de algoritmos de Queueing tambin llamados Disciplinas de
Colas (Queueing Disciplines) [17], para el propsito de este proyecto se utilizaron
dos tipos llamados disciplinas de colas simples o sin clases (Classless Queueing
Disciplines) y disciplinas de colas con clases (Classfull Queueing Disciplines). La
diferencia entre las disciplinas de colas classfull y classless es que mientras las
clasless nicamente pueden demorar, descartar y reprogramar (rescheduling) los
paquetes, las disciplinas de colas con clases pueden utilizar la clasificacin en un
perfil de trfico determinado para darle al paquete un tratamiento diferente. La
disciplina de colas seleccionada para el proyecto (H-FSC)[17], tiene una estructura
jerrquica de clases, que distribuye el ancho de banda entre clases hijas que a su
vez pueden tener otras hijas, creando una estructura de rbol donde el tronco
principal (root) representa el ancho de banda total del canal, los nodos de la ramas
representan clases internas y las clases en el nivel ms bajo de la jerarqua
llamadas clases hoja (leaf) representan un perfil de trfico en particular, en la
Figura 2.1 se muestran ejemplos de los diferentes tipos de clases , para hacer la
distribucin del ancho de banda de Internet de 8 Mbit/s entre dos edificios, se
distribuye el ancho de banda de edificio 2 entre VoIP y navegacin; esta ltima, a
su vez distribuye su ancho de banda entre programas P2P junto con sitios Web de
video (1.5 Mbit/s) y el resto de sitios Web junto con FTP (3.5 Mbit/s). Las clases
tienen nmeros de identificacin nicos y la clase raz siempre tiene el nmero de
identificacin 0.

31

Figura 2 .1 Ejemplo de disciplina de colas con clases en estructura jerrquica

Se utilizan las disciplinas de colas sin clases en los paquetes pertenecientes a


cada clase hoja para garantizar el QoS de mltiples conexiones simultneas, para
que no haya competencia de mejor esfuerzo en diferentes conexiones dentro de
una misma clase. En este proyecto se utiliz Stochastic Fairness Queueing (SFQ)
[18] que es una disciplina de colas sin clases que distribuye uniformemente el
ancho de banda entre conexiones diferenciadas por el conjunto de puerto fuente,
IP fuente e IP destino. Existen mejoras a este algoritmo como Enhanced Stochastic
Fairness Queueing (ESFQ) [16] que agregan caractersticas como discriminacin de
conexiones por otros campos de los encabezados, para mejorar an ms la
justicia en la distribucin.

Existen varias disciplinas de colas disponibles en Linux , y para seleccionar la


mejor para el proyecto, se escogi entre las que tienen estructura con clases:
Hierarchical Token Bucket (HTB) [9], Class Based Queueing (CBQ) [24] y Hierarcical
Fair Service Curve (H-FSC) [23] que fue la usada en este proyecto, en la Tabla 2.1
se muestra una comparacin entre estas tres disciplinas.
32

Tabla 2 .1 - Principales disciplinas de colas con clases.

Disciplina
Class-Based
Queueing (CBQ)
Hierarchichal Token
Bucket (HTB)

Hierarchical Fair
Service Curve
(H-FSC)

Ventajas

Bajo uso de
procesador.

Mejor manejo de
retardo que CBQ.
Bajo uso de
procesador.
Independencia del
manejo de velocidad
y de retardo para las
clases.

Desventajas
Problemas de
latencia.
Latencia
dependiente de
prioridad y de
velocidad.

Algoritmo complejo,
requiere ms uso de
procesador.

Se seleccion H-FSC debido a que provee mayor flexibilidad al manejar por


separado el retardo y la velocidad, permitiendo garantizar de forma ms especfica
los requerimientos de latencia que en los otros algoritmos. De esta manera, en
este proyecto, el control de tasa de transferencia y la estructura jerrquica de
clases la maneja la disciplina de colas H-FSC, mientras la distribucin del ancho
de banda en conexiones pertenecientes a una misma clase hoja H-FSC, se hace
con SFQ.

2.4

CURVA DE SERVICIO

El concepto de curva de servicio proviene del modelo ideal para uso compartido
de enlace con clases llamado FSC (Fair Service Curve) propuesto por Cruz [22].
Este modelo, permite controlar por separado la velocidad y el retardo para cada
clase en lugar de controlar nicamente la velocidad haciendo que el retardo sea
proporcional a ella (curva de servicio lineal). En los modelos de curva de servicio
lineal se pueden utilizar prioridades para aproximar el retardo al deseado, pero
usando una curva de servicio no-lineal, se especifica ms explcitamente el retardo
mximo requerido por el trfico de cada clase. En la arquitectura FSC, cada clase
est asociada a una curva de servicio y los requerimientos ms importantes del
modelo son:
33

Cada clase debe recibir una cantidad mnima de ancho de banda si hay
sobredemanda.
El exceso de ancho de banda no utilizado por una clase debe ser distribuido
entre sus clases hermanas de forma justa.

Figura 2 .2 Curvas de servicio lineal y no-lineal

Un ejemplo de curvas de servicio lineal y no lineal se muestra en la Figura 2.2, la


pendiente de los segmentos de recta son las velocidades instantneas de
transferencia. Como se observa en la curva de servicio lineal, la velocidad es
constante haciendo que el tiempo de respuesta dependa exclusivamente de la
velocidad de la clase; mientras que en la curva de servicio no lineal, se aumenta la
velocidad inicial de una conexin para alcanzar el tiempo de respuesta deseado y
se establece una velocidad diferente para el resto del trfico de la conexin. El
algoritmo utiliza contadores y timers para verificar el estado de actividad y la
velocidad actual de una conexin perteneciente a una clase.
Este modelo, es utilizado en la disciplina de colas H-FSC que se detallar en la
seccin 2.5 y representa la cantidad ideal de servicio que debe recibir una clase
respecto al tiempo, se usa como referencia o valor deseado para la tasa de
transferencia y latencia de cada clase. Cada curva se compone de 3 elementos: la
pendiente inicial (velocidad mxima para burst), el punto de inflexin (retardo
mximo) y la pendiente final (velocidad lmite).

34

El uso de clases del modelo FSC permite establecer curvas de servicio para varios
para flujos de datos diferenciados por valores del encabezado de las capas del
modelo OSI presentes en cada paquete. Cada clase representa una curva de
servicio que garantiza idealmente que todos los flujos de datos que pertenezcan a
ella reciban el servicio especificado por la curva.

2.5

LA DISCIPLINA

DE

COLAS

H-FSC (HIERARCHICAL

FAIR

SERVICE CURVE)
El algoritmo se describe en el paper [17] de Ion Stoica, Hui Zhang y Eugene Ng de
la universidad Carnegie Mellon en Pittsburg, USA. El algoritmo de curva de
servicio justa y jerrquica (H-FSC) est basado en una reparticin de los recursos
usando plizas (reglas) para diferenciar cada tipo de trfico. Se basa en el modelo
FSC, pero implementa una estructura jerrquica de clases, de las cuales se
pueden diferenciar los siguientes tipos como se muestra en la Figura 1.1:

Clase raz: no tiene padre y su velocidad es la mxima del enlace.


Clases internas: las que tienen hijas y padre.
Clases hoja: las que no tienen hijas.

Para satisfacer los requerimientos de latencia en las clases hoja, se utiliza el


ancho de banda no-usado total (criterio de tiempo real) mientras se distribuye el
ancho de banda no-usado de una clase padre entre sus clases hijas (criterio de
uso compartido).
Figura 2 .3 Estructura jerrquica de distribucin de ancho de banda

Fuente: [3]

35

Una clase representa un grupo de flujos de trfico que se someten a los mismos
lmites de velocidad y a los que se busca garantizar sus requerimientos de retardo.
En la Figura 2.3 se muestra una estructura jerrquica para la distribucin de un
canal de datos de 60Mbit/s, cada una de las conexiones, entre los nodos
mostrados, es una clase y se muestra para cada una su lmite de velocidad. A
parte del lmite de velocidad, cada clase tiene unos requerimientos de tiempo
dependientes del servicio que se clasifica; por ejemplo, en el momento en que se
est ocupando completamente el ancho de banda de todas las conexiones,
idealmente se debe garantizar que el trfico proveniente y con destino al
computador de audio (VoIP) cumpla con un retardo mnimo de 150ms que es la
recomendacin ITU-T G.114 para VoIP.
Los objetivos del algoritmo H-FSC son:

Garantizar la curva de servicio en todas las clases hoja.


Minimizar el error a corto plazo entre la velocidad configurada y la velocidad
usada.
Ubicar el ancho de banda entre las clases hermanas de manera justa.

El consumo de tiempo, por parte de la CPU, en algoritmo H-FSC se debe


principalmente a que cada vez que se recibe y clasifica un paquete, se calculan
tres variables para l:

Tiempo elegible (eligible time), se calcula para establecer el tiempo (en el


futuro) en el que cada clase debe comenzar a usar el criterio de tiempo real,
en lugar del criterio de uso compartido, mientras la clase se encuentre
activa; es decir, con paquetes en cola.

Tiempo lmite (deadline), se calcula como el tiempo mximo que una clase
hoja puede permanecer inactiva; es decir, sin paquetes en cola. Slo se
lleva cuenta de este tiempo en las clases hoja y sirve para garantizar que
stas reciban el retardo configurado, usando el criterio de tiempo real, si el
tiempo lmite se sobrepasa. Es decir, es el mximo tiempo entre paquetes
transmitidos antes de que se comience a usar el criterio de tiempo real.

Tiempo virtual, es una funcin del tiempo medido entre el ingreso de cada
paquete a la clase y su salida. Cada clase utiliza su tiempo virtual junto con
36

el de sus clases hermanas para hacer la distribucin de la curva de servicio


de su clase padre.
Con estas tres variables, el algoritmo determina el criterio a usar para el prximo
paquete recibido en cada clase. Con esto, se limita efectivamente la velocidad de
cada clase y se cumplen los requerimientos de tiempo, al ubicar el paquete en la
cola de salida directamente (criterio de tiempo real) o en la cola de la clase (uso
compartido).
El algoritmo H-FSC se consta de dos funciones:

2.5.1 Funcin

Se ejecuta cada vez que se clasifica un paquete recibido p en la clase i (ver


Algoritmo 1.3.1).

Algoritmo 1.1 Funcin r eceive_packet(i,p)

Fuente: [23]

La funcin
se ejecuta cuando se recibe un paquete y este
es clasificado en la clase debido a que los campos del encabezado del paquete
coinciden con los del perfil de trfico para esa clase . Esta funcin coloca en la
cola de la clase i el paquete ; si la clase no est activa, actualiza los valores del
tiempo elegible y el tiempo lmite (deadline) con la funcin
(ver Algoritmo 1.3), actualiza el tiempo virtual con la funcin
(ver
Algoritmo 1.5) y finalmente marca la clase como activa.

37

2.5.2 Funcin

Se llama cada vez que se enva un paquete y se usa para seleccionar el siguiente
a enviar entre todos los que se encuentran en cola (ver Algoritmo 1.2).
La funcin
se ejecuta cada vez que se termina de enviar un paquete.
Esta funcin retorna si la clase raz est inactiva. Pero si la clase raz est activa,
se establece si se debe usar el criterio de tiempo real, buscando la clase con el
mnimo tiempo lmite ( ) entre las que sean hoja, estn activas y tengan el tiempo
elegible menor o igual al actual.
Si se encuentra alguna clase que cumpla con esas caractersticas, se saca de la
cola el paquete , se actualiza el tiempo virtual con la funcin
y si
la cola qued vaca, la marca como inactiva; de lo contrario, actualiza el tiempo
elegible y el tiempo lmite de la clase con la funcin
.

Algoritmo 1.2 Funcin r eceive_packet(i,p)

Fuente: [23]

38

Si no se encontr ninguna clase con las caractersticas mencionadas, se utiliza el


criterio de enlace-compartido, el cual consiste en buscar entre las colas hijas
activas, la que tiene el menor tiempo virtual; entonces, se extrae un paquete de
ella, se actualiza el tiempo virtual de esa cola y, si la cola qued vaca, la marca
como inactiva; en caso contrario se actualiza el tiempo lmite para ella con la
funcin
(Algoritmo 1.2). Por ltimo tanto, si se us el criterio de tiempo
real como el de enlace-compartido para obtener el paquete , este se enva a la
cola de salida usando la funcin
.
Como se observa en la Algoritmo 1.3.2, la funcin
a diferencia de la
funcin
, actualiza la variable
que se usa para acumular la cantidad
de servicio en bytes que ha recibido la clase usando el criterio de tiempo real.

Algoritmo 1.3 - Funcin update_ed() y update_d()

Fuente: [23]

Para el manejo de los tiempos se utilizan dos tipos de curvas:


tiempo lmite y

para el tiempo elegible, donde

simo periodo que una clase

lleva activa. La curva

algoritmo mostrado en la Algoritmo 1.3


39

para el

representa el inicio del se calcula con el

Algoritmo 1.4 Algoritmo para calcular la curva Di

Fuente: [23]

Para el clculo de la curva


se utiliza la curva de servicio deseada , para
la clase , que se compone de las coordenadas de inflexin
y la pendiente
de los dos tramos de la curva
y
. La funcin
calcula los valores
e
que son las coordenadas de inflexin de la curva
. Esta curva se
calcula para que se pueda usar la funcin
, la cual calcula el tiempo
(coordenada
de la curva para los parmetros
y ), en las funciones
y
.

2.5.3 Funcin

Esta funcin calcula el tiempo virtual


para la clase (ver Algoritmo 1.4); este
tiempo es usado en la funcin
cuando se usa el criterio de enlace
compartido (ver Algoritmo 1.3.1). Este valor es denominado tiempo, pero en
realidad, hace referencia a la cantidad de servicio (bytes) normalizada que
idealmente la clase debera haber recibido para que en el tiempo actual se
garantice su curva de servicio. Por tanto, entre clases hermanas con diferentes
curvas de servicio, la normalizacin del tiempo virtual garantiza que se pueda
encontrar cul es la que menos se ha atendido; es decir, la que tiene el menor
tiempo virtual, sin importar si una de las hermanas tiene una velocidad muy alta y
otra una muy baja.
En la funcin
, el criterio de seleccin de la cola para sacar un
paquete con el criterio de enlace compartido, consiste en determinar la clase
activa que presente el menor tiempo virtual.
40

Algoritmo 1.5 - Funcin update_v()

Fuente: [23]

Como se observa en el Algoritmo 1.4, la funcin


es recursiva y
actualiza tanto su tiempo virtual como el de sus clases ancestros. El algoritmo
utiliza la funcin
, que es una funcin similar a
con la
diferencia de que en lugar de usar y , se usa el servicio total
y el tiempo
virtual de la clase padre de respectivamente.

2.6

LA DISCIPLINA DE COLAS SFQ (STOCHASTIC FAIRNESS


QUEUING)

Esta es una disciplina de colas sin clases , propuesta por John Nagle en 1987 [15];
Esta disciplina se usa para repartir de forma justa el ancho de banda entre las
conexiones existentes dentro de un flujo de trfico, como el perteneciente a una
clase hoja de H-FSC.
El algoritmo SFQ diferencia las conexiones presentes en el trfico utilizando el
conjunto de puerto fuente, IP fuente e IP destino. Cada vez que se presenta una
nueva conexin, el algoritmo genera una cola FIFO en la que se colocarn los
siguientes paquetes pertenecientes a ella; por ltimo se utiliza planeacin Round
robin para la salida de los paquetes, es decir se extrae un paquete de cada una de
las colas en orden circular entre las existentes, garantizando ancho de banda para
cada conexin y evitando que una sola pueda acaparar todo el ancho de banda.
Un diagrama del funcionamiento del algoritmo se muestra en la Figura 2.4.
41

Figura 2 .4 Ejemplo de funcionamiento de SFQ

Fuente: [21]

En la Figura 2.4 se pueden observar 8 flujos de datos diferentes que son


clasificados con el algoritmo SFQ en diferentes colas FIFO y programados para su
salida por el mecanismo llamado scheduler, que usa ordenamiento Round robin.
Este mtodo garantiza que se atienden todas las conexiones por igual sin importar
que una tenga pocos paquetes en cola y otra tenga muchos, haciendo que
ninguna se quede sin servicio.
El nico problema del algoritmo es que existe un lmite de colas FIFO que se
pueden crear; esto conlleva a que empiece a colocar ms de una conexin en
cada cola, afectando la justicia en casos de alto trfico con muchas conexiones.
Debido a esto, la implementacin de GNU/Linux (que soporta hasta 1024 colas de
128 paquetes) reordena los paquetes dentro de las colas cada 10 segundos por
defecto.
En este proyecto se utiliza SFQ en todas las clases hoja, para garantizar una
reparticin justa del ancho de banda en caso de que existan varias conexiones
dentro de una misma clase.

42

CAPITULO 3
DISEO E IMPLEMENTACIN DEL SISTEMA DE
CONTROL DE TRFICO EN REDES ETHERNET (SCTRE)

En este captulo se muestra el proceso de diseo de un sistema de control de


trfico usando un procesador de comunicaciones o NPU (Network Processing Unit).

3.1

PLATAFORMA DE HARDW ARE

Se selecciona una plataforma de hardware disponible y con un costo inferior a


USD 1.200, que adems permitiera utilizar procesadores de red, interfaces GbE
(Gigabit Ethernet) y optimizaciones para comunicaciones. Las nicas plataformas
de desarrollo que se ajustaron a los requerimientos mencionados fueron las de
arquitectura Freescale QorlQ, ya que los kits de desarrollo para las NPU de INTEL
EP80579 superaron ampliamente el presupuesto.
Para realizar el diseo e implementacin del SCTRE, se consideraron las boards
de referencia Freescale P2010RDB y P2020RDB-PA.
Se seleccion la board de referencia P2020RDB-PA (Figura 3.2) (USD 1.189
incluyendo impuestos y envo) debido a que tiene mayor capacidad de
procesamiento que la P2010; puesto que cuenta con un procesador de
comunicaciones Freescale QorlQ P2020 de doble ncleo (Figura 3.1), las siguientes
son las principales caractersticas del procesador:

Dos ncleos Power Architecture e500.


Direccionamiento de memoria de 36-bits.
Soporte para operaciones de punto flotante de doble precisin.
32 KB de cache L1 para cada ncleo.
Frecuencia de reloj entre 800 MHz y 1.2 GHz
512 KB de cache L2 con ECC configurable como memoria SRAM.
Tres controladores 10/100/1000 Mbps
Aceleracin de TCP/IP, QoS y clasificacin.
43

Cuatro interfaces SerDes a 3.125 GHz multiplexadas entre otros


controladores
Controlador USB 2.0.
Controlador Secure Digital mejorado (SD/MMC).
Serial peripheral interface.

Controlador de memoria SDRAM de 64-bit DDR2/DDR3.


Dos controladores DMA de cuatro canales.
16 pines de entrada/salida de propsito general.
Empaquetado: BGA de 689 pines (TEPBGA2)
Temperatura de operacin: 0C a 125C

Figura 3 .1 Procesador Freescale P2020

Fuente: [11]

Adems del procesador P2020 (Figura 3.1), la board del sistema incluye:

1GB de memoria RAM DDR2, 16MB de memoria flash NOR.


32 MB de memoria flash NAND.
1 interfaz mini-USB.
2 interfaces RS-232.
Ranura para memoria SD.
6 interfaces fsicas GbE (Gigabit Ethernet), 2 conectadas a sus
controladores y 4 conectados a un switch Vitesse.
Switch L2 (chip Vitesse VSC7385) internamente conectado a un
controlador GbE.
Conector JTAG/COP para debugging.
Conector ATX para alimentacin.
44

Ranura PCIe
Ranura mini-PCI

Figura 3 .2 - Fotografa de la board P2020RDB

Fuente: [11]

La PCB mide 17cm x 17 cm, tiene disipadores de calor y viene dentro de un chasis
de tamao mini-ITX con botones para encendido y reset, LED indicador de
encendido y conexin para la fuente de poder de 80W incluida, que tiene entrada
de 100V a 240V. Una fotografa de la board (sin disipador) se muestra en la Figura
3.2 y una del chasis en la Figura 3.3.

45

Figura 3 .3 - Chasis de Freescale P2020RDB-PA

Con la plataforma se incluye:

Memoria USB de 4GB precargada con imagen de arranque de Vanilla


Linux.
3 DVDs con la documentacin, esquemticos, generador de imgenes de
arranque para GNU/Linux LTIB y una imagen en formato Norton Ghost 11
de la memoria USB de arranque.
Cable para conexin seria RS232.
Cable ethernet (directo).
Cable de potencia para conectar a la fuente, la fuente de 80W tiene un
adaptador para conectarse al chasis del P2020RDB.
directamente el adaptador a la board.
CodeWarrior IDE (2 DVDs)
Adaptador con interfaz JTAG para hacer debugging.

La board utiliza soldadura sin plomo (ROHS) y tiene certificacin CE (obligatoria


para algunos productos en Europa) y certificacin FCC (Federal Comunicatios
Comission).

46

3.2

DISEO DE SOLUCIN DE SOFTW ARE

Para la implementacin del SCTRE en la plataforma P2020RDB, se utilizan


herramientas Open Source, lo que permite abaratar costos. A continuacin se
exponen los tipos de licencias de software para las herramientas utilizadas, luego
se muestra cul es la mejor interface de usuario para el nivel de conocimientos del
operador y se define un entorno de desarrollo , antes de mostrar el diseo de los
programas que se usaron para la implementacin.

3.2.1 Licencias.
Debido a al uso de libreras y herramientas con licencia GNU GPL, todo el
software realizado para la implementacin debe presentar este mismo tipo de
licencia y su cdigo fuente debe ser distribuido junto con los binarios generados o
debe estar pblicamente disponible en Internet. No se puede comercializar el
software desarrollado, pero el dispositivo si se podra comercializar y todos los
costos del producto final corresponderan a hard ware, soporte y otros servicios
usados para su produccin.
Todas las herramientas adicionales usadas para la realizacin del proyecto tienen
licencia GNU GPL Versin 2 [13], GNU GPL Versin 3 [12] o una licencia similar a
BSD [10] (open source ms abierto que GNU).

3.2.2 Seleccin del mtodo de desarrollo.


Se dispone de dos maneras para desarrollar soluciones de software en el
dispositivo:
Usando CodeWarrior IDE y desarrollando cdigo directamente para cada
ncleo de la board. Este mtodo se descart, debido a la complejidad y
extensin del cdigo necesario.
Usando GNU/Linux como sistema operativo. El uso de este sistema
operativo acorta el tiempo de desarrollo porque existe gran variedad de
47

aplicaciones disponibles, permite una fcil programacin de aplicaciones en


diferentes lenguajes y existe una implementacin estable del algoritmo
HFSC en el kernel 2.6.32.
Se decidi usar GNU/Linux para el sistema debido a las ventajas que tiene para
este proyecto, como: existencia de mltiples aplicaciones y soporte para HFSC.
El kernel de GNU/Linux 2.6.32, incluido en la memoria USB del sistema de
desarrollo, est compilado para ejecutar aplicaciones de 32bits con soporte para
SMP y durante la generacin de la imagen se le aplica automticamente un
parche para darle soporte al procesador P2020 y los dems dispositivos de la
board.

3.2.3 Interfaz de usuario.


El operador del SCTRE debera ser un ingeniero o un tcnico con conocimientos
bsicos de redes y conocimiento terico del funcionamiento del sistema de control
de trfico. El conocimiento de redes es necesario debido que el funcionamiento del
SCTRE est ligado a conceptos bsicos de redes, por tanto si el operador
desconoce estos conceptos, no podr hacer uso del SCTRE. El software de
SCTRE con el que interacta el operador se dividi en 4 partes:

Configuracin de parmetros del sistema: el sistema debe ser capaz de


configurar la IP, mscara de subred, rutas, servidor DHCP en la interfaz
LAN y cliente DHCP en la interfaz WAN (Internet).
Manejo de clases: el sistema debe tener la capacidad de adicionar, quitar
o editar clases con sus respectivos parmetros de velocidad garantizada,
velocidad mxima, retardo mximo y estructura jerrquica por escogencia
de clase padre.
Manejo de criterios: el sistema debe permitir el adicionar, quitar o editar
los criterios de clasificacin que consisten en uno o ms de los siguientes:
protocolo de capa 3 (IP o ICMP), protocolo de capa 4 (TCP o UDP), IP
fuente y/o destino, mscara de subred fuente y/o destino, puerto fuente o
destino (si se us protocolo TCP o UDP).
Caractersticas adicionales: debe tener capacidad de realizar
diagnsticos simples para problemas de conectividad.

48

Para que el operador del sistema configure el SCTRE se utilizan formularios web
para cada parte del programa, los cuales residen en un servidor web del equipo;
de esta manera, el operador puede acceder a los formularios desde su estacin de
trabajo conectada por red al SCTRE, evitando as el uso de cables de conexin
serial. El desarrollo del software de configuracin del sistema en un servidor web
disminuye el tiempo necesario para el aprendizaje de uso del dispositivo respecto
a la alternativa, que es la configuracin por medio de la lnea de comandos (que
tambin se encuentra parcialmente disponible).
Para el desarrollo de la aplicacin Web se utiliza PHP versin 5, lo que la hace
dinmica y proporciona conectividad con bases de datos, usa menos CPU que la
mquina virtual de java durante su ejecucin y es compatible con todos los
navegadores de Internet actuales.
Se decide usar el servidor Web Apache 2.2, puesto que tiene soporte para PHP, es
ampliamente usado, seguro, estable y fcil de usar en comparacin con otras
alternativas open source como Tomcat.
Tambin, se usa un motor de base de datos para almacenar la configuracin del
sistema, debido a que el nmero de clases o reglas puede llegar a ser grande
(superior a 1000 registros). El motor de base de datos seleccionado es SQLite,
pues cumple con los requerimientos del sistema de acceso local nicamente y
bajo consumo de CPU. SQLite solamente ejecuta el motor de bsqueda cuando el
driver del lenguaje de programacin manipula el archivo de base de datos. Por
razones de compatibilidad con PHP5 se seleccion la versin 2 de SQLite en lugar
de la versin 3.

3.2.4 Funcionamiento del SCTRE.


Se us el lenguaje de programacin C (ANSI C 89) debido a que existen libreras
para este lenguaje que permiten el uso de SQLite, lo que facilita el desarrollo de los
programas que generan los comandos necesarios para hacer el control de trfico
a partir de la base de datos.
Tambin se utiliz el lenguaje de programacin Shell script (sh) para realizar la
secuencia de alto nivel que reconfigura el dispositivo, como el establecimiento de
las IP de las interfaces de red y rutas, y la ejecucin de comandos generados para
la puesta en marcha del SCTRE.
49

Los componentes de software del sistema son los siguientes:

Sistema operativo GNU/Linux con soporte para el algoritmo HFSC.


Servidor Web Apache Versin 2.2.

PHP versin 5.
SQLite Versin 2.
Programas en lenguaje C para generar los comandos para control de
trfico.
Programas en Shell script para organizar las diferentes etapas de
configuracin y puesta en marcha.

Como se muestra en la Figura 3.4, el usuario tiene acceso va Web a la interfaz en


PHP para configuracin, diagnstico y puesta en marcha del equipo. Esta interfaz
Web se conecta al servidor SQLite por medio de lenguaje SQL (Structured Query
Language) para revisar o modificar la configuracin del sistema. Desde la interfaz
Web, el usuario tambin puede ejecutar los comandos ping y traceroute usados
para realizar diagnsticos del funcionamiento de la red.

Figura 3 .4 - Esquema general del sistema de control de trfico de redes ethernet (SCTRE) .

50

Cuando el usuario ha terminado de configurar el sistema y desea aplicar los


cambios realizados, se presiona el botn si en una pantalla de confirmacin,
entonces se ejecuta el Shell script aplicarcambios.sh (ver Anexo A.1) que remueve
las reglas de control de trfico existentes y luego ejecuta un conjunto de
programas realizados en C, que se han llamado "generadores de comandos".
Los generadores de comandos (ver seccin 3.4.10 a 3.4.14) se comunican con la
base de datos y generan otros Shell scripts que se ejecutan al final de
aplicarcambios.sh y contienen los comandos necesarios para configurar los
parmetros de red del sistema y para adicionar reglas de control de trfico.
Se necesitan dos interfaces de red para realizar la funcin de control de trfico y
su funcionamiento normal es similar al de un router con la adicin del control de
trfico.
La interfaz eth0 se asigna como interfaz LAN debido a que la plataforma
P2020RDB tiene un switch de 4 puertos en esta interfaz y de esta manera se
pueden conectar hasta 4 dispositivos a ella sin usar un switch externo. La interfaz
eth1 se usa como WAN. Esta configuracin de hardware se muestra en la Figura
3.5.
Figura 3 .5 Configur acin de interfaces de SCTRE

En la Figura 3.5, se observan las 4 interfaces PHY del switch integrado de 4


puertos; los 4 estn conectados al controlador del puerto GbE llamado eth0 que se
51

configur para conectar los equipos de LAN. La interfaz PHY eth1 est conectada
al manejador del puerto GbE llamado eth1 que debe estar conectado a internet o
una red diferente a LAN. La interfaz eth1 fue llamada interfaz WAN y eth0 (con sus
4 puertos) se denomin interfaz LAN

3.2.5 Diseo e implementacin de entorno de desarrollo.


La imagen de GNU/Linux precargada en el kit de desarrollo contiene un servidor
FTP, un servidor Secure shell y un servidor de una aplicacin llamada APPTRK, que
se necesita en caso de usar el CodeWarrior IDE como entorno de desarrollo.
Se dise un entorno de desarrollo propio, en lugar de usar CodeWarrior IDE, debido
a que no se utiliza nicamente lenguaje C sino adems PHP, Shell script (sh) y
SQL. El entorno de desarrollo diseado se adapta a las necesidades del proyecto
usando solo herramientas OpenSource y realiza todas las tareas necesarias para
poner en funcionamiento los diferentes programas que conforman el SCTRE a
partir de
sus
cdigos
fuente
incluyendo: cambio
de
permisos,
creacin/modificacin de bases de datos y copia de archivos a su ubicacin fi nal.
Para la conexin por Command Line Interface (CLI) al SCTRE se utiliz Secure Shell
(SSH) en lugar de conexin directa por cable serial, debido a que SSH permite
ejecutar varias consolas del SCTRE simultneamente en lugar de una sola como
ocurre con la conexin serial y adems provee seguridad mejorada respecto a
otras alternativas como telnet.
El entorno de desarrollo en la estacin de trabajo usa:

Editor de texto (MadEdit) para hacer todos los archivos de cdigo fuente.
Cliente FTP (WinSCP).

Cliente SSH para conectarse por CLI al SCTRE (Putty).

En el SCTRE, el entorno de desarrollo utiliza:

Servidor FTP (ftpd 1.4.2)


Compilador de C (GNU gcc 4.3.2)

Servidor Web (Apache 2.2)


PHP 5
52

Servidor SSH (Dropbear sshd 0.52)


Varias otras aplicaciones estndar para GNU/Linux.

Todos estos programas, exceptuando el servidor Web y PHP 5, vienen preinstalados en la distribucin de GNU/Linux por defecto de la memoria USB incluida
en el sistema de desarrollo P2020RDB.
El cdigo se desarroll en Windows XP/7 debido a que es el que tenemos
disponible, y se transfiri el cdigo para compilacin e instalacin a la plataforma
P2020 con Linux.
Contando con que el sistema operativo y las aplicaciones en la plataforma
P2020RDB se encuentra correctamente instalados y configurados con sus valores
por defecto, todo el proceso de desarrollo se realiza en tres etapas:
1. En la estacin de trabajo se usa el editor MadEdit y con l se edita el cdigo
de PHP, SQL C, y Shell script.
2. Todos los cdigos fuente que se quieran agregar o modificar se transfieren
de la estacin de trabajo a un s lo directorio (/root) en el SCTR usando
WinSCP.
3. En el SCTRE se ejecuta un shell script que realiza todas las tareas
necesarias para realizar la actualizacin del sistema dejndolo listo para
realizar pruebas o debugging.

El script de la tercera etapa se implementa en el programa sync.sh y realiza las


siguientes tareas:

Compila todos los cdigos de C y genera todas las advertencias para


debugging.
Copia los ejecutables generados a su ubicacin final en /usr/sbin/
Copia los archivos con extensin .sh (Shell script) a /usr/sbin/
Otorga permiso de ejecucin a los archivos de Shell script en /usr/sbin/
Borra los archivos de base de datos de SQLite con extensin .sqlite2 de
/var/www/
53

Ejecuta, usando SQLite, los scripts de SQL (con extensin .sql) para crear
de nuevo las bases de datos en /var/www/

Este script se ubic en /usr/sbin/ y se le garantizaron permisos de ejecucin con el


comando:
chmod +x /usr/sbin/sync.sh
Ya que el directorio /usr/sbin se encuentra en el PATH por defecto, sync.sh puede
ser ejecutado desde cualquier ubicacin y si no se desea alguno de los pasos del
script, se puede comentar el comando correspondiente en el archivo ubicado en
/usr/sbin/sync.sh.

3.3

CREACIN DE SISTEMA BASE

Se crea un sistema base en la memoria USB de arranque, la cual contiene


GNU/Linux y varias aplicaciones necesarias para el desarrollo de software. Para
esto, se genera una imagen de GNU/Linux con el kernel configurado para soportar
HFSC y otros requerimientos del SCTRE.
Una imagen de GNU/Linux es un archivo que contiene todas las particiones,
directorios y archivos utilizados por el sistema operativo; las imgenes incluidas en
el kit de desarrollo vienen en formato Ghost y se necesita Norton Ghost 11 12
para grabarlas en la memoria USB bajo Windows.
Freescale provee un "GNU/Linux Target Image Builder" (LTIB) que es un conjunto de
herramientas para GNU/Linux que se instalan en un equipo de desarrollo y facilitan
la creacin de imgenes de GNU/Linux para su instalacin en diferentes tipos de
memoria de sistemas embebidos incluyendo medios extrables.
LTIB crea una imagen con dos particiones en la memoria USB: una tipo GNU/Linux
SWAP usada para la memoria virtual de GNU/Linux y la otra tipo GNU/Linux EXT3
montada en el directorio raz, que contiene el sistema de archivos. Adems genera
un directorio (rootfs) donde queda una copia del contenido del directorio raz de la
imagen; por lo tanto, se pueden tomar archivos de este directorio y copiarlos a una
memoria USB de arranque sin necesidad de grabar la imagen generada a la
memoria, reduciendo el tiempo para probar configuraciones.

54

La plataforma P2020RDB tiene un puerto mini-USB al que se conecta una


memoria USB estndar que contiene la imagen generada.

3.3.1 Instalacin de LTIB.


Se instala GNU/Linux Debian 5.0 en un computador, debido a que LTIB es un
paquete para GNU/Linux y en su manual se lista Debian como una distribucin
probada. Luego se instala LTIB en el directorio /ltib usando el comando:
/media/cdrom/install
Durante la instalacin se usaron los valores por defecto, excepto para el directorio
de instalacin (/ltib), luego se ejecuta el comando /ltib/ltib para que se autoconfigure por primera vez.

3.3.2 Generacin de imagen de GNU/LINUX.


Para generar la imagen se ejecuta el comando:
/ltib/ltib configure

El parmetro configure muestra un men de configuracin (ver Figura 3.6), en


ste se activa la casilla para configurar el kernel; luego, en la pantalla de
configuracin de kernel se buscan y seleccionan los mdulos que son
prerrequisitos para el uso del algoritmo de control de trfico HFSC, iproute2 e
iptables. El listado de mdulos configurados en el kernel se puede encontrar el
archivo /boot/linux.conf.
Con la imagen generada se copia todo el directorio "rootfs/boot" creado por LTIB,
sobrescribiendo el directorio "boot" de la memoria USB, esta accin actualiza los
archivos del kernel sin borrar configuraciones y ni las aplicaciones instaladas por
el usuario. Para una versin de produccin del producto se debera usar la
memoria SD en lugar de la memoria USB.

55

Figura 3 .6 Configur acin de LTIB

En la figura 3.6 se muestra una captura de pantalla de la configuracin de LTIB en


el men de seleccin de aplicaciones que se instalarn en la imagen.
Dado que la plataforma ya tiene un backup de la memoria USB en DVD, no hubo
necesidad de crear una copia de seguridad de la memoria USB antes de
modificarla.

3.3.3 Instalacin de aplicaciones.


Todos los paquetes usados se instala n de la misma manera usando los
comandos:
tar -xzvf <archivo>.tar.gz
cd <archivo>
./configure --prefix=/usr
make
make install
rmdir <archivo>

56

Donde <archivo> es el nombre del archivo descargado sin la extensin .tar.gz.


Se reinstan algunas de las aplicaciones pre-instaladas para garantizar la
estabilidad y seguridad, esto debido a que eran versiones antiguas.
En la Tabla 3.1 se muestran las aplicaciones usadas en orden de instalacin,
tambin se muestran las versiones instaladas y una descripcin que detalla el uso
de cada aplicacin en el proyecto.
Tabla 3 .1- Aplicaciones usadas para el proye cto
Nombre

Versin

Descripcin y uso en el proyecto

SQLite

2.8.17

Motor de base de datos para consultas locales, consiste en una


aplicacin llamada sqlite ubicada en /usr/bin/ para hacer
consultas por CLI y un API para C. Se us para almacenar la
configuracin del SCTRE.

Apache

2.2.16

Servidor Web, el directorio raz del servidor por defecto es


/var/www/, se us para implementar la interfaz de configuracin
va Web.

5.3

Permite ejecutar el cdigo de PHP incrustado en una pgina


Web, se configur Apache para que procese las peticiones de
PHP. Se us para implementar la interfaz de configuracin va
Web.

2.6.35

Es un conjunto de herramientas para manejo de las interfaces de


red y el proceso de ruteo con soporte en el kernel de GNU/Linux.
En el proyecto se utiliza porque una de sus funcionalidades
implementa el algoritmo HFSC y el manejo de sus clases.

iptables

1.4.2

Este programa se encarga de la manipulacin de paquetes,


entre sus funcionalidades est realizar NAT y clasificar
paquetes, adems provee funcionalidad de firewall por defecto
del sistema..

Perl

5.8.8

Usado por que facilita la generacin del formato de la pgina de


salida de un comando de consola, como los que se generan
desde la interfaz WEB.

PHP

iproute2

3.4 SOFTW ARE DESARROLLADO


Se crea la base de datos en el sistema embebido, la cual ser accedida a travs
de una interfaz escrita en PHP. Esta interfaz tambin permite hacer debugging y
pruebas usando los registros de la base de datos. Por ltimo se realizaron los
57

generadores de comandos, que son programas en C que generan Shell scripts de


configuracin que se ejecutan por aplicarcambios.sh.

3.4.1 Bases de datos.


Bases de datos Se usan dos archivos de bases de datos para tener por separado
la configuracin del sistema y las reglas de control de trfico. Esto es til debido a
que, al SQLite almacenar cada base de datos en un nico archivo, se puede
guardar o restaurar cualquiera de las dos bases de datos sin interferir con la otra.
La base de datos de clases y reglas del SCTRE se llama control.sqlite2 y la base
de datos de configuracin, incluyendo rutas estticas, se encuentra en el archivo
llamado config.sqlite2; ambos ubicados en el directorio /var/www/.
Los scripts de SQL que crean las tablas de las dos bases de datos son ejecutados
en sqlite2 usando el comando "sqlite init <archivo.sql>", esto se hace cada vez que
se actualiza alguno de de los archivos del cdigo fuente con el comando sync.sh.
La estructura de la base de datos config.sqlite2 se muestra en la Tabla 3.2.
Tabla 3 .2 Estructura de la base de datos de configuracin

58

La base de datos config.sqlite2 contiene dos tablas:

t_cf_config, donde se almacenan los campos necesarios para la configuracin


de las interfaces de red, cliente DHCP y NAT.
t_cf_rutas, que contiene los campos que conforman una ruta esttica; es
decir, direccin IP de red, mscara de subred y prximo salto.

La estructura de la base de datos control.sqlite2 se muestra en la Tabla 3.3.


Tabla 3 .3 Estructura de la base de datos de control

La base de datos control.sqlite2 contiene dos tablas:

t_cl_clases, que almacena los campos para el identificador nico de la clase,


velocidad garantizada, mxima velocidad, retardo mximo entre otros.
59

t_cl_criterios, que almacena los campos que componen un criterio de


clasificacin como: protocolos, IP fuente, mscara fuente, IP destino, puertos,
entre otros.

3.4.2 Interfaz WEB.


La interfaz PHP permite modificar los registros en las bases de datos y mostrar los
campos de los diferentes formularios con valores almacenados en la base de
datos.
Cuando la base de datos de configuracin est vaca, es decir en caso de que se
borre la configuracin, se inserta un registro de configuracin con los siguientes
valores por defecto:
Interfaz LAN:

Direccin IP: 192.168.0.1


Mscara de subred: 255.255.255.0

Interfaz WAN:

Activa configuracin por cliente DHCP para obtener acceso a Internet si


est disponible.
Activa NAT.
Su acceso se realiza a travs de SSH o por puerto serial (115200bps,8bits,
sin paridad):
Password de acceso: admin
Password de root: root

Para configurar el dispositivo, el usuario debe conectarse al puerto LAN, con un


cable directo usando un switch; posteriormente, se debe acceder con un
navegador Web, a la direccin IP de LAN configurada en el SCTRE.
Dentro de todos los programas de procesamiento de formularios, se usan rutinas
para detectar caracteres invlidos (parsing) en los campos de texto, con el fin de
evitar inyeccin de SQL y posibles errores.
60

Todos los archivos de PHP se ubican en el directorio /var/www/, y tienen un


encabezado con el logo de la Universidad San Buenaventura - Cali, el ttulo del
proyecto y los nombres de los autores. En la parte izquierda se agreg un men
de navegacin que permite un acceso rpido a todas las caractersticas del
sistema. En la Figura 3.7 se muestra un diagrama de los componentes de la
interfaz Web.
Figura 3 .7 Diagrama de la interfaz Web

El archivo index.php se sirve por defecto en el servidor Web; como se observa en


la Figura 3.7, se puede acceder cualquier pgina de la interfaz desde otra usando
el men, y cada una usa programas diferentes para manejar la interaccin con el
usuario.
Se implementa un sistema de inicio de sesin con password en el que todas las
pginas verifican si existe la variable de sesin s_actual y que su valor es 1 para
mostrar el resto de su contenido. En caso contrario se redirecciona al usuario a la
pgina login.html que es un formulario con un campo para password y un botn que
redirige al programa login.php que consulta la base de datos config.sqlite2 para
verificar si el password de administrador coincide con el almacenado, si coincide,
inicia una sesin, registra la variable s_actual=1 y vuelve a la pgina inicial. De esta
61

manera se garantiza que se cierra la sesin y se vuelve a pedir el password cada


vez que se sale del navegador, el password por defecto es "admin".

3.4.2.1 Configuracin LAN.


Para configurar la interfaz LAN se utiliza el programa lan.php. Este programa
contiene el cdigo en HTML necesario para mostrar el men de opciones y el
encabezado, adems incluye un formulario que consta de campos de texto para la
direccin IP de LAN, mscara de subred, un campo de seleccin para activar el
servidor DHCP y un botn para guardar los cambios como se muestra en la Figura
3.8.
Figura 3 .8 - Captura de la pantalla de configuracin LAN

El programa se conecta a la base de datos config.sqlite2 ubicada /var/www/ y


consulta los campos correspondientes para llenar con sus valores iniciales los
diferentes campos del formulario.
Cuando se presiona el botn de guardar cambios se llama al programa
guardarconfiglan.php que realiza una conexin a la base de datos config.sqlite2 y
realiza una consulta que actualiza la base de datos con los valores introducidos en
el formulario previa verificacin de que no contienen errores y se redirecciona a la
pgina de configuracin LAN.
Los cdigos fuente de los programas son lan.php y guardarconfiglan.php.
62

3.4.2.2 Configuracin WAN.


El programa wan.php crea el formulario de configuracin de la interfaz WAN. Este
contiene el cdigo en HTML necesario para mostrar el men de opciones, el
encabezado en la parte superior y adems un formulario que tiene campos de
texto para la direccin IP de WAN, mscara de subred, puerta de enlace, DNS
primario y DNS secundario, un campo de seleccin para activar el configuracin
por DHCP y un botn para guardar los cambios como se muestra en la Figura 3.9.
Figura 3 .9 - Pantalla de configur acin WAN

El cdigo en PHP de la pgina hace lo mismo que en la configuracin LAN, pero


se utiliza el archivo guardarconfigwan.php para guardar los campos necesarios en
la base de datos config.sqlite2.
Los cdigos fuente de los programas son wan.phpguardarconfigwan.php.

3.4.2.3 Manejo de rutas estticas.


El programa rutas.php realiza la configuracin de rutas estticas y contiene
adems del men estndar, un formulario con los campos necesarios para
adicionar una nueva ruta de IPV4, es decir, la direccin IP de red, mscara de
subred, direccin IP de prximo salto y un botn para adicionar una ruta. Abajo del
formulario se muestra un listado generado con PHP de las rutas estticas
actualmente configuradas, cada una con un enlace para su modificacin o
eliminacin, la pgina se muestra en la Figura 3.10.
63

Figura 3 .10 - Pantalla de configur acin de rutas estticas

Se utiliza el archivo nuevaruta.php para guardar los campos necesarios en la base


de datos config.sqlite2. El archivo eliminarruta.php elimina un registro y el archivo
modificarruta.php modifica una ruta existente usando un formulario similar al usado
para agregar una nueva ruta.
Los cdigos fuente de los programas usados son rutas.php, nuevaruta.php,
eliminarruta.php y modificarruta.php.

3.4.2.4 Manejo de clases.


Para el manejo de clases se crea el programa clases.php que contiene el men y
encabezado estndar adems de un formulario para adicionar una nueva clase
con una caja de seleccin para escoger si la clase es para trfico de subida o de
bajada y campos de texto para el nmero de identificacin de la clase padre (0 si
su padre es la clase raz), la velocidad garantizada en Kbits/s, el retardo en ms
(opcional), la velocidad mxima (opcional) y un botn para agregar la clase, el
botn llama al programa agregarclase.php que guarda los datos del formulario en
la base de datos control.sqlite2. Bajo el formulario se gener un listado de las
clases existentes con enlaces para modificar o eliminar cada clase. La pgina del
listado de clases se muestra en la Figura 3.11.
64

Figura 3 .11 - Pantalla de manejo de clases

Se realizaron archivos adicionales para realizar las consultas de SQL necesarias


para agregar, modificar y eliminar las clases, sus cdigos fuente se encuentran en
los Anexos: B.10 (agregarclase.php), B.11 (modificarclase.php) y B.12
(eliminarclase.php).

3.4.2.5 Manejo de reglas.


El manejo de reglas se implementa en el archivo reglas.php, que tiene adems del
men estndar, un enlace para crear una nueva regla y genera la lista de reglas
actuales (Figura 3.12), cada una con un enlace para su modificacin o eliminacin.

65

Figura 3 .12 - Listado de reglas existentes

El enlace "Agregar criterio de clasificacin" apunta al archivo agregaregla.php que


se muestra en la Figura 3.13 y contiene un formulario con los campos opcionales
para componer una regla:

IP fuente
IP destino
Mascara de subred fuente
Mascara de subred destino
Protocolo (IP, ICMP, TCP o UDP), obligatorio.
Puerto fuente
Puerto destino
Clase a la que se asignarn los paquetes que coincidan con estos criterios
(obligatorio).

Si la regla es invlida, por ejemplo protocolo ICMP con puerto destino, no se


aplica. Si no se especifica ninguno de los campos opcionales, se clasifica todo el
trfico que coincida con el protocolo escogido.
Al final del formulario hay un botn para guardar la regla, este llama al programa
nuevocriterio.php que toma los datos de los campos del formulario y los guarda en
la base de datos control.sqlite2.
66

Figura 3 .13 - Formulario de adicin/modificacin de reglas

Los cdigos fuente se encuentran adjuntos en los anexos reglaslistas.php,


agregaregla.php, nuevocriterio.php, o modificarcriterio.php y eliminarcriterio.php.

3.4.2.6 Herramientas de diagnstico.


Se crean interfaces Web para dos herramientas de diagnstico: ping y traceroute.
La pgina de ping.html tiene un formulario con campos de texto para la direccin,
nmero de pings y un botn para iniciar. Al oprimir el botn, los datos del
formulario se envan como parmetros al programa ping.php que es el encargado
de ejecutar el comando ping e imprimir sus resultados en HTML.
La pgina traceroute.php funciona de forma similar, pero los campos de texto son
para la direccin y el TTL (Time To Live).
Los archivos usados son ping.html, ping.pl, traceroute.html y traceroute.pl.

67

3.4.2.7 Aplicar cambios.


Se genera una pgina de confirmacin antes de aplicar los cambios, la pgina
aplicarcambios.html muestra el texto que pregunta si el usuario est seguro de
aplicar cambios y dos botones; con el botn si se llama al programa
aplicarcambios.php, que ejecuta aplicarcambios.sh para realizar la secuencia de
reinicio del control de trfico con los nuevos cambios; con el botn "No" se
redirecciona a la pgina anterior sin aplicar los cambios.

3.4.2.8 Reiniciar y restaurar valores por defecto.


Se crean las pginas de confirmacin para ambos eventos, las dos pginas
contienen un dialogo de confirmacin similar al de aplicar cambios. Al seleccionar
"si" en reiniciar.html se ejecuta un comando que reinicia la mquina ( shutdown -r
now ), y al seleccionar "si" en la pgina restaurarvalores.html se ejecuta el shellscript
restaurarvalores.sh, que borra las bases de datos, las crea de nuevo y redirige a la
pgina wan.php.

3.4.3 Generador de comandos.


Estos programas generan los comandos de iproute, iptables y net-tools,
necesarios para configurar el sistema, para este propsito, utilizan las bases de
datos. Se inician desde CLI con el comando: /usr/sbin/aplicarcambios.sh y desde la
interfaz Web en la pgina aplicarcambios.html. En la Figura 3.14 se muestra un
diagrama de funcionamiento del generador de comandos.

68

Figura 3 .14 Funcionamiento de generador de comandos

Como se observa en la Figura 3.14, el script aplicarcambios.sh ejecuta


secuencialmente otros scripts, que utilizan los programas descritos para generar
un archivo temporal de comandos que se ejecuta en cada etapa. Se dise el
generador de comandos en etapas usando scripts diferentes, para que se pueda
manejar el sistema por CLI. A continuacin se describe cada parte del generador
de comandos.

3.4.3.1 Generador de clases.


El generador de clases, genclases.c, es un programa en lenguaje C que consulta en
la base de datos control.sqlite2 en la tabla t_cl_clases los parmetros de cada clase
(velocidad, lmite mximo, nmero de identificacin de clase padre, retardo) y
genera un shell script, con los comandos de la aplicacin iproute2, los cuales crean
la clase con la ubicacin jerrquica deseada dependiendo del nmero de
identificacin de clase padre.
El comando generado para cada clase consiste en la aplicacin llamada tc
(perteneciente a iproute2) con varios parmetros que se obtienen a partir de los
valores de los campos de la base de datos. Cada comando crea la clase nueva de
tipo HFSC con un identificador de clase igual al consultado en la base de datos
69

(que es un nmero nico dentro de toda la tabla de clases), adems en esta lnea
se adiciona la clase a la estructura jerrquica usando el campo id del padre. El
resto de los parmetros generados corresponden a la velocidad garantizada, lmite
superior y retardo.

3.4.3.2 Generador de criterios.


Este programa gencriterios.c, se desarrolla para consultar la base de datos
control.sqlite2 en la tabla t_cr_criterios, para obtener los diferentes parmetros
opcionales que actualmente se pueden usar en iptables como parte de una regla,
estos son:

Protocolo de capa 3 (IP/ICMP)


Protocolo de capa 4(TCP/UDP)
IP fuente
Mscara de subred fuente
IP destino
Mscara de subred destino
Puerto fuente
Puerto destino
El nmero de identificacin de la clase de destino (no opcional).

Despus de la consulta, ejecuta un algoritmo que para cada registro de la tabla


t_cr_criterios, genera los diferentes parmetros de la aplicacin iptables que
clasifican el trfico en la clase deseada.

3.4.3.3 Generador de QDISCS para CLASES LEAF.


Una clase puede contener diferentes tipos de trfico al mismo tiempo, es decir
varios criterios pueden clasificarse en una sola clase, por tanto se pueden tener
varias conexiones diferentes ocurriendo dentro de una misma clase y existe la
probabilidad de que alguna de ellas ocupe toda la velocidad disponible.
Para que el trfico dentro de una clase se distribuya de manera justa entre el
nmero de conexiones diferentes existentes, se debe crear un qdisc (disciplina de
colas) que realice esta tarea independientemente de HFSC. Esta disciplina de
colas puede ser de varios tipos, entre los cuales estn FIFO y Weighted Round
70

Robin (WRR), pero se decidi usar Stochastic Fairness Queuing (SFQ) debido a
que sta puede controlar el ancho de banda de las conexiones existentes en el
trfico como conjunto de IP fuente, IP destino y puerto fuente, distribuyendo
equitativamente el ancho de banda entre ellas.
Los qdiscs SFQ se deben crear nicamente para las clases leaf (las que no
tengan clases hijas). El programa iproute2, provee un mecanismo para que no se
sobrescriba por error una clase si tiene hijas, por tanto en los programas,
simplemente se generan comandos para todas las clases e iproute crea el dqisc
para las clases que no tengan hijas nicamente.
Se elabora el programa genqdiscs.c para crear los comandos de iproute2. Parte de
una consulta a la base de datos en la tabla de clases (t_cl_clases) y para cada
identificador de clases imprime el mismo comando variando nicamente el nmero
de identificacin de la clase.

3.4.3.4 Generador de configuracin.


Este programa (genconfig.c, Anexo C.4) se realiza como los anteriores para
generar comandos, pero se conecta con la base de datos de configuracin
llamada config.sqlite2 y genera a partir de la consulta, los comandos de
reconfiguracin de los siguientes parmetros del sistema:

Direccin IP de interfaces LAN y WAN


Mscaras de subred
Puerta de enlace de interfaz WAN
DNS para la interfaz WAN
Se puede usar configuracin por DHCP en la interfaz WAN.

Los comandos generados se guardan en un archivo temporal que es ejecutado,


estos comandos usan los programas de de GNU/Linux: ifconfig, echo y dhcpclient.

3.4.3.5 Generador de rutas estticas.


Se crea el programa genrutas.c (Anexo C.5) que se conecta a la base de datos
config.sqlite2 a la tabla t_cf_rutas, para consultar los datos necesarios para la
generacin de los comandos que establecen las rutas estticas introducidas por el
usuario (si existen).
71

3.4.3.6 El SHELL SCRIPT aplicarcambios.sh.


Este script se elabora para reconfigurar las interfaces de red utilizando la base de
datos de config.sqlite2 y reconfigura el sistema de control de trfico usando la base
de datos de control.sqlite2.
Hace lo siguiente:

Aplica la configuracin de red de las interfaces LAN y WAN usando el script


conflanwan.sh mostrado en el Anexo A.9.
Borra las clases y reglas existentes, luego habilita la funcin de router
modificando la variable del sistema ipv4_forward, el script que hace este
procedimiento se llama doflush.sh y se muestra en el Anexo A.4.
Crea las rutas estticas a partir de la base de datos config.sqlite2 usando el
script crearrutas.sh (Anexo A.5) que borra todas las rutas y usa el generador
realizado en C para hacer un archivo temporal con los comandos
necesarios para crearlas, otorga permiso de ejecucin al archivo temporal y
luego lo ejecuta.
Usando el script crearqdiscs.sh (Anexo A.6) que crea los qdiscs HFSC root
para la interfaz LAN y la interfaz WAN.
Genera las clases usando la base de datos control.sqlite2 usando el
comando crearclases.sh (Anexo A.7) que utiliza al programa genclases.c
(Anexo D.1) para realizar las consultas a la base de datos.
Genera las reglas usando la base de datos control.sqlite2 y se usa el script
crearcriterios.sh (Anexo A.8) para realizar las consultas (usa el programa
gencriterios.c (Anexo D.2).
Crea qdiscs SFQ para las clases leaf usando el script crearsfq.sh (Anexo
A.10) que utiliza a genqdiscs.c (Anexo D.3) y ejecuta los comandos que este
produce.
Imprime que los cambios se realizaron exitosamente.

3.4.4 Scripts de inicio y documentacin.


Se hacen scripts para configurar la ejecucin automtica de algunos programas
despus de un reinicio de la siguiente manera:
72

Se edit el archivo /etc/rc.d/rc.conf y se agreg el nombre del programa al


final de cada una de las cuatro primeras lneas.
Se cre un archivo en el directorio /etc/rc.d/init.d/ con el mismo nombre que
se agreg en el paso anterior que permita al equipo iniciar el proceso
cuando su primer parmetro es "start", lo que se hace al reiniciar, y
terminarlo si es "stop", como se hace durante la secuencia de apagado. Se
utiliz como plantilla para cada uno de los programas necesarios uno de los
archivos de servicios existentes (/etc/rc.d/init.d/portmap) sustituyendo los
comandos necesarios.
Se us el comando: "chmod +x nombredearchivo" para activar el permiso de
ejecucin del archivo.

De esta manera se agregaron scripts para que se inicie automticamente el


servidor apache2 y para aplicarcambios.sh.
Se cre un manual de usuario donde se explican los pasos a seguir para instalar y
configurar el SCTRE (Anexo A)

73

74

CAPITULO 4
PRUEBAS DE FUNCIONAMIENTO

Se realizaron mediciones con el objetivo de verificar la limitacin de tasa de


transferencia, y estimar el nmero mximo de reglas que el sistema puede usar.
No se busca el nmero mximo de clases, ya que stas afectan menos el
consumo de CPU en relacin a las reglas; debido a que cuando se recibe un
paquete, se actualiza una sola clase, y en algunos casos sus ancestros, mientras
que las reglas se deben evaluar todas hasta que alguna coincida con cada
paquete.
Se hicieron las pruebas generando un trfico de velocidad constante, que llen en
su totalidad el ancho de banda de las clases configuradas para simular el peor
escenario. Luego, se realizaron mediciones de tiempo de respuesta con un
nmero incremental de reglas. Adems se midi el consumo de CPU y memoria
RAM para observar cul de estos dos factores es el que limita el nmero de
reglas.

4.1

ESTRUCTURA DEL SISTEMA DE PRUEBAS

Se usan tres computadores para la realizacin de las pruebas, dos de ellos


conectados al switch de la interfaz LAN y el otro conectado a la interfaz WAN
como se muestra en la Figura 4.1, en ella se observa que los computadores A y B
se comunican a velocidad constante de subida (40Mbit/s) y bajada (100Mbit/s)
durante toda la prueba usando un generador de trfico en cada uno. Mientras el
computador C es utilizado para enviar paquetes al computador A y medir el tiempo
de retardo de los paquetes de respuesta. Se gener trfico TCP con puerto de
destino 80 a 84 en A y B.

75

Figura 4 .1 - Diagram a del sistema usado para pruebas

Se utiliza el programa Ostinato v0.3 para generar el trfico necesario para las
pruebas, debido a que controla los puertos de salida configurados para que el
sistema operativo no introduzca paquetes no deseados que pueden perturbar las
mediciones, y adems tiene las siguientes caractersticas:

4.2

Mltiples protocolos al mismo tiempo incluyendo IPv4 y TCP.


Control de velocidad de generacin de paquetes para cada tipo de trfico
configurado.
Pantalla de estadsticas en tiempo real de paquetes enviados y recibidos.

CONFIGURACIN DE SCTRE

Se configura la estructura jerrquica de clases como se muestra en la Figura 4.2,


se eligieron los valores de velocidad mxima de bajada de 80Mbit/s y de subida
28Mbit/s debido a que estos valores son inferiores que la velocidad del trfico
generado de 100Mbit/s y 40Mbit/s respectivamente.

76

Figura 4 .2 - Diagram a jerrquico de clases usadas para las mediciones

Esta estructura se crea para que las clases 2 y 5 ocupen el mximo ancho de
banda de su clase padre con el trfico generado, mientras que se hace ping desde
el computador C cuyo trfico se ubica en las clases 3 y 6 para medir el tiempo de
respuesta en estas condiciones de saturacin. En la Figura 4.3 se muestra una
captura de la pantalla de configuracin de clases para las pruebas.

Figura 4 .3 Captura de configuracin de clases utilizada par a las pruebas

Se usan las 12 ltimas reglas mostradas en la Figura 4.4 para realizar la


clasificacin del trfico ICMP proveniente y con destino al computador C en las
77

clases correspondientes (3 y 6) y el trfico de TCP con puertos 80 a 84 en las


clases 2 y 5, el resto de reglas creadas tienen IP de destino diferente a la de los
computadores de la prueba, esto con el propsito de que no se cumplan pero se
evalen y de esta manera determinar el nmero mximo de reglas con las que el
sistema funciona correctamente.

Figura 4 .4 Listado de reglas usadas para las mediciones

Se realiza un script en SQL que adiciona el nmero de reglas no usadas deseado


y luego adiciona las reglas fijas al final para evitar adicionar las reglas una por una
usando la interfaz Web.
Se llen la base de datos con 1182 reglas usando el script SQL llamado
prueba.sql (Anexo D.3) e importndolo en la base de datos con los siguientes
comandos:
sqlitequery /var/www/control.sqlite2 delete from t_cl_criterios
sqlite-init prueba.sql /var/www/control.sqlite2
Luego se aplican los cambios normalmente para comenzar a tomar los datos.
78

4.3

PROCEDIMIENTOS PARA REALIZAR MEDICIONES

Como se describe la Seccin 4.1, durante las pruebas se realizan mediciones de


consumo de CPU y RAM, tasa de transferencia y tiempo de respuesta. A
continuacin se describe cada uno de los mtodos utilizados para la medicin de
los parmetros correspondientes.

4.3.1 Mtodo de medicin de consumo de CPU y RAM.


El consumo de CPU es la razn entre el nmero de ciclos de instruccin usados
por el procesador y el total de ciclos que el procesador puede usar en un tiempo
determinado. Para la medicin de consumo de CPU y memoria RAM durante las
pruebas, se utiliz el programa GNU top 3.6.1 que muestra el consumo de CPU
dividido en %user que es el porcentaje de consumo de CPU por aplicaciones de
usuario, %system es el usado por el kernel, %nice que es el usado por aplicaciones
con nivel de prioridad superior a la normal y %idle que es el porcentaje de CPU
disponible. El indicador de CPU disponible se utiliz para realizar una medicin
indirecta del consumo de CPU usado total del sistema. Una captura de pantalla se
puede observar en la Figura 4.5.

Figura 4 .5 Programa top usado par a la medicin de CPU y Memoria RAM

En la Figura 4.5 se observan los valores de que proporciona el comando top, en el


crculo rojo se muestra el porcentaje desocupado de tiempo de CPU, y en el
circulo azul, la memoria RAM disponible.

79

Para la medicin de consumo de CPU y RAM, se observa durante 2 minutos el


mnimo porcentaje de uso de CPU y RAM usando el programa GNU top ejecutado
va SSH en el SCTRE.

4.3.2 Mtodo de medicin de tasa de transferencia.


Se utiliza el programa Bandwidthvista 1.0.0.8 para medir la tasa de transferencia,
este programa sirve para monitorear el ancho de banda total de una interfaz de
red en el sistema operativo Windows 7. En la Figura 4.6 se puede apreciar una
captura de pantalla de esa aplicacin.

Antes de realizar las mediciones de CPU, RAM y tiempo de respuesta, se


comprueba el funcionamiento de la limitacin de ancho de banda de subida y de
bajada, usando el programa Bandwidth Vista en los computadores A y B.

Figura 4 .6 Captura de pantalla para verificacin de limite ancho de banda de subida

En la Figura 4.6 se muestra una captura de pantalla realizada en el computador A,


donde se observa el trfico generado de 100Mbit/s (12.5MB/s, crculo naranja) y el
trfico recibido controlado por SCTRE limitado a 28Mbit/s (3.5MB/s, crculo azul).

80

4.4

RESULTADOS DE LAS MEDICIONES

En la Tabla 4.1 se muestran los resultados de las mediciones de consumo de CPU


y de memoria sin control de trfico (SC) y con control de trfico (CC).

Tabla 4 .1 Mediciones de consumo de CPU y RAM sin control de trfico (SC) y con control (CC)
Nmero de
Reglas
1182
700
650
600
550
500
450
400
100

Memoria usada Memoria usada


SC [KB]
CC [KB]
44824
45164
45012
45056
44356
44588
44524
44524
44240

43772
44316
44048
44492
43840
44180
44120
44000
44000

CPU
disponible [%]
55,6
65,5
88,2
96,3
96,4
96,9
97,0
97,0
97,0

Se puede observar que el consumo de memoria es bastante bajo y para 1182


reglas, solo se ocupan 1052KB adicionales al activar el control de trfico. Este
valor es bajo respecto a 1GB de RAM que tiene el sistema (~0.1%).

Se puede observar que la memoria usada sin control de trfico (SC) vara; esto se
debe a que existen otros procesos como el servidor Web, el mismo top y otros
programas ejecutndose en ese momento y por tanto la memoria disponible vara.

De las mediciones de CPU se puede concluir, que el mayor cuello de botella para
el funcionamiento del sistema es la velocidad de la CPU, debido a que la memoria
consumida es muy baja, incluso con ms de 1000 reglas.
El tiempo de CPU consumido, se increment dramticamente cuando se
sobrepasaron las 600 reglas y no se realizaron mediciones entre 700 y 1182
reglas, ya que para 750 y superiores el porcentaje de paquetes perdidos durante
81

las pruebas de ping fue superior a 1%, lo que constituye un funcionamiento


incorrecto.
Para cada nmero de reglas, se realizaron 200 pings desde el computador C
hasta el A y se tomaron los tiempos mximos, mnimos y promedio adems del
porcentaje de paquetes cados. Todas las pruebas de ping se realizaron con el
control de trfico en funcionamiento. Los resultados se muestran en la Tabla 4.2.
Se omiten los resultados entre 400 y 100 reglas debido a que todos los tiempos y
paquetes perdidos fueron 0. Durante las pruebas, el sistema funcion
correctamente hasta con 700 reglas para 80Mbit/s de bajada y 28Mbit/s de subida
en el peor caso de congestin.

Tabla 4 .2 Tiempos de respuesta usando 200 pings del computador C hast a A


Numero de
Reglas

Mximo
Tiempo
[ms]

Mnimo
Tiempo
[ms]

Tiempo
promedio
[ms]

Perdida
[%]

1000
750
700
650
600
550
500
450
400
100

126
37
10
2
1
1
1
1
0
0

0
0
0
0
0
0
0
0
0
0

12
4
2
0
0
0
0
0
0
0

31
1
0
0
0
0
0
0
0
0

En la Tabla 4.2 se observa que los tiempos se mantienen por debajo del lmite
para la clase (5 ms) hasta con 650 reglas, para un nmero mayor de reglas, el
retardo es mayor. Pero se puede notar que con 750 reglas, a pesar que se
present un mximo de 37 ms, el promedio an est dentro del mnimo de la
clase; sin embargo, el porcentaje de prdida de 1% deja ver que 700 reglas es el
lmite de procesamiento del SCTRE, para esta prueba.

82

CAPITULO 5
CONCLUSIONES Y TRABAJO FUTURO

5.1

CONCLUSIONES

Se disea un sistema de control de trfico de red utilizando una


implementacin del algoritmo Hierarchical Fair Service Curve, el cual fue
probado exitosamente en una red con un trfico de bajada de 80Mbit/s y de
subida de 28Mbit/s con un mximo de 700 reglas. La independencia en el
control de tasa de transferencia y tiempo de respuesta del algoritmo H-FSC,
permite garantizar servicio en escenarios de congestin como el creado
durante las pruebas de funcionamiento.

La interfaz Web que se utiliza para realizar la configuracin del SCTRE es


ms conveniente que la configuracin a travs de CLI que se utiliz
originalmente. Durante el desarrollo del proyecto se busc una forma fcil e
intuitiva para la configuracin del SCTRE que permitiera un menor tiempo
de aprendizaje para el operario. Esta interfaz fue evolucionando
paulatinamente hasta llegar a su versin actual.

La capacidad de procesamiento de la CPU es el principal limitante del


nmero de reglas que se pueden configurar en el sistema , debido a que las
reglas se deben evaluar por cada paquete que llega a la interfaz. La
memoria RAM disponible en el sistema es suficiente e incluso se utiliza
menos de 5% del total.

El uso del sistema operativo GNU/Linux facilita la creacin de sistemas


complejos, debido a que se dispone de mltiples herramientas y libreras
que aceleran el proceso de diseo e implementacin. Adems, el uso de
herramientas Open Source disminuye costos adicionales en el producto.

El uso de la base de datos Sqlite facilita el manejo de varias configuraciones


que se guardan como archivos separados, sin perder la flexibilidad que
provee el uso de SQL. Esto permitira tener varias configuraciones estndar
para un producto comercial, las cuales se pueden distribuir con el mismo
83

equipo por defecto; que un usuario final pueda tener diferentes perfiles de
configuracin almacenados en el equipo.

El sistema de desarrollo realizado para este proyecto, disminuye el tiempo


de desarrollo al facilitar las tareas de: integracin de mltiples lenguajes de
programacin, transferencia de archivos al SCTRE y secuenciacin de
acciones para puesta en marcha del sistema.

Debido a la experiencia con el sistema, se determina que la forma ms fcil


de disear una configuracin especfica para el SCTRE es realizar un
diagrama jerrquico de las clases necesarias, asignarles nmeros
consecutivos y a partir de l, introducir los registros en el formulario de
clases.

5.2

TRABAJO FUTURO

Para un modelo comercial se pueden reducir costos al reducir la RAM del


sistema, puesto que se usa menos de 5% de la memoria actual de 1 GB, y
al eliminar elementos no-usados en la plataforma P2020RDB para SCTRE
como interfaz USB, memoria flash NAND y NOR, entre otras.

El SCTRE puede ser modificado fcilmente para utilizar otros algoritmos de


control de trfico como HTB o CBQ, lo que proporciona control de trfico
con menor consumo de CPU pero con menor control sobre los tiempos de
retardo, en trabajos futuros se podra comparar el funcionamiento de cada
uno y su consumo de CPU.

Se pueden adicionar cambios funcionales y estticos a la interfaz Web del


SCTRE. Tales cambios pueden abarcar la generacin de grficos en tiempo
real de la tasa de transferencia por clase, con el consecuente uso de CPU;
Tambin se podra mejorar el sistema de creacin de clases adicionando
una aplicacin en la interfaz web que permita visualizar grficamente la
estructura jerrquica de clases, incluso que permita modificarla. Tambin se
sugiere hacer un estudio de usabilidad de la interfaz Web.

84

Se podra adicionar la interfaz no-usada eth1 del SCTRE como otra interfaz
WAN para realizar balanceo de carga y tolerancia a fallas en los enlaces a
internet.

Se pueden implementar nuevos criterios de clasificacin en las reglas,


como el clasificador L7 que permite clasificar paquetes basados en la capa
de aplicacin, como programas P2P y trfico de mensajera instantnea,
entre otros.

Se puede implementar funcionalidad de firewall para el SCTRE con reglas


basadas en la direccin MAC fuente y otros criterios soportados por iptables
adems de los que se usan actualmente para las reglas. Esto permitira
aumentar la seguridad de la red a la cual se conecta el dispositivo,
permitiendo que no se presenten accesos no deseados a los servicios que
se ejecutan en el SCTRE.

85

86

REFERENCIAS

[1]

APCONNECTIONS, NETEQUALIZER price list, [online], [Citado el 7 de


octubre de 2009] , formato HTML
<http://www.netequalizer.com/neteqpricelist.php>

[2]

BROADCOM, BCM1250 Product brief, [online], [Citado el 7 de octubre de


2009], formato HTML <http://www.broadcom.com/collateral/pb/1250-PB11R.pdf>

[3]

BROADCOM, BCM91250A - Evaluation Board for BCM1250 [online], [Citado


el 7 de octubre de 2009], formato HTML
<http://www.broadcom.com/products/EnterpriseNetworking/Communications-Processors/BCM91250A>

[4]

BROWN, Martin A., HFSC Scheduling with GNU/Linux [online], [Citado el 9


de octubre de 2009], formato HTML, < http://GNU/Linuxip.net/articles/hfsc.en/ >

[5]

BROWN, Martin A., Traffic Control HOWTO (2006), [online], Citado el 6 de


octubre de 2009] ], [PDF] <http://www.fesppr.br/~airton/tmp/iproute.pdf> [

[6]

CISCO SYSTEMS, Internetworking Technology Handbook Quality of


Service (QoS) [online], [Citado el 6 de octubre de 2009], formato HTML,
<http://www.cisco.com/en/US/docs/internetworking/technology/handbook/Q
oS.html#wp1024961 >

[7]

COMPUVEST CORPORATION, Cisco AS5400-DC Refurbished


AS5400DCRF [online], [Citado el 3 de octubre de 2009], formato HTML
<http://www.compuvest.com/Desc.jsp?iid=736496>

[8]

DELL INC., Servidores en Torre Poweredge. [online], [Citado el 19 de agosto


de 2009], formato HTML
<http://www1.la.dell.com/co/es/empresas/Servidores/tower/ct.aspx?refid=tow
er&s=bsd&cs=cobsdt1&~tab=3 >
87

[9]

DEVERA, Martin, Hierachical token bucket theory (2003) [online], [Citado el


10 de octubre de 2009], formato HTML,
<http://luxik.cdi.cz/~devik/qos/htb/manual/theory.htm >

[10] FREEBSD, THE FREEBSD COPYRIGH, [online], [Citado el 9 de octubre de


2010], formato HTML, <http://www.freebsd.org/copyright/freebsdlicense.html>
[11] FREESCALE, P2020RDB,[online], [Citado el 3 de octubre de 2010], [PDF]
<http://cache.freescale.com/files/netcomm/doc/fact_sheet/P2020RDB.pdf>
[12] GNU GNU GENERAL PUBLIC LICENSE,[online], [Citado el 30 de octubre de
2010], formato HTML, <http://www.gnu.org/licenses/gpl.htm>
[13] GNU GNU GENERAL PUBLIC LICENSE,[online], [Citado el 20 de octubre de
2010], formato HTML, <http://www.gnu.org/licenses/gpl-2.0.html>
[14] INTERNATIONAL TELECOMMUNICATIONS UNION (ITU-T), Teletraffic
engineering handbook [online], [Citado el 10 de octubre de 2009], [PDF]
<http://www.com.dtu.dk/teletraffic/handbook/telenook.pdf>
[15] INTERNET ENGINEERING TASK FORCE (IETF), RFC2475 An
architecture for diferentiated services [online], [Citado el 6 de octubre de
2009], formato HTML, <http://tools.ietf.org/html/rfc2475 >
[16] HICKEY, Corey, ESFQ for GNU/Linux 2.6 [online], [Citado el 10 de octubre
de 2009] formato HTML, < http://fatooh.org/esfq-2.6/ >
[17] HUBERT, Bert, GNU/Linux advanced routing & traffic control [online], [Citado
el 9 de octubre de 2009], formato HTML,
<http://lartc.org/lartc.html#LARTC.QDISC >
[18] MCKENNEY, PAUL E., Stochastic Fairness Queueing (1991) [online],
[Citado el 9 de octubre de 2009], [TGZ],
<http://www.rdrop.com/users/paulmck/sfq.ps.Z >
[19] NEXTAG INC., Cisco ASA 5520 Firewall Edition Bundle [online], [Citado el 3
de octubre de 2009], formato HTML, <http://www.nextag.com/Cisco-ASA5520-Firewall-71945571/specs-html>
88

[20] NEXTAG INC., Cisco 7206VXR Router - 3 x 10/100/1000Base-T LAN


[online], [Citado el 19 de agosto de 2009], formato HTML,
<http://www.nextag.com/Cisco-7206VXR-Router-3-55393165/prices-html >
[21] OPALSOFT, SFQ queuing discipline, [online], [Citado el 04 de Noviembre de
2010], formato HTML, <http://opalsoft.net/qos/DS-25.htm>
[22] R. Cruz. Service burstiness and dynamic burstiness measures: A frame work. Journal of High Speed Networks, 1(2):105127, 1992.
[23] STOICA, lon, A Hierarchical Fair Service Curve Algorithm for Link -Sharing,
Real-Time and Priority Service. Proceedings of SIGCOMM'97 (1997)
[24] THE ICSI NETWORKING GROUP, References on CBQ (Class-Based
Queueing) [online], < http://www.icir.org/floyd/cbq.html> [Citado el 10 de
octubre de 2009]
[25] TECHSOUP FOR LIBRARIES, Bandwidth Management [online],
<http://www.techsoupforlibraries.org/cookbook-3/networking-andsecurity/bandwidth-management> [Citado el 6 de octubre de 2009]
[26]

WEICKER, Reinhold. Dhrystone: A Synthetic Systems Programming


Benchmark, en Communications of the ACM (CACM), Volume 27, Number
10, pg. 1013-1030, (1984).

[27] XROADS NETWORKS INC, EdgeXL-500 Series [online], [Citado el 3 de


octubre de 2009], formato HTML, <http://www.dualwanrouters.com/EdgeXL500.asp>

89

90

ANEXOS

91

92

ANEXO A MANUAL DE USUARIO

Contenido:
Captulo 1. Introduccin
1.1 Que es SCTRE?
1.2 Aplicaciones de SCTRE
1.3 Prerequisitos para operar/instalar
Captulo 2. Instalacin
2.1 Seleccin de topologa de red
2.2 Conexiones
2.3 Encendido y reinicio.
Captulo 3. Configuracin
3.1
3.2
3.3
3.4
3.5

Configuracin LAN
Configuracin WAN
Configuracin de Clases.
Configuracin de Reglas
Aplicar cambios

Captulo 4. Herramientas de diagnstico.


4.1 Ping
4.2 Traceroute
Captulo 5. Configuracin avanzada por CLI
5.1 Acceso por SSH
5.2 Comandos bsicos de CLI
5.3 Comandos avanzados de CLI

93

Captulo 1. Introduccin

El presente manual describe la instalacin y configuracin del Sistema de Contrl de


Trfico (SCTRE).

1.1 Que es SCTRE?

La funcin del SCTRE es distribur de manera no-uniforme el ancho de banda de


una conexin (generalmente a Internet) entre servicios/hosts/subredes
garantizando ancho de banda fijo disponible para cada servicio en momentos de
congenstin. Esto evita que los siervicios queden sin servicio de internet en
momentos de alto trfico.

1.2 Aplicaciones de SCTRE

La pricncipal aplicacin de SCTRE es la distribucin de la velocidad a internet entre


diferentes subredes (por ejemplo entre edificios u oficinas). Tambin se puede usar
para garantizar requerimientos de lantencia de servicios como VoIP y para
garantizar ancho de banda para servicios crticos como el almacenamiento o las
aplicaciones en lnea.

1.3 Prerequisitos para operar/instalar


El instalador de SCTRE debe tener un nivel de conocimiento tcnico en redes que le
permita:

Conocer la topologa de red actual.


Realizar un diagrama que represente la distribucin deseada de trfico.
Conocer las IP, subredes , puertos o protocolos que vaya a usar como
criterios para asignar el trfico.
94

Captulo 2. Instalacin

Este captulo comprende la seleccin de la ubicacin del SCTRE, as como sus


conexiones, controles e indicadores fsicos.

2.1 Seleccin de topologa de red


El SCTRE se debe utilizar como una puerta de enlace (gateway)a internet.
Se debe tener clara la topologa de red actual y se debe ubicar el dispositivo entre
el punto de acceso a internet y el switch que conecta con los equipos a los que se
realizar el contrl de trfico.
Estos equipos pueden configurarse con DHCP, pero debe asegurarse que no hay
otros servidores DHCP en la red controlada.

2.2 Conexiones
Los siguientes son los pasos para la instalacin fsica de SCTRE:

Conecte el punto de acceso a Internet al conector Eth2 de la parte posterior


del SCTRE.
Conecte cualquiera de los 4 puertos Eth0 al switch que comunica con la red
a controlar.
Conecte el cable de poder de SCTRE a un toma 100-240V 50-60Hz.
Recuerde ubicar el SCTRE en una ubicacin protegida, lejos de la humedad,
la temperatura de operacin recomendada es de 10 a 20C, temperatura
mxima de operacin 60C.

2.3 Encendido y reinicio.

95

El dispositivo cuenta con un botn de Power en la parte fronal que permite


encender y apagar el dispositivo en cualquier momento. Tambin tiene un botn
de Restart que permite reiniciar el equipo, recuerde que el proceso de arranque
tarda ms de un minuto.
El led verde en el panel frontal indica que el dispositivo est arrancando.
(Para la versin prototipo, debe conectarse la memoria USB antes de
encender/reiniciar el dispositivo)

Captulo 3. Configuracin

Este captulo explica las pantallas de configuracin del SCTRE.

Los pasos para conectarse a la interfaz Web de configuracin son los siguientes:

Ubicarse en un equipo conectado a la interfaz LAN el SCTRE


Usar DHCP para obtener una direccin IP.
Abrir un navegador Web (Firefox, Chrome, IE, etc..)y conectarse a la
direccin 10.11.200.1
Usar el enlace Login para autenticarse con el nombre de usuario admin y
password admin

3.1 Configuracin LAN


Consta de campos de texto para la direccin IP de LAN, mscara de subred, un
campo de seleccin para activar el servidor DHCP en la interfaz LAN y un botn
para guardar los cambios como se muestra en la Figura.

96

3.2 Configuracin WAN

Tiene campos de texto para la direccin IP de WAN, mscara de subred, puerta de


enlace, DNS primario y DNS secundario, un campo de seleccin para activar el
configuracin por DHCP y un botn para guardar los cambios como se muestra en
la Figura.

3.3 Configuracin de Clases.


Tiene enlaces para adicionar/borrar/editar clases con una caja de seleccin para
escoger si la clase es para trfico de subida o de bajada y campos de texto para el
nmero de identificacin de la clase padre (0 si su padre es la clase raz), la
velocidad garantizada en Kbits/s, el retardo en ms (opcional), la velocidad mxima
(opcional) y un botn para agregar la clase.

3.4 Configuracin de Reglas


Contiene enlaces para crear/boorrar/editar reglas, los campos opcionales para
componer una reglason los siguientes:

IP fuente
IP destino
Mascara de subred fuente
Mascara de subred destino
Protocolo (IP, ICMP, TCP o UDP), obligatorio.
Puerto fuente

3.5 Aplicar cambios


Este enlace, aplica los cambios realizados en la configuracin y reinicia solo el
97

contrl de trfico, sin reiniciar por completo el equipo, por lo tanto el tiempo de
aplicacin de cambios es de 15-30 segundos.
Despus de este tiempo, el equipo queda limitando el trfico segn la ltima
configuracin y usted puede comenzar a realizar las pruebas de funcionamiento.

Captulo 4. Herramientas de diagnstico.

Las herramientas de diagnstico pueden ser utilizadas despus de la instalacin


para comprobar que el sitema tenga conectividad a internet y funcione
adecuandamente.

4.1 Ping
Escriba la direccin IP o el nombre de dominio para hacer ping y oprima el botn
Realizar. Los resultados tardan aprximadamente un segundo por cada ping.

4.2 Traceroute
Realiza una traza del paquetes desde el SCTRE, escriba la direccin IP o el nombre
de dominio, coloque un nmero mximo de saltos (10=recomendado) y oprima
Realizar.
El test puede tardar varios minutos, este tiempo es proporcional a la distancia del
host trazado y al nmero de saltos configurados.

Captulo 5. Configuracin avanzada por CLI

Esta seccin describe los comando ms importantes que se puede usar para
configurar el SCTRE va CLI (Command Line Interface).

98

5.1 Acceso por SSH

Puede conectarse al SCTRE para realizar configuraciones va CLI


protocolo SSH.

usando el

Utilice cualquier cliente ssh (por ejemplo Putty) y conectese a la direccin de LAN
del SCTRE (default 10.11.200.1), user el login root y password root.

5.2 Comandos bsicos de CLI


Los comandos bsicos de control de SCTRE son:

aplicarcambios.sh -Aplica todas las configuraciones.


doflush.sh Borra todas las clases y reglas.
genqdiscs.sh Genera las clases Raiz.
genclases.sh Genera las clases configuradas.
genreglas.sh Genera las reglas.
sync.sh Sincroniza el entorno de desarrollo.
ifconfig sin parmetros verifica configuracin de NICs.

5.3 Comandos avanzados de CLI

El software de SCTRE cuenta con el paquete iproute2 que el usuario puede usar
para configurar los diferentes protocolos y funciones de enrutamiento soportados.
El uso de Iproute2 puede consultarse en su extensa documentacin en lnea.

99

ANEXO B SHELLSCRIPTS Y CONFIGURACIONES

ANEXO B.1 APLICARCAMBIOS.SH


#!/bin/sh
#habilita ipv4 forwarding y hace flush de clases y criterios
/usr/sbin/doflush.sh
#aplica configuracin lan
#aplica configuracin wan
/usr/sbin/conflanwan.sh
#aplica rutas
/usr/sbin/crearrutas.sh
#crea qdiscs en cada interfaz y clases root 0
echo "Creando las colas para las interfaces y las clases raiz.<br>"
/usr/sbin/crearqdiscs.sh
#crea comandos para clases y los ejecuta
/usr/sbin/crearclases.sh
#crea comandos para criterios y los ejecuta
#/root/testcriterios.sh
tail -n 100 /usr/sbin/cmdcriterios > /root/testcriterios.sh
/root/testcriterios.sh
#/usr/sbin/crearcriterios.sh
#crea qdiscs sfq para las clases hijas
/usr/sbin/crearsfq.sh
echo "<br><br>Los cambios se aplicaron exitosamente.<br>"

ANEXO B.2 SYNC.SH


#!/bin/bash
#script de actualizacin de los archivos descargados en /root
#copia los diferentes tipos de archivos a sus correspondientes directorios
cp /root/*.html /var/www
cp /root/*.php /var/www
cp /root/*.pl /var/www/cgi-bin
cp /root/*.sql /var/www/cgi-bin
cp /root/*.sh /usr/sbin
#coloca atributos de r+w+x por todo el mundo a los archivos necesarios
chmod 777 /usr/sbin/*.sh
chmod -R 777 /var/www/*
#compila las fuentes de los programas necesarios
gcc -Wall -lsqlite -o /root/sqlitequery /root/sqlitequery.c
gcc -Wall -lsqlite -o /root/genclases /root/genclases.c
gcc -Wall -lsqlite -o /root/gencriterios /root/gencriterios.c
gcc -Wall -lsqlite -o /root/genqdiscs /root/genqdiscs.c
gcc -Wall -lsqlite -o /root/genrutas /root/genrutas.c
gcc -Wall -lsqlite -o /root/genconfig /root/genconfig.c
#copia los ejecutables creados a su destino final
cp /root/genclases /usr/sbin
cp /root/gencriterios /usr/sbin

100

cp
cp
cp
cp

/root/sqlitequery /usr/sbin
/root/genqdiscs /usr/sbin
/root/genrutas /usr/sbin
/root/genconfig /usr/sbin

ANEXO B.3 /BOOT/LINUX.CONF


#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.32-rc3
#
# CONFIG_PPC64 is not set
#
# Processor support
#
# CONFIG_PPC_BOOK3S_32 is not set
CONFIG_PPC_85xx=y
# CONFIG_PPC_8xx is not set
# CONFIG_40x is not set
# CONFIG_44x is not set
# CONFIG_E200 is not set
CONFIG_E500=y
# CONFIG_PPC_E500MC is not set
CONFIG_BOOKE=y
CONFIG_FSL_BOOKE=y
CONFIG_FSL_EMB_PERFMON=y
# CONFIG_PHYS_64BIT is not set
CONFIG_SPE=y
CONFIG_PPC_MMU_NOHASH=y
CONFIG_PPC_MMU_NOHASH_32=y
CONFIG_PPC_BOOK3E_MMU=y
# CONFIG_PPC_MM_SLICES is not set
CONFIG_SMP=y
CONFIG_NR_CPUS=2
CONFIG_PPC32=y
CONFIG_WORD_SIZE=32
# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
CONFIG_MMU=y
CONFIG_GENERIC_CMOS_UPDATE=y
CONFIG_GENERIC_TIME=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_HARDIRQS=y
CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
CONFIG_IRQ_PER_CPU=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_ARCH_HAS_ILOG2_U32=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_FIND_NEXT_BIT=y
# CONFIG_ARCH_NO_VIRT_TO_BUS is not set

101

CONFIG_PPC=y
CONFIG_EARLY_PRINTK=y
CONFIG_GENERIC_NVRAM=y
CONFIG_SCHED_OMIT_FRAME_POINTER=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_PPC_OF=y
CONFIG_OF=y
CONFIG_PPC_UDBG_16550=y
CONFIG_GENERIC_TBSYNC=y
CONFIG_AUDIT_ARCH=y
CONFIG_GENERIC_BUG=y
CONFIG_DTC=y
CONFIG_DEFAULT_UIMAGE=y
# CONFIG_PPC_DCR_NATIVE is not set
# CONFIG_PPC_DCR_MMIO is not set
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_CONSTRUCTORS=y
#
# General setup
#
CONFIG_EXPERIMENTAL=y
CONFIG_LOCK_KERNEL=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_LOCALVERSION=""
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
CONFIG_POSIX_MQUEUE_SYSCTL=y
CONFIG_BSD_PROCESS_ACCT=y
# CONFIG_BSD_PROCESS_ACCT_V3 is not set
# CONFIG_TASKSTATS is not set
CONFIG_AUDIT=y
# CONFIG_AUDITSYSCALL is not set
#
# RCU Subsystem
#
CONFIG_TREE_RCU=y
# CONFIG_TREE_PREEMPT_RCU is not set
# CONFIG_RCU_TRACE is not set
CONFIG_RCU_FANOUT=32
# CONFIG_RCU_FANOUT_EXACT is not set
# CONFIG_TREE_RCU_TRACE is not set
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_LOG_BUF_SHIFT=14
CONFIG_GROUP_SCHED=y
# CONFIG_FAIR_GROUP_SCHED is not set
# CONFIG_RT_GROUP_SCHED is not set
CONFIG_USER_SCHED=y
# CONFIG_CGROUP_SCHED is not set
# CONFIG_CGROUPS is not set
CONFIG_SYSFS_DEPRECATED=y
CONFIG_SYSFS_DEPRECATED_V2=y
# CONFIG_RELAY is not set
# CONFIG_NAMESPACES is not set

102

CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_RD_GZIP=y
# CONFIG_RD_BZIP2 is not set
# CONFIG_RD_LZMA is not set
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
CONFIG_SYSCTL=y
CONFIG_ANON_INODES=y
CONFIG_EMBEDDED=y
CONFIG_SYSCTL_SYSCALL=y
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_EXTRA_PASS=y
CONFIG_HOTPLUG=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
CONFIG_AIO=y
CONFIG_HAVE_PERF_EVENTS=y
#
# Kernel Performance Events And Counters
#
# CONFIG_PERF_EVENTS is not set
# CONFIG_PERF_COUNTERS is not set
CONFIG_VM_EVENT_COUNTERS=y
CONFIG_PCI_QUIRKS=y
CONFIG_SLUB_DEBUG=y
CONFIG_COMPAT_BRK=y
# CONFIG_SLAB is not set
CONFIG_SLUB=y
# CONFIG_SLOB is not set
# CONFIG_PROFILING is not set
CONFIG_HAVE_OPROFILE=y
# CONFIG_KPROBES is not set
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
CONFIG_HAVE_IOREMAP_PROT=y
CONFIG_HAVE_KPROBES=y
CONFIG_HAVE_KRETPROBES=y
CONFIG_HAVE_ARCH_TRACEHOOK=y
CONFIG_HAVE_DMA_ATTRS=y
CONFIG_USE_GENERIC_SMP_HELPERS=y
CONFIG_HAVE_DMA_API_DEBUG=y
#
# GCOV-based kernel profiling
#
CONFIG_SLOW_WORK=y
# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
CONFIG_SLABINFO=y
CONFIG_RT_MUTEXES=y
CONFIG_BASE_SMALL=0
CONFIG_MODULES=y
# CONFIG_MODULE_FORCE_LOAD is not set

103

CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
# CONFIG_MODVERSIONS is not set
# CONFIG_MODULE_SRCVERSION_ALL is not set
CONFIG_STOP_MACHINE=y
CONFIG_BLOCK=y
CONFIG_LBDAF=y
# CONFIG_BLK_DEV_BSG is not set
# CONFIG_BLK_DEV_INTEGRITY is not set
#
# IO Schedulers
#
CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_AS=y
CONFIG_IOSCHED_DEADLINE=y
CONFIG_IOSCHED_CFQ=y
# CONFIG_DEFAULT_AS is not set
# CONFIG_DEFAULT_DEADLINE is not set
CONFIG_DEFAULT_CFQ=y
# CONFIG_DEFAULT_NOOP is not set
CONFIG_DEFAULT_IOSCHED="cfq"
# CONFIG_FREEZER is not set
CONFIG_PPC_MSI_BITMAP=y
#
# Platform support
#
# CONFIG_PPC_CELL is not set
# CONFIG_PPC_CELL_NATIVE is not set
# CONFIG_PQ2ADS is not set
CONFIG_MPC85xx=y
# CONFIG_MPC8540_ADS is not set
# CONFIG_MPC8560_ADS is not set
# CONFIG_MPC85xx_CDS is not set
# CONFIG_MPC85xx_MDS is not set
# CONFIG_MPC8536_DS is not set
# CONFIG_MPC85xx_DS is not set
CONFIG_MPC85xx_RDB=y
# CONFIG_SOCRATES is not set
# CONFIG_KSI8560 is not set
# CONFIG_XES_MPC85xx is not set
# CONFIG_STX_GP3 is not set
# CONFIG_TQM8540 is not set
# CONFIG_TQM8541 is not set
# CONFIG_TQM8548 is not set
# CONFIG_TQM8555 is not set
# CONFIG_TQM8560 is not set
# CONFIG_SBC8548 is not set
# CONFIG_SBC8560 is not set
CONFIG_FSL_85XX_CACHE_SRAM=y
CONFIG_FSL_85XX_CACHE_SRAM_BASE=0xfff00000
# CONFIG_IPIC is not set
CONFIG_MPIC=y
# CONFIG_MPIC_WEIRD is not set
CONFIG_PPC_I8259=y
# CONFIG_PPC_RTAS is not set
# CONFIG_MMIO_NVRAM is not set
# CONFIG_PPC_MPC106 is not set
# CONFIG_PPC_970_NAP is not set

104

# CONFIG_PPC_INDIRECT_IO is not set


# CONFIG_GENERIC_IOMAP is not set
# CONFIG_CPU_FREQ is not set
# CONFIG_QUICC_ENGINE is not set
# CONFIG_CPM2 is not set
CONFIG_FSL_ULI1575=y
# CONFIG_MPC8xxx_GPIO is not set
# CONFIG_SIMPLE_GPIO is not set
#
# Kernel options
#
CONFIG_HIGHMEM=y
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
# CONFIG_HZ_100 is not set
CONFIG_HZ_250=y
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not set
CONFIG_HZ=250
CONFIG_SCHED_HRTICK=y
CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set
CONFIG_BINFMT_ELF=y
# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
# CONFIG_HAVE_AOUT is not set
# CONFIG_BINFMT_MISC is not set
CONFIG_MATH_EMULATION=y
CONFIG_IOMMU_HELPER=y
CONFIG_SWIOTLB=y
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
CONFIG_ARCH_HAS_WALK_MEMORY=y
CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
# CONFIG_IRQ_ALL_CPUS is not set
CONFIG_MAX_ACTIVE_REGIONS=32
CONFIG_ARCH_FLATMEM_ENABLE=y
CONFIG_ARCH_POPULATES_NODE_MAP=y
CONFIG_SELECT_MEMORY_MODEL=y
CONFIG_FLATMEM_MANUAL=y
# CONFIG_DISCONTIGMEM_MANUAL is not set
# CONFIG_SPARSEMEM_MANUAL is not set
CONFIG_FLATMEM=y
CONFIG_FLAT_NODE_MEM_MAP=y
CONFIG_PAGEFLAGS_EXTENDED=y
CONFIG_SPLIT_PTLOCK_CPUS=4
CONFIG_MIGRATION=y
# CONFIG_PHYS_ADDR_T_64BIT is not set
CONFIG_ZONE_DMA_FLAG=1
CONFIG_BOUNCE=y
CONFIG_VIRT_TO_BUS=y
CONFIG_HAVE_MLOCK=y
CONFIG_HAVE_MLOCKED_PAGE_BIT=y
# CONFIG_KSM is not set
CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
CONFIG_PPC_4K_PAGES=y
# CONFIG_PPC_16K_PAGES is not set
# CONFIG_PPC_64K_PAGES is not set

105

# CONFIG_PPC_256K_PAGES is not set


CONFIG_FORCE_MAX_ZONEORDER=11
CONFIG_PROC_DEVICETREE=y
# CONFIG_CMDLINE_BOOL is not set
CONFIG_EXTRA_TARGETS=""
# CONFIG_PM is not set
CONFIG_SECCOMP=y
CONFIG_ISA_DMA_API=y
#
# Bus options
#
CONFIG_ZONE_DMA=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_PPC_INDIRECT_PCI=y
CONFIG_FSL_SOC=y
CONFIG_FSL_PCI=y
CONFIG_FSL_LBC=y
CONFIG_PPC_PCI_CHOICE=y
CONFIG_PCI=y
CONFIG_PCI_DOMAINS=y
CONFIG_PCI_SYSCALL=y
CONFIG_PCIEPORTBUS=y
# CONFIG_PCIEAER is not set
# CONFIG_PCIEASPM is not set
CONFIG_ARCH_SUPPORTS_MSI=y
CONFIG_PCI_MSI=y
# CONFIG_PCI_LEGACY is not set
# CONFIG_PCI_STUB is not set
# CONFIG_PCI_IOV is not set
# CONFIG_PCCARD is not set
# CONFIG_HOTPLUG_PCI is not set
# CONFIG_HAS_RAPIDIO is not set
#
# Advanced setup
#
# CONFIG_ADVANCED_OPTIONS is not set
#
# Default settings for advanced configuration options are used
#
CONFIG_LOWMEM_SIZE=0x30000000
CONFIG_LOWMEM_CAM_NUM=3
CONFIG_PAGE_OFFSET=0xc0000000
CONFIG_KERNEL_START=0xc0000000
CONFIG_PHYSICAL_START=0x00000000
CONFIG_PHYSICAL_ALIGN=0x04000000
CONFIG_TASK_SIZE=0xc0000000
CONFIG_NET=y
#
# Networking options
#
CONFIG_PACKET=y
# CONFIG_PACKET_MMAP is not set
CONFIG_UNIX=y
CONFIG_XFRM=y
CONFIG_XFRM_USER=y
# CONFIG_XFRM_SUB_POLICY is not set

106

# CONFIG_XFRM_MIGRATE is not set


# CONFIG_XFRM_STATISTICS is not set
CONFIG_XFRM_IPCOMP=y
CONFIG_NET_KEY=y
# CONFIG_NET_KEY_MIGRATE is not set
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_ASK_IP_FIB_HASH=y
# CONFIG_IP_FIB_TRIE is not set
CONFIG_IP_FIB_HASH=y
CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_IP_ROUTE_MULTIPATH=y
CONFIG_IP_ROUTE_VERBOSE=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
CONFIG_IP_PNP_RARP=y
CONFIG_NET_IPIP=y
CONFIG_NET_IPGRE=y
CONFIG_NET_IPGRE_BROADCAST=y
CONFIG_IP_MROUTE=y
CONFIG_IP_PIMSM_V1=y
CONFIG_IP_PIMSM_V2=y
CONFIG_ARPD=y
# CONFIG_SYN_COOKIES is not set
CONFIG_INET_AH=y
CONFIG_INET_ESP=y
CONFIG_INET_IPCOMP=y
CONFIG_INET_XFRM_TUNNEL=y
CONFIG_INET_TUNNEL=y
CONFIG_INET_XFRM_MODE_TRANSPORT=y
CONFIG_INET_XFRM_MODE_TUNNEL=y
CONFIG_INET_XFRM_MODE_BEET=y
# CONFIG_INET_LRO is not set
CONFIG_INET_DIAG=y
CONFIG_INET_TCP_DIAG=y
CONFIG_TCP_CONG_ADVANCED=y
CONFIG_TCP_CONG_BIC=m
CONFIG_TCP_CONG_CUBIC=y
CONFIG_TCP_CONG_WESTWOOD=m
CONFIG_TCP_CONG_HTCP=m
# CONFIG_TCP_CONG_HSTCP is not set
# CONFIG_TCP_CONG_HYBLA is not set
# CONFIG_TCP_CONG_VEGAS is not set
# CONFIG_TCP_CONG_SCALABLE is not set
# CONFIG_TCP_CONG_LP is not set
# CONFIG_TCP_CONG_VENO is not set
# CONFIG_TCP_CONG_YEAH is not set
# CONFIG_TCP_CONG_ILLINOIS is not set
# CONFIG_DEFAULT_BIC is not set
CONFIG_DEFAULT_CUBIC=y
# CONFIG_DEFAULT_HTCP is not set
# CONFIG_DEFAULT_VEGAS is not set
# CONFIG_DEFAULT_WESTWOOD is not set
# CONFIG_DEFAULT_RENO is not set
CONFIG_DEFAULT_TCP_CONG="cubic"
# CONFIG_TCP_MD5SIG is not set
CONFIG_IPV6=y
# CONFIG_IPV6_PRIVACY is not set

107

# CONFIG_IPV6_ROUTER_PREF is not set


# CONFIG_IPV6_OPTIMISTIC_DAD is not set
# CONFIG_INET6_AH is not set
# CONFIG_INET6_ESP is not set
# CONFIG_INET6_IPCOMP is not set
# CONFIG_IPV6_MIP6 is not set
# CONFIG_INET6_XFRM_TUNNEL is not set
# CONFIG_INET6_TUNNEL is not set
CONFIG_INET6_XFRM_MODE_TRANSPORT=y
CONFIG_INET6_XFRM_MODE_TUNNEL=y
CONFIG_INET6_XFRM_MODE_BEET=y
# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
CONFIG_IPV6_SIT=y
CONFIG_IPV6_NDISC_NODETYPE=y
# CONFIG_IPV6_TUNNEL is not set
# CONFIG_IPV6_MULTIPLE_TABLES is not set
# CONFIG_IPV6_MROUTE is not set
# CONFIG_NETWORK_SECMARK is not set
CONFIG_NETFILTER=y
# CONFIG_NETFILTER_DEBUG is not set
CONFIG_NETFILTER_ADVANCED=y
#
# Core Netfilter Configuration
#
CONFIG_NETFILTER_NETLINK=y
CONFIG_NETFILTER_NETLINK_QUEUE=m
CONFIG_NETFILTER_NETLINK_LOG=y
CONFIG_NF_CONNTRACK=y
CONFIG_NF_CT_ACCT=y
CONFIG_NF_CONNTRACK_MARK=y
CONFIG_NF_CONNTRACK_EVENTS=y
# CONFIG_NF_CT_PROTO_DCCP is not set
# CONFIG_NF_CT_PROTO_SCTP is not set
# CONFIG_NF_CT_PROTO_UDPLITE is not set
# CONFIG_NF_CONNTRACK_AMANDA is not set
# CONFIG_NF_CONNTRACK_FTP is not set
# CONFIG_NF_CONNTRACK_H323 is not set
# CONFIG_NF_CONNTRACK_IRC is not set
# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set
# CONFIG_NF_CONNTRACK_PPTP is not set
# CONFIG_NF_CONNTRACK_SANE is not set
# CONFIG_NF_CONNTRACK_SIP is not set
# CONFIG_NF_CONNTRACK_TFTP is not set
# CONFIG_NF_CT_NETLINK is not set
# CONFIG_NETFILTER_TPROXY is not set
CONFIG_NETFILTER_XTABLES=y
CONFIG_NETFILTER_XT_TARGET_CLASSIFY=y
CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
# CONFIG_NETFILTER_XT_TARGET_DSCP is not set
# CONFIG_NETFILTER_XT_TARGET_HL is not set
CONFIG_NETFILTER_XT_TARGET_MARK=y
CONFIG_NETFILTER_XT_TARGET_NFLOG=y
CONFIG_NETFILTER_XT_TARGET_NFQUEUE=y
# CONFIG_NETFILTER_XT_TARGET_NOTRACK is not set
# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set
# CONFIG_NETFILTER_XT_TARGET_TRACE is not set
# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set
# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set
# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set

108

# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set


# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set
# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set
# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set
# CONFIG_NETFILTER_XT_MATCH_CONNTRACK is not set
# CONFIG_NETFILTER_XT_MATCH_DCCP is not set
# CONFIG_NETFILTER_XT_MATCH_DSCP is not set
# CONFIG_NETFILTER_XT_MATCH_ESP is not set
# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set
# CONFIG_NETFILTER_XT_MATCH_HELPER is not set
# CONFIG_NETFILTER_XT_MATCH_HL is not set
# CONFIG_NETFILTER_XT_MATCH_IPRANGE is not set
# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set
# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set
CONFIG_NETFILTER_XT_MATCH_MAC=y
# CONFIG_NETFILTER_XT_MATCH_MARK is not set
# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set
# CONFIG_NETFILTER_XT_MATCH_OWNER is not set
# CONFIG_NETFILTER_XT_MATCH_POLICY is not set
# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set
# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set
# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set
# CONFIG_NETFILTER_XT_MATCH_REALM is not set
# CONFIG_NETFILTER_XT_MATCH_RECENT is not set
# CONFIG_NETFILTER_XT_MATCH_SCTP is not set
# CONFIG_NETFILTER_XT_MATCH_STATE is not set
# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set
# CONFIG_NETFILTER_XT_MATCH_STRING is not set
# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set
CONFIG_NETFILTER_XT_MATCH_TIME=y
CONFIG_NETFILTER_XT_MATCH_U32=y
# CONFIG_NETFILTER_XT_MATCH_OSF is not set
# CONFIG_IP_VS is not set
#
# IP: Netfilter Configuration
#
CONFIG_NF_DEFRAG_IPV4=y
CONFIG_NF_CONNTRACK_IPV4=y
CONFIG_NF_CONNTRACK_PROC_COMPAT=y
CONFIG_IP_NF_QUEUE=m
CONFIG_IP_NF_IPTABLES=y
# CONFIG_IP_NF_MATCH_ADDRTYPE is not set
# CONFIG_IP_NF_MATCH_AH is not set
# CONFIG_IP_NF_MATCH_ECN is not set
# CONFIG_IP_NF_MATCH_TTL is not set
CONFIG_IP_NF_FILTER=y
CONFIG_IP_NF_TARGET_REJECT=y
CONFIG_IP_NF_TARGET_LOG=y
CONFIG_IP_NF_TARGET_ULOG=y
CONFIG_NF_NAT=y
CONFIG_NF_NAT_NEEDED=y
CONFIG_IP_NF_TARGET_MASQUERADE=y
CONFIG_IP_NF_TARGET_NETMAP=y
CONFIG_IP_NF_TARGET_REDIRECT=y
# CONFIG_NF_NAT_SNMP_BASIC is not set
# CONFIG_NF_NAT_FTP is not set
# CONFIG_NF_NAT_IRC is not set
# CONFIG_NF_NAT_TFTP is not set
# CONFIG_NF_NAT_AMANDA is not set

109

# CONFIG_NF_NAT_PPTP is not set


# CONFIG_NF_NAT_H323 is not set
# CONFIG_NF_NAT_SIP is not set
CONFIG_IP_NF_MANGLE=y
# CONFIG_IP_NF_TARGET_CLUSTERIP is not set
# CONFIG_IP_NF_TARGET_ECN is not set
# CONFIG_IP_NF_TARGET_TTL is not set
CONFIG_IP_NF_RAW=y
# CONFIG_IP_NF_ARPTABLES is not set
#
# IPv6: Netfilter Configuration
#
# CONFIG_NF_CONNTRACK_IPV6 is not set
# CONFIG_IP6_NF_QUEUE is not set
# CONFIG_IP6_NF_IPTABLES is not set
# CONFIG_IP_DCCP is not set
# CONFIG_IP_SCTP is not set
# CONFIG_RDS is not set
# CONFIG_TIPC is not set
# CONFIG_ATM is not set
# CONFIG_BRIDGE is not set
# CONFIG_NET_DSA is not set
# CONFIG_VLAN_8021Q is not set
# CONFIG_DECNET is not set
# CONFIG_LLC2 is not set
# CONFIG_IPX is not set
# CONFIG_ATALK is not set
# CONFIG_X25 is not set
# CONFIG_LAPB is not set
# CONFIG_ECONET is not set
# CONFIG_WAN_ROUTER is not set
# CONFIG_PHONET is not set
# CONFIG_IEEE802154 is not set
CONFIG_NET_SCHED=y
#
# Queueing/Scheduling
#
CONFIG_NET_SCH_CBQ=y
CONFIG_NET_SCH_HTB=y
CONFIG_NET_SCH_HFSC=y
CONFIG_NET_SCH_PRIO=y
# CONFIG_NET_SCH_MULTIQ is not set
# CONFIG_NET_SCH_RED is not set
CONFIG_NET_SCH_SFQ=y
# CONFIG_NET_SCH_TEQL is not set
# CONFIG_NET_SCH_TBF is not set
# CONFIG_NET_SCH_GRED is not set
CONFIG_NET_SCH_DSMARK=y
# CONFIG_NET_SCH_NETEM is not set
CONFIG_NET_SCH_DRR=y
CONFIG_NET_SCH_INGRESS=y
#
# Classification
#
CONFIG_NET_CLS=y
CONFIG_NET_CLS_BASIC=y
CONFIG_NET_CLS_TCINDEX=y

110

CONFIG_NET_CLS_ROUTE4=y
CONFIG_NET_CLS_ROUTE=y
CONFIG_NET_CLS_FW=y
CONFIG_NET_CLS_U32=y
CONFIG_CLS_U32_PERF=y
CONFIG_CLS_U32_MARK=y
# CONFIG_NET_CLS_RSVP is not set
# CONFIG_NET_CLS_RSVP6 is not set
CONFIG_NET_CLS_FLOW=y
# CONFIG_NET_EMATCH is not set
CONFIG_NET_CLS_ACT=y
CONFIG_NET_ACT_POLICE=y
CONFIG_NET_ACT_GACT=y
# CONFIG_GACT_PROB is not set
CONFIG_NET_ACT_MIRRED=y
CONFIG_NET_ACT_IPT=y
CONFIG_NET_ACT_NAT=y
# CONFIG_NET_ACT_PEDIT is not set
# CONFIG_NET_ACT_SIMP is not set
# CONFIG_NET_ACT_SKBEDIT is not set
CONFIG_NET_CLS_IND=y
CONFIG_NET_SCH_FIFO=y
# CONFIG_DCB is not set
#
# Network testing
#
# CONFIG_NET_PKTGEN is not set
# CONFIG_HAMRADIO is not set
# CONFIG_CAN is not set
# CONFIG_IRDA is not set
# CONFIG_BT is not set
# CONFIG_AF_RXRPC is not set
CONFIG_FIB_RULES=y
# CONFIG_WIRELESS is not set
# CONFIG_WIMAX is not set
# CONFIG_RFKILL is not set
# CONFIG_NET_9P is not set
#
# Device Drivers
#
#
# Generic Driver Options
#
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
# CONFIG_DEVTMPFS is not set
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y
CONFIG_FW_LOADER=y
CONFIG_FIRMWARE_IN_KERNEL=y
CONFIG_EXTRA_FIRMWARE=""
# CONFIG_SYS_HYPERVISOR is not set
# CONFIG_CONNECTOR is not set
CONFIG_MTD=y
# CONFIG_MTD_DEBUG is not set
# CONFIG_MTD_TESTS is not set
# CONFIG_MTD_CONCAT is not set
CONFIG_MTD_PARTITIONS=y

111

# CONFIG_MTD_REDBOOT_PARTS is not set


CONFIG_MTD_CMDLINE_PARTS=y
CONFIG_MTD_OF_PARTS=y
# CONFIG_MTD_AR7_PARTS is not set
#
# User Modules And Translation Layers
#
CONFIG_MTD_CHAR=y
CONFIG_MTD_BLKDEVS=y
CONFIG_MTD_BLOCK=y
CONFIG_FTL=y
# CONFIG_NFTL is not set
# CONFIG_INFTL is not set
# CONFIG_RFD_FTL is not set
# CONFIG_SSFDC is not set
# CONFIG_MTD_OOPS is not set
#
# RAM/ROM/Flash chip drivers
#
CONFIG_MTD_CFI=y
# CONFIG_MTD_JEDECPROBE is not set
CONFIG_MTD_GEN_PROBE=y
# CONFIG_MTD_CFI_ADV_OPTIONS is not set
CONFIG_MTD_MAP_BANK_WIDTH_1=y
CONFIG_MTD_MAP_BANK_WIDTH_2=y
CONFIG_MTD_MAP_BANK_WIDTH_4=y
# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
CONFIG_MTD_CFI_I1=y
CONFIG_MTD_CFI_I2=y
# CONFIG_MTD_CFI_I4 is not set
# CONFIG_MTD_CFI_I8 is not set
CONFIG_MTD_CFI_INTELEXT=y
CONFIG_MTD_CFI_AMDSTD=y
# CONFIG_MTD_CFI_STAA is not set
CONFIG_MTD_CFI_UTIL=y
# CONFIG_MTD_RAM is not set
# CONFIG_MTD_ROM is not set
# CONFIG_MTD_ABSENT is not set
#
# Mapping drivers for chip access
#
# CONFIG_MTD_COMPLEX_MAPPINGS is not set
# CONFIG_MTD_PHYSMAP is not set
CONFIG_MTD_PHYSMAP_OF=y
# CONFIG_MTD_INTEL_VR_NOR is not set
# CONFIG_MTD_PLATRAM is not set
#
# Self-contained MTD device drivers
#
# CONFIG_MTD_PMC551 is not set
# CONFIG_MTD_DATAFLASH is not set
CONFIG_MTD_FSL_M25P80=y
CONFIG_M25PXX_USE_FAST_READ=y
# CONFIG_MTD_SST25L is not set

112

#
#
#
#

CONFIG_MTD_SLRAM is not set


CONFIG_MTD_PHRAM is not set
CONFIG_MTD_MTDRAM is not set
CONFIG_MTD_BLOCK2MTD is not set

#
# Disk-On-Chip Device Drivers
#
# CONFIG_MTD_DOC2000 is not set
# CONFIG_MTD_DOC2001 is not set
# CONFIG_MTD_DOC2001PLUS is not set
CONFIG_MTD_NAND=y
# CONFIG_MTD_NAND_VERIFY_WRITE is not set
# CONFIG_MTD_NAND_ECC_SMC is not set
# CONFIG_MTD_NAND_MUSEUM_IDS is not set
CONFIG_MTD_NAND_IDS=y
# CONFIG_MTD_NAND_DISKONCHIP is not set
# CONFIG_MTD_NAND_CAFE is not set
# CONFIG_MTD_NAND_NANDSIM is not set
CONFIG_MTD_NAND_PLATFORM=y
# CONFIG_MTD_ALAUDA is not set
CONFIG_MTD_NAND_FSL_ELBC=y
CONFIG_MTD_NAND_FSL_UPM=y
# CONFIG_MTD_ONENAND is not set
#
# LPDDR flash memory drivers
#
# CONFIG_MTD_LPDDR is not set
#
# UBI - Unsorted block images
#
# CONFIG_MTD_UBI is not set
CONFIG_OF_DEVICE=y
CONFIG_OF_I2C=y
CONFIG_OF_SPI=y
CONFIG_OF_MDIO=y
# CONFIG_PARPORT is not set
CONFIG_BLK_DEV=y
# CONFIG_BLK_DEV_FD is not set
# CONFIG_BLK_CPQ_DA is not set
# CONFIG_BLK_CPQ_CISS_DA is not set
# CONFIG_BLK_DEV_DAC960 is not set
# CONFIG_BLK_DEV_UMEM is not set
# CONFIG_BLK_DEV_COW_COMMON is not set
CONFIG_BLK_DEV_LOOP=y
# CONFIG_BLK_DEV_CRYPTOLOOP is not set
CONFIG_BLK_DEV_NBD=y
# CONFIG_BLK_DEV_SX8 is not set
# CONFIG_BLK_DEV_UB is not set
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=131072
# CONFIG_BLK_DEV_XIP is not set
# CONFIG_CDROM_PKTCDVD is not set
# CONFIG_ATA_OVER_ETH is not set
# CONFIG_BLK_DEV_HD is not set
CONFIG_MISC_DEVICES=y
# CONFIG_PHANTOM is not set

113

#
#
#
#
#
#
#
#

CONFIG_SGI_IOC4 is not set


CONFIG_TIFM_CORE is not set
CONFIG_ICS932S401 is not set
CONFIG_FSL_STARLITE_TDM is not set
CONFIG_ENCLOSURE_SERVICES is not set
CONFIG_HP_ILO is not set
CONFIG_ISL29003 is not set
CONFIG_C2PORT is not set

#
# EEPROM support
#
# CONFIG_EEPROM_AT24 is not set
# CONFIG_EEPROM_AT25 is not set
# CONFIG_EEPROM_LEGACY is not set
# CONFIG_EEPROM_MAX6875 is not set
# CONFIG_EEPROM_93CX6 is not set
# CONFIG_CB710_CORE is not set
CONFIG_HAVE_IDE=y
# CONFIG_IDE is not set
#
# SCSI device support
#
# CONFIG_RAID_ATTRS is not set
CONFIG_SCSI=y
CONFIG_SCSI_DMA=y
# CONFIG_SCSI_TGT is not set
# CONFIG_SCSI_NETLINK is not set
CONFIG_SCSI_PROC_FS=y
#
# SCSI support type (disk, tape, CD-ROM)
#
CONFIG_BLK_DEV_SD=y
CONFIG_CHR_DEV_ST=y
# CONFIG_CHR_DEV_OSST is not set
CONFIG_BLK_DEV_SR=y
# CONFIG_BLK_DEV_SR_VENDOR is not set
CONFIG_CHR_DEV_SG=y
# CONFIG_CHR_DEV_SCH is not set
CONFIG_SCSI_MULTI_LUN=y
# CONFIG_SCSI_CONSTANTS is not set
CONFIG_SCSI_LOGGING=y
# CONFIG_SCSI_SCAN_ASYNC is not set
CONFIG_SCSI_WAIT_SCAN=m
#
# SCSI Transports
#
# CONFIG_SCSI_SPI_ATTRS is not set
# CONFIG_SCSI_FC_ATTRS is not set
# CONFIG_SCSI_ISCSI_ATTRS is not set
# CONFIG_SCSI_SAS_LIBSAS is not set
# CONFIG_SCSI_SRP_ATTRS is not set
CONFIG_SCSI_LOWLEVEL=y
# CONFIG_ISCSI_TCP is not set
# CONFIG_SCSI_BNX2_ISCSI is not set
# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
# CONFIG_SCSI_3W_9XXX is not set

114

# CONFIG_SCSI_ACARD is not set


# CONFIG_SCSI_AACRAID is not set
# CONFIG_SCSI_AIC7XXX is not set
# CONFIG_SCSI_AIC7XXX_OLD is not set
# CONFIG_SCSI_AIC79XX is not set
# CONFIG_SCSI_AIC94XX is not set
# CONFIG_SCSI_MVSAS is not set
# CONFIG_SCSI_DPT_I2O is not set
# CONFIG_SCSI_ADVANSYS is not set
# CONFIG_SCSI_ARCMSR is not set
# CONFIG_MEGARAID_NEWGEN is not set
# CONFIG_MEGARAID_LEGACY is not set
# CONFIG_MEGARAID_SAS is not set
# CONFIG_SCSI_MPT2SAS is not set
# CONFIG_SCSI_HPTIOP is not set
# CONFIG_SCSI_BUSLOGIC is not set
# CONFIG_LIBFC is not set
# CONFIG_LIBFCOE is not set
# CONFIG_FCOE is not set
# CONFIG_SCSI_DMX3191D is not set
# CONFIG_SCSI_EATA is not set
# CONFIG_SCSI_FUTURE_DOMAIN is not set
# CONFIG_SCSI_GDTH is not set
# CONFIG_SCSI_IPS is not set
# CONFIG_SCSI_INITIO is not set
# CONFIG_SCSI_INIA100 is not set
# CONFIG_SCSI_STEX is not set
# CONFIG_SCSI_SYM53C8XX_2 is not set
# CONFIG_SCSI_IPR is not set
# CONFIG_SCSI_QLOGIC_1280 is not set
# CONFIG_SCSI_QLA_FC is not set
# CONFIG_SCSI_QLA_ISCSI is not set
# CONFIG_SCSI_LPFC is not set
# CONFIG_SCSI_DC395x is not set
# CONFIG_SCSI_DC390T is not set
# CONFIG_SCSI_NSP32 is not set
# CONFIG_SCSI_DEBUG is not set
# CONFIG_SCSI_PMCRAID is not set
# CONFIG_SCSI_SRP is not set
# CONFIG_SCSI_DH is not set
# CONFIG_SCSI_OSD_INITIATOR is not set
CONFIG_ATA=y
# CONFIG_ATA_NONSTANDARD is not set
CONFIG_ATA_VERBOSE_ERROR=y
CONFIG_SATA_PMP=y
# CONFIG_SATA_AHCI is not set
CONFIG_SATA_SIL24=y
# CONFIG_SATA_FSL is not set
CONFIG_ATA_SFF=y
# CONFIG_SATA_SVW is not set
# CONFIG_ATA_PIIX is not set
# CONFIG_SATA_MV is not set
# CONFIG_SATA_NV is not set
# CONFIG_PDC_ADMA is not set
# CONFIG_SATA_QSTOR is not set
# CONFIG_SATA_PROMISE is not set
# CONFIG_SATA_SX4 is not set
# CONFIG_SATA_SIL is not set
# CONFIG_SATA_SIS is not set
# CONFIG_SATA_ULI is not set

115

# CONFIG_SATA_VIA is not set


# CONFIG_SATA_VITESSE is not set
# CONFIG_SATA_INIC162X is not set
# CONFIG_PATA_ALI is not set
# CONFIG_PATA_AMD is not set
# CONFIG_PATA_ARTOP is not set
# CONFIG_PATA_ATP867X is not set
# CONFIG_PATA_ATIIXP is not set
# CONFIG_PATA_CMD640_PCI is not set
# CONFIG_PATA_CMD64X is not set
# CONFIG_PATA_CS5520 is not set
# CONFIG_PATA_CS5530 is not set
# CONFIG_PATA_CYPRESS is not set
# CONFIG_PATA_EFAR is not set
# CONFIG_ATA_GENERIC is not set
# CONFIG_PATA_HPT366 is not set
# CONFIG_PATA_HPT37X is not set
# CONFIG_PATA_HPT3X2N is not set
# CONFIG_PATA_HPT3X3 is not set
# CONFIG_PATA_IT821X is not set
# CONFIG_PATA_IT8213 is not set
# CONFIG_PATA_JMICRON is not set
# CONFIG_PATA_TRIFLEX is not set
# CONFIG_PATA_MARVELL is not set
# CONFIG_PATA_MPIIX is not set
# CONFIG_PATA_OLDPIIX is not set
# CONFIG_PATA_NETCELL is not set
# CONFIG_PATA_NINJA32 is not set
# CONFIG_PATA_NS87410 is not set
# CONFIG_PATA_NS87415 is not set
# CONFIG_PATA_OPTI is not set
# CONFIG_PATA_OPTIDMA is not set
# CONFIG_PATA_PDC_OLD is not set
# CONFIG_PATA_RADISYS is not set
# CONFIG_PATA_RDC is not set
# CONFIG_PATA_RZ1000 is not set
# CONFIG_PATA_SC1200 is not set
# CONFIG_PATA_SERVERWORKS is not set
# CONFIG_PATA_PDC2027X is not set
# CONFIG_PATA_SIL680 is not set
# CONFIG_PATA_SIS is not set
# CONFIG_PATA_VIA is not set
# CONFIG_PATA_WINBOND is not set
# CONFIG_PATA_PLATFORM is not set
# CONFIG_PATA_SCH is not set
CONFIG_MD=y
CONFIG_BLK_DEV_MD=y
CONFIG_MD_AUTODETECT=y
# CONFIG_MD_LINEAR is not set
# CONFIG_MD_RAID0 is not set
# CONFIG_MD_RAID1 is not set
# CONFIG_MD_RAID10 is not set
CONFIG_MD_RAID456=y
# CONFIG_MULTICORE_RAID456 is not set
CONFIG_MD_RAID6_PQ=y
# CONFIG_ASYNC_RAID6_TEST is not set
# CONFIG_MD_MULTIPATH is not set
# CONFIG_MD_FAULTY is not set
# CONFIG_BLK_DEV_DM is not set
# CONFIG_FUSION is not set

116

#
# IEEE 1394 (FireWire) support
#
#
# You can enable one or both FireWire driver stacks.
#
#
# See the help texts for more information.
#
# CONFIG_FIREWIRE is not set
# CONFIG_IEEE1394 is not set
# CONFIG_I2O is not set
# CONFIG_MACINTOSH_DRIVERS is not set
CONFIG_NETDEVICES=y
# CONFIG_IFB is not set
CONFIG_DUMMY=y
# CONFIG_BONDING is not set
# CONFIG_MACVLAN is not set
# CONFIG_EQUALIZER is not set
# CONFIG_TUN is not set
# CONFIG_VETH is not set
#
# MPC85xx PCI agent mode driver
#
# CONFIG_CARDNET is not set
#
# MPC85xx board PCI demo driver
#
# CONFIG_BOARDNET is not set
# CONFIG_ARCNET is not set
CONFIG_PHYLIB=y
#
# MII PHY device drivers
#
# CONFIG_MARVELL_PHY is not set
# CONFIG_DAVICOM_PHY is not set
# CONFIG_QSEMI_PHY is not set
# CONFIG_LXT_PHY is not set
# CONFIG_CICADA_PHY is not set
CONFIG_VITESSE_PHY=y
# CONFIG_SMSC_PHY is not set
# CONFIG_BROADCOM_PHY is not set
# CONFIG_ICPLUS_PHY is not set
# CONFIG_REALTEK_PHY is not set
# CONFIG_NATIONAL_PHY is not set
# CONFIG_STE10XP is not set
# CONFIG_LSI_ET1011C_PHY is not set
CONFIG_FIXED_PHY=y
# CONFIG_MDIO_BITBANG is not set
CONFIG_NET_ETHERNET=y
CONFIG_MII=y
# CONFIG_HAPPYMEAL is not set
# CONFIG_SUNGEM is not set
# CONFIG_CASSINI is not set

117

# CONFIG_NET_VENDOR_3COM is not set


# CONFIG_ENC28J60 is not set
# CONFIG_ETHOC is not set
# CONFIG_DNET is not set
# CONFIG_NET_TULIP is not set
# CONFIG_HP100 is not set
# CONFIG_IBM_NEW_EMAC_ZMII is not set
# CONFIG_IBM_NEW_EMAC_RGMII is not set
# CONFIG_IBM_NEW_EMAC_TAH is not set
# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
# CONFIG_NET_PCI is not set
# CONFIG_B44 is not set
# CONFIG_KS8842 is not set
# CONFIG_KS8851 is not set
# CONFIG_KS8851_MLL is not set
# CONFIG_ATL2 is not set
# CONFIG_XILINX_EMACLITE is not set
CONFIG_NETDEV_1000=y
# CONFIG_ACENIC is not set
# CONFIG_DL2K is not set
# CONFIG_E1000 is not set
CONFIG_E1000E=y
# CONFIG_IP1000 is not set
# CONFIG_IGB is not set
# CONFIG_IGBVF is not set
# CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set
# CONFIG_R8169 is not set
# CONFIG_SIS190 is not set
# CONFIG_SKGE is not set
# CONFIG_SKY2 is not set
# CONFIG_VIA_VELOCITY is not set
# CONFIG_TIGON3 is not set
# CONFIG_BNX2 is not set
# CONFIG_CNIC is not set
CONFIG_FSL_PQ_MDIO=y
CONFIG_GIANFAR=y
CONFIG_GFAR_SKBUFF_RECYCLING=y
# CONFIG_GIANFAR_TXNAPI is not set
# CONFIG_1588_MUX_eTSEC1 is not set
# CONFIG_1588_MUX_eTSEC2 is not set
CONFIG_GIANFAR_L2SRAM=y
CONFIG_NET_GIANFAR_FP=y
# CONFIG_MV643XX_ETH is not set
# CONFIG_QLA3XXX is not set
# CONFIG_ATL1 is not set
# CONFIG_ATL1E is not set
# CONFIG_ATL1C is not set
# CONFIG_JME is not set
# CONFIG_NETDEV_10000 is not set
# CONFIG_TR is not set
CONFIG_WLAN=y
# CONFIG_WLAN_PRE80211 is not set
# CONFIG_WLAN_80211 is not set
#

118

# Enable WiMAX (Networking options) to see the WiMAX drivers


#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#

USB Network Adapters


CONFIG_USB_CATC is not set
CONFIG_USB_KAWETH is not set
CONFIG_USB_PEGASUS is not set
CONFIG_USB_RTL8150 is not set
CONFIG_USB_USBNET is not set
CONFIG_WAN is not set
CONFIG_FDDI is not set
CONFIG_HIPPI is not set
CONFIG_PPP is not set
CONFIG_SLIP is not set
CONFIG_NET_FC is not set
CONFIG_NETCONSOLE is not set
CONFIG_NETPOLL is not set
CONFIG_NET_POLL_CONTROLLER is not set
CONFIG_ISDN is not set
CONFIG_PHONE is not set

#
# Input device support
#
CONFIG_INPUT=y
CONFIG_INPUT_FF_MEMLESS=m
# CONFIG_INPUT_POLLDEV is not set
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#

Userland interfaces
CONFIG_INPUT_MOUSEDEV is not set
CONFIG_INPUT_JOYDEV is not set
CONFIG_INPUT_EVDEV is not set
CONFIG_INPUT_EVBUG is not set
Input Device Drivers
CONFIG_INPUT_KEYBOARD is not set
CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_JOYSTICK is not set
CONFIG_INPUT_TABLET is not set
CONFIG_INPUT_TOUCHSCREEN is n ot set
CONFIG_INPUT_MISC is not set

#
# Hardware I/O ports
#
CONFIG_SERIO=y
CONFIG_SERIO_I8042=y
CONFIG_SERIO_SERPORT=y
# CONFIG_SERIO_PCIPS2 is not set
CONFIG_SERIO_LIBPS2=y
# CONFIG_SERIO_RAW is not set
# CONFIG_SERIO_XILINX_XPS_PS2 is not set
# CONFIG_GAMEPORT is not set

119

#
# Character devices
#
CONFIG_VT=y
CONFIG_CONSOLE_TRANSLATIONS=y
CONFIG_VT_CONSOLE=y
CONFIG_HW_CONSOLE=y
# CONFIG_VT_HW_CONSOLE_BINDING is not set
CONFIG_DEVKMEM=y
# CONFIG_SERIAL_NONSTANDARD is not set
# CONFIG_NOZOMI is not set
#
# Serial drivers
#
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_PCI=y
CONFIG_SERIAL_8250_NR_UARTS=2
CONFIG_SERIAL_8250_RUNTIME_UARTS=2
CONFIG_SERIAL_8250_EXTENDED=y
CONFIG_SERIAL_8250_MANY_PORTS=y
CONFIG_SERIAL_8250_SHARE_IRQ=y
CONFIG_SERIAL_8250_DETECT_IRQ=y
CONFIG_SERIAL_8250_RSA=y
#
# Non-8250 serial port support
#
# CONFIG_SERIAL_MAX3100 is not set
# CONFIG_SERIAL_UARTLITE is not set
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
# CONFIG_SERIAL_JSM is not set
# CONFIG_SERIAL_OF_PLATFORM is not set
CONFIG_UNIX98_PTYS=y
# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=256
# CONFIG_HVC_UDBG is not set
# CONFIG_IPMI_HANDLER is not set
CONFIG_HW_RANDOM=y
# CONFIG_HW_RANDOM_TIMERIOMEM is not set
CONFIG_NVRAM=y
# CONFIG_R3964 is not set
# CONFIG_APPLICOM is not set
# CONFIG_RAW_DRIVER is not set
# CONFIG_TCG_TPM is not set
CONFIG_DEVPORT=y
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_COMPAT=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_HELPER_AUTO=y
#
# I2C Hardware Bus support
#
#

120

#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#

PC SMBus host controller drivers


CONFIG_I2C_ALI1535 is not set
CONFIG_I2C_ALI1563 is not set
CONFIG_I2C_ALI15X3 is not set
CONFIG_I2C_AMD756 is not set
CONFIG_I2C_AMD8111 is not set
CONFIG_I2C_I801 is not set
CONFIG_I2C_ISCH is not set
CONFIG_I2C_PIIX4 is not set
CONFIG_I2C_NFORCE2 is not set
CONFIG_I2C_SIS5595 is not set
CONFIG_I2C_SIS630 is not set
CONFIG_I2C_SIS96X is not set
CONFIG_I2C_VIA is not set
CONFIG_I2C_VIAPRO is not set

#
# I2C system bus drivers (mostly embedded / system-on-chip)
#
CONFIG_I2C_MPC=y
# CONFIG_I2C_OCORES is not set
# CONFIG_I2C_SIMTEC is not set
#
#
#
#
#
#

External I2C/SMBus adapter drivers


CONFIG_I2C_PARPORT_LIGHT is not set
CONFIG_I2C_TAOS_EVM is not set
CONFIG_I2C_TINY_USB is not set

#
# Graphics adapter I2C/DDC channel drivers
#
# CONFIG_I2C_VOODOO3 is not set
#
# Other I2C/SMBus bus drivers
#
# CONFIG_I2C_PCA_PLATFORM is not set
# CONFIG_I2C_STUB is not set
#
# Miscellaneous I2C Chip support
#
# CONFIG_DS1682 is not set
# CONFIG_SENSORS_TSL2550 is not set
# CONFIG_I2C_DEBUG_CORE is not set
# CONFIG_I2C_DEBUG_ALGO is not set
# CONFIG_I2C_DEBUG_BUS is not set
# CONFIG_I2C_DEBUG_CHIP is not set
CONFIG_SPI=y
CONFIG_SPI_MASTER=y
#
# SPI Master Controller Drivers
#
CONFIG_SPI_BITBANG=y
# CONFIG_SPI_MPC8xxx is not set
CONFIG_FSL_ESPI=y

121

#
# SPI Protocol Masters
#
# CONFIG_SPI_SPIDEV is not set
# CONFIG_SPI_TLE62X0 is not set
#
# PPS support
#
# CONFIG_PPS is not set
CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
# CONFIG_GPIOLIB is not set
# CONFIG_W1 is not set
# CONFIG_POWER_SUPPLY is not set
# CONFIG_HWMON is not set
# CONFIG_THERMAL is not set
# CONFIG_WATCHDOG is not set
CONFIG_SSB_POSSIBLE=y
#
# Sonics Silicon Backplane
#
# CONFIG_SSB is not set
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#

Multifunction device drivers


CONFIG_MFD_CORE is not set
CONFIG_MFD_SM501 is not set
CONFIG_HTC_PASIC3 is not set
CONFIG_TWL4030_CORE is not set
CONFIG_MFD_TMIO is not set
CONFIG_PMIC_DA903X is not set
CONFIG_MFD_WM8400 is not set
CONFIG_MFD_WM831X is not set
CONFIG_MFD_WM8350_I2C is not set
CONFIG_MFD_PCF50633 is not set
CONFIG_MFD_MC13783 is not set
CONFIG_AB3100_CORE is not set
CONFIG_EZX_PCAP is not set
CONFIG_REGULATOR is not set
CONFIG_MEDIA_SUPPORT is not set

#
# Graphics support
#
# CONFIG_AGP is not set
CONFIG_VGA_ARB=y
# CONFIG_DRM is not set
# CONFIG_VGASTATE is not set
CONFIG_VIDEO_OUTPUT_CONTROL=y
# CONFIG_FB is not set
# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
#
# Display device support
#
# CONFIG_DISPLAY_SUPPORT is not set

122

#
# Console display driver support
#
CONFIG_VGA_CONSOLE=y
# CONFIG_VGACON_SOFT_SCROLLBACK is not set
CONFIG_DUMMY_CONSOLE=y
# CONFIG_SOUND is not set
# CONFIG_HID_SUPPORT is not set
CONFIG_USB_SUPPORT=y
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB_ARCH_HAS_OHCI=y
CONFIG_USB_ARCH_HAS_EHCI=y
CONFIG_USB=y
# CONFIG_USB_DEBUG is not set
# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
#
# Miscellaneous USB options
#
CONFIG_USB_DEVICEFS=y
# CONFIG_USB_DEVICE_CLASS is not set
# CONFIG_USB_DYNAMIC_MINORS is not set
# CONFIG_USB_OTG is not set
# CONFIG_USB_OTG_WHITELIST is not set
# CONFIG_USB_OTG_BLACKLIST_HUB is not set
# CONFIG_USB_MON is not set
# CONFIG_USB_WUSB is not set
# CONFIG_USB_WUSB_CBAF is not set
#
# USB Host Controller Drivers
#
# CONFIG_USB_C67X00_HCD is not set
# CONFIG_USB_XHCI_HCD is not set
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_ROOT_HUB_TT=y
# CONFIG_USB_EHCI_TT_NEWSCHED is not set
CONFIG_USB_EHCI_FSL=y
CONFIG_USB_EHCI_HCD_PPC_OF=y
# CONFIG_USB_OXU210HP_HCD is not set
# CONFIG_USB_ISP116X_HCD is not set
# CONFIG_USB_ISP1760_HCD is not set
# CONFIG_USB_ISP1362_HCD is not set
# CONFIG_USB_OHCI_HCD is not set
# CONFIG_USB_UHCI_HCD is not set
# CONFIG_USB_SL811_HCD is not set
# CONFIG_USB_R8A66597_HCD is not set
# CONFIG_USB_WHCI_HCD is not set
# CONFIG_USB_HWA_HCD is not set
#
#
#
#
#
#
#

USB Device Class drivers


CONFIG_USB_ACM is not
CONFIG_USB_PRINTER is
CONFIG_USB_WDM is not
CONFIG_USB_TMC is not

set
not set
set
set

#
# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may

123

#
#
# also be needed; see USB_STORAGE Help for more info
#
CONFIG_USB_STORAGE=y
# CONFIG_USB_STORAGE_DEBUG is not set
# CONFIG_USB_STORAGE_DATAFAB is not set
# CONFIG_USB_STORAGE_FREECOM is not set
# CONFIG_USB_STORAGE_ISD200 is not set
# CONFIG_USB_STORAGE_USBAT is not set
# CONFIG_USB_STORAGE_SDDR09 is not set
# CONFIG_USB_STORAGE_SDDR55 is not set
# CONFIG_USB_STORAGE_JUMPSHOT is not set
# CONFIG_USB_STORAGE_ALAUDA is not set
# CONFIG_USB_STORAGE_ONETOUCH is not set
# CONFIG_USB_STORAGE_KARMA is not set
# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
# CONFIG_USB_LIBUSUAL is not set
#
# USB Imaging devices
#
# CONFIG_USB_MDC800 is not set
# CONFIG_USB_MICROTEK is not set
#
# USB port drivers
#
# CONFIG_USB_SERIAL is not set
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#

USB Miscellaneous drivers


CONFIG_USB_EMI62 is not set
CONFIG_USB_EMI26 is not set
CONFIG_USB_ADUTUX is not set
CONFIG_USB_SEVSEG is not set
CONFIG_USB_RIO500 is not set
CONFIG_USB_LEGOTOWER is not set
CONFIG_USB_LCD is not set
CONFIG_USB_BERRY_CHARGE is not set
CONFIG_USB_LED is not set
CONFIG_USB_CYPRESS_CY7C63 is not set
CONFIG_USB_CYTHERM is not set
CONFIG_USB_IDMOUSE is not set
CONFIG_USB_FTDI_ELAN is not set
CONFIG_USB_APPLEDISPLAY is not set
CONFIG_USB_SISUSBVGA is not set
CONFIG_USB_LD is not set
CONFIG_USB_TRANCEVIBRATOR is not set
CONFIG_USB_IOWARRIOR is not set
CONFIG_USB_TEST is not set
CONFIG_USB_ISIGHTFW is not set
CONFIG_USB_VST is not set
CONFIG_USB_GADGET is not set

#
# OTG and related infrastructure
#

124

# CONFIG_NOP_USB_XCEIV is not set


# CONFIG_UWB is not set
# CONFIG_MMC is not set
# CONFIG_MEMSTICK is not set
# CONFIG_NEW_LEDS is not set
# CONFIG_ACCESSIBILITY is not set
# CONFIG_INFINIBAND is not set
# CONFIG_EDAC is not set
CONFIG_RTC_LIB=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
# CONFIG_RTC_DEBUG is not set
#
# RTC interfaces
#
CONFIG_RTC_INTF_SYSFS=y
CONFIG_RTC_INTF_PROC=y
CONFIG_RTC_INTF_DEV=y
# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
# CONFIG_RTC_DRV_TEST is not set
#
# I2C RTC drivers
#
CONFIG_RTC_DRV_DS1307=y
# CONFIG_RTC_DRV_DS1374 is not set
# CONFIG_RTC_DRV_DS1672 is not set
# CONFIG_RTC_DRV_MAX6900 is not set
# CONFIG_RTC_DRV_RS5C372 is not set
# CONFIG_RTC_DRV_ISL1208 is not set
# CONFIG_RTC_DRV_X1205 is not set
# CONFIG_RTC_DRV_PCF8563 is not set
# CONFIG_RTC_DRV_PCF8583 is not set
# CONFIG_RTC_DRV_M41T80 is not set
# CONFIG_RTC_DRV_S35390A is not set
# CONFIG_RTC_DRV_FM3130 is not set
# CONFIG_RTC_DRV_RX8581 is not set
# CONFIG_RTC_DRV_RX8025 is not set
#
#
#
#
#
#
#
#
#
#
#

SPI RTC drivers


CONFIG_RTC_DRV_M41T94 is not set
CONFIG_RTC_DRV_DS1305 is not set
CONFIG_RTC_DRV_DS1390 is not set
CONFIG_RTC_DRV_MAX6902 is not set
CONFIG_RTC_DRV_R9701 is not set
CONFIG_RTC_DRV_RS5C348 is not set
CONFIG_RTC_DRV_DS3234 is not set
CONFIG_RTC_DRV_PCF2123 is not set

#
# Platform RTC drivers
#
CONFIG_RTC_DRV_CMOS=y
# CONFIG_RTC_DRV_DS1286 is not set
# CONFIG_RTC_DRV_DS1511 is not set
# CONFIG_RTC_DRV_DS1553 is not set

125

#
#
#
#
#
#
#

CONFIG_RTC_DRV_DS1742 is not set


CONFIG_RTC_DRV_STK17TA8 is not set
CONFIG_RTC_DRV_M48T86 is not set
CONFIG_RTC_DRV_M48T35 is not set
CONFIG_RTC_DRV_M48T59 is not set
CONFIG_RTC_DRV_BQ4802 is not set
CONFIG_RTC_DRV_V3020 is not set

#
# on-CPU RTC drivers
#
# CONFIG_RTC_DRV_GENERIC is not set
CONFIG_DMADEVICES=y
#
# DMA Devices
#
CONFIG_FSL_DMA=y
CONFIG_DMA_ENGINE=y
#
# DMA Clients
#
# CONFIG_NET_DMA is not set
CONFIG_ASYNC_TX_DMA=y
# CONFIG_DMATEST is not set
# CONFIG_AUXDISPLAY is not set
# CONFIG_UIO is not set
#
# TI VLYNQ
#
# CONFIG_STAGING is not set
#
# File systems
#
CONFIG_EXT2_FS=y
# CONFIG_EXT2_FS_XATTR is not set
# CONFIG_EXT2_FS_XIP is not set
CONFIG_EXT3_FS=y
# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
CONFIG_EXT3_FS_XATTR=y
# CONFIG_EXT3_FS_POSIX_ACL is not set
# CONFIG_EXT3_FS_SECURITY is not set
# CONFIG_EXT4_FS is not set
CONFIG_JBD=y
CONFIG_FS_MBCACHE=y
# CONFIG_REISERFS_FS is not set
# CONFIG_JFS_FS is not set
CONFIG_FS_POSIX_ACL=y
CONFIG_XFS_FS=y
# CONFIG_XFS_QUOTA is not set
# CONFIG_XFS_POSIX_ACL is not set
# CONFIG_XFS_RT is not set
# CONFIG_XFS_DEBUG is not set
# CONFIG_GFS2_FS is not set
# CONFIG_OCFS2_FS is not set
# CONFIG_BTRFS_FS is not set
# CONFIG_NILFS2_FS is not set

126

CONFIG_FILE_LOCKING=y
CONFIG_FSNOTIFY=y
CONFIG_DNOTIFY=y
CONFIG_INOTIFY=y
CONFIG_INOTIFY_USER=y
# CONFIG_QUOTA is not set
# CONFIG_AUTOFS_FS is not set
# CONFIG_AUTOFS4_FS is not set
# CONFIG_FUSE_FS is not set
#
# Caches
#
# CONFIG_FSCACHE is not set
#
# CD-ROM/DVD Filesystems
#
CONFIG_ISO9660_FS=m
CONFIG_JOLIET=y
CONFIG_ZISOFS=y
CONFIG_UDF_FS=m
CONFIG_UDF_NLS=y
#
# DOS/FAT/NT Filesystems
#
CONFIG_FAT_FS=y
CONFIG_MSDOS_FS=m
CONFIG_VFAT_FS=y
CONFIG_FAT_DEFAULT_CODEPAGE=437
CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
CONFIG_NTFS_FS=y
# CONFIG_NTFS_DEBUG is not set
# CONFIG_NTFS_RW is not set
#
# Pseudo filesystems
#
CONFIG_PROC_FS=y
CONFIG_PROC_KCORE=y
CONFIG_PROC_SYSCTL=y
CONFIG_PROC_PAGE_MONITOR=y
CONFIG_SYSFS=y
CONFIG_TMPFS=y
# CONFIG_TMPFS_POSIX_ACL is not set
# CONFIG_HUGETLB_PAGE is not set
# CONFIG_CONFIGFS_FS is not set
CONFIG_MISC_FILESYSTEMS=y
# CONFIG_ADFS_FS is not set
# CONFIG_AFFS_FS is not set
# CONFIG_HFS_FS is not set
# CONFIG_HFSPLUS_FS is not set
# CONFIG_BEFS_FS is not set
# CONFIG_BFS_FS is not set
# CONFIG_EFS_FS is not set
CONFIG_JFFS2_FS=y
CONFIG_JFFS2_FS_DEBUG=1
CONFIG_JFFS2_FS_WRITEBUFFER=y
CONFIG_JFFS2_FS_WBUF_VERIFY=y

127

CONFIG_JFFS2_SUMMARY=y
CONFIG_JFFS2_FS_XATTR=y
CONFIG_JFFS2_FS_POSIX_ACL=y
CONFIG_JFFS2_FS_SECURITY=y
CONFIG_JFFS2_COMPRESSION_OPTIONS=y
CONFIG_JFFS2_ZLIB=y
CONFIG_JFFS2_LZO=y
CONFIG_JFFS2_RTIME=y
CONFIG_JFFS2_RUBIN=y
# CONFIG_JFFS2_CMODE_NONE is not set
CONFIG_JFFS2_CMODE_PRIORITY=y
# CONFIG_JFFS2_CMODE_SIZE is not set
# CONFIG_JFFS2_CMODE_FAVOURLZO is not set
# CONFIG_CRAMFS is not set
# CONFIG_SQUASHFS is not set
# CONFIG_VXFS_FS is not set
# CONFIG_MINIX_FS is not set
# CONFIG_OMFS_FS is not set
# CONFIG_HPFS_FS is not set
# CONFIG_QNX4FS_FS is not set
# CONFIG_ROMFS_FS is not set
# CONFIG_SYSV_FS is not set
# CONFIG_UFS_FS is not set
CONFIG_NETWORK_FILESYSTEMS=y
CONFIG_NFS_FS=y
CONFIG_NFS_V3=y
# CONFIG_NFS_V3_ACL is not set
CONFIG_NFS_V4=y
# CONFIG_NFS_V4_1 is not set
CONFIG_ROOT_NFS=y
CONFIG_NFSD=y
# CONFIG_NFSD_V3 is not set
# CONFIG_NFSD_V4 is not set
CONFIG_LOCKD=y
CONFIG_LOCKD_V4=y
CONFIG_EXPORTFS=y
CONFIG_NFS_COMMON=y
CONFIG_SUNRPC=y
CONFIG_SUNRPC_GSS=y
CONFIG_RPCSEC_GSS_KRB5=y
# CONFIG_RPCSEC_GSS_SPKM3 is not set
# CONFIG_SMB_FS is not set
CONFIG_CIFS=y
# CONFIG_CIFS_STATS is not set
# CONFIG_CIFS_WEAK_PW_HASH is not set
# CONFIG_CIFS_XATTR is not set
# CONFIG_CIFS_DEBUG2 is not set
# CONFIG_CIFS_EXPERIMENTAL is not set
# CONFIG_NCP_FS is not set
# CONFIG_CODA_FS is not set
# CONFIG_AFS_FS is not set
#
# Partition Types
#
CONFIG_PARTITION_ADVANCED=y
# CONFIG_ACORN_PARTITION is not set
# CONFIG_OSF_PARTITION is not set
# CONFIG_AMIGA_PARTITION is not set
# CONFIG_ATARI_PARTITION is not set

128

CONFIG_MAC_PARTITION=y
CONFIG_MSDOS_PARTITION=y
# CONFIG_BSD_DISKLABEL is not set
# CONFIG_MINIX_SUBPARTITION is not set
# CONFIG_SOLARIS_X86_PARTITION is not set
# CONFIG_UNIXWARE_DISKLABEL is not set
# CONFIG_LDM_PARTITION is not set
# CONFIG_SGI_PARTITION is not set
# CONFIG_ULTRIX_PARTITION is not set
# CONFIG_SUN_PARTITION is not set
# CONFIG_KARMA_PARTITION is not set
# CONFIG_EFI_PARTITION is not set
# CONFIG_SYSV68_PARTITION is not set
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-1"
# CONFIG_NLS_CODEPAGE_437 is not set
# CONFIG_NLS_CODEPAGE_737 is not set
# CONFIG_NLS_CODEPAGE_775 is not set
# CONFIG_NLS_CODEPAGE_850 is not set
# CONFIG_NLS_CODEPAGE_852 is not set
# CONFIG_NLS_CODEPAGE_855 is not set
# CONFIG_NLS_CODEPAGE_857 is not set
# CONFIG_NLS_CODEPAGE_860 is not set
# CONFIG_NLS_CODEPAGE_861 is not set
# CONFIG_NLS_CODEPAGE_862 is not set
# CONFIG_NLS_CODEPAGE_863 is not set
# CONFIG_NLS_CODEPAGE_864 is not set
# CONFIG_NLS_CODEPAGE_865 is not set
# CONFIG_NLS_CODEPAGE_866 is not set
# CONFIG_NLS_CODEPAGE_869 is not set
# CONFIG_NLS_CODEPAGE_936 is not set
# CONFIG_NLS_CODEPAGE_950 is not set
# CONFIG_NLS_CODEPAGE_932 is not set
# CONFIG_NLS_CODEPAGE_949 is not set
# CONFIG_NLS_CODEPAGE_874 is not set
# CONFIG_NLS_ISO8859_8 is not set
# CONFIG_NLS_CODEPAGE_1250 is not set
# CONFIG_NLS_CODEPAGE_1251 is not set
# CONFIG_NLS_ASCII is not set
# CONFIG_NLS_ISO8859_1 is not set
# CONFIG_NLS_ISO8859_2 is not set
# CONFIG_NLS_ISO8859_3 is not set
# CONFIG_NLS_ISO8859_4 is not set
# CONFIG_NLS_ISO8859_5 is not set
# CONFIG_NLS_ISO8859_6 is not set
# CONFIG_NLS_ISO8859_7 is not set
# CONFIG_NLS_ISO8859_9 is not set
# CONFIG_NLS_ISO8859_13 is not set
# CONFIG_NLS_ISO8859_14 is not set
# CONFIG_NLS_ISO8859_15 is not set
# CONFIG_NLS_KOI8_R is not set
# CONFIG_NLS_KOI8_U is not set
# CONFIG_NLS_UTF8 is not set
# CONFIG_DLM is not set
# CONFIG_BINARY_PRINTF is not set
#
# Library routines
#
CONFIG_BITREVERSE=y

129

CONFIG_GENERIC_FIND_LAST_BIT=y
# CONFIG_CRC_CCITT is not set
# CONFIG_CRC16 is not set
CONFIG_CRC_T10DIF=y
CONFIG_CRC_ITU_T=m
CONFIG_CRC32=y
# CONFIG_CRC7 is not set
# CONFIG_LIBCRC32C is not set
CONFIG_ZLIB_INFLATE=y
CONFIG_ZLIB_DEFLATE=y
CONFIG_LZO_COMPRESS=y
CONFIG_LZO_DECOMPRESS=y
CONFIG_DECOMPRESS_GZIP=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_HAS_DMA=y
CONFIG_HAVE_LMB=y
CONFIG_NLATTR=y
CONFIG_GENERIC_ATOMIC64=y
#
# Kernel hacking
#
# CONFIG_PRINTK_TIME is not set
CONFIG_ENABLE_WARN_DEPRECATED=y
CONFIG_ENABLE_MUST_CHECK=y
CONFIG_FRAME_WARN=1024
# CONFIG_MAGIC_SYSRQ is not set
# CONFIG_STRIP_ASM_SYMS is not set
# CONFIG_UNUSED_SYMBOLS is not set
# CONFIG_DEBUG_FS is not set
# CONFIG_HEADERS_CHECK is not set
# CONFIG_DEBUG_KERNEL is not set
# CONFIG_SLUB_DEBUG_ON is not set
# CONFIG_SLUB_STATS is not set
# CONFIG_DEBUG_BUGVERBOSE is not set
# CONFIG_DEBUG_MEMORY_INIT is not set
# CONFIG_RCU_CPU_STALL_DETECTOR is not set
# CONFIG_LATENCYTOP is not set
# CONFIG_SYSCTL_SYSCALL_CHECK is not set
CONFIG_HAVE_FUNCTION_TRACER=y
CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
CONFIG_HAVE_DYNAMIC_FTRACE=y
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
CONFIG_TRACING_SUPPORT=y
# CONFIG_FTRACE is not set
# CONFIG_DMA_API_DEBUG is not set
# CONFIG_SAMPLES is not set
CONFIG_HAVE_ARCH_KGDB=y
# CONFIG_PPC_DISABLE_WERROR is not set
CONFIG_PPC_WERROR=y
CONFIG_PRINT_STACK_DEPTH=64
# CONFIG_IRQSTACKS is not set
# CONFIG_PPC_EARLY_DEBUG is not set
#
# Security options
#
# CONFIG_KEYS is not set
# CONFIG_SECURITY is not set

130

# CONFIG_SECURITYFS is not set


# CONFIG_SECURITY_FILE_CAPABILITIES is not set
CONFIG_XOR_BLOCKS=y
CONFIG_ASYNC_CORE=y
CONFIG_ASYNC_MEMCPY=y
CONFIG_ASYNC_XOR=y
CONFIG_ASYNC_PQ=y
CONFIG_ASYNC_RAID6_RECOV=y
CONFIG_CRYPTO=y
#
# Crypto core or helper
#
CONFIG_CRYPTO_ALGAPI=y
CONFIG_CRYPTO_ALGAPI2=y
CONFIG_CRYPTO_AEAD=y
CONFIG_CRYPTO_AEAD2=y
CONFIG_CRYPTO_BLKCIPHER=y
CONFIG_CRYPTO_BLKCIPHER2=y
CONFIG_CRYPTO_HASH=y
CONFIG_CRYPTO_HASH2=y
CONFIG_CRYPTO_RNG2=y
CONFIG_CRYPTO_PCOMP=y
CONFIG_CRYPTO_MANAGER=y
CONFIG_CRYPTO_MANAGER2=y
# CONFIG_CRYPTO_GF128MUL is not set
# CONFIG_CRYPTO_NULL is not set
CONFIG_CRYPTO_WORKQUEUE=y
# CONFIG_CRYPTO_CRYPTD is not set
CONFIG_CRYPTO_AUTHENC=y
# CONFIG_CRYPTO_TEST is not set
#
#
#
#
#
#

Authenticated Encryption with Associated Data


CONFIG_CRYPTO_CCM is not set
CONFIG_CRYPTO_GCM is not set
CONFIG_CRYPTO_SEQIV is not set

#
# Block modes
#
CONFIG_CRYPTO_CBC=y
# CONFIG_CRYPTO_CTR is not set
# CONFIG_CRYPTO_CTS is not set
CONFIG_CRYPTO_ECB=y
# CONFIG_CRYPTO_LRW is not set
CONFIG_CRYPTO_PCBC=y
# CONFIG_CRYPTO_XTS is not set
#
# Hash modes
#
CONFIG_CRYPTO_HMAC=y
# CONFIG_CRYPTO_XCBC is not set
# CONFIG_CRYPTO_VMAC is not set
#
# Digest
#
CONFIG_CRYPTO_CRC32C=y
# CONFIG_CRYPTO_GHASH is not set

131

CONFIG_CRYPTO_MD4=y
CONFIG_CRYPTO_MD5=y
# CONFIG_CRYPTO_MICHAEL_MIC is not set
# CONFIG_CRYPTO_RMD128 is not set
# CONFIG_CRYPTO_RMD160 is not set
# CONFIG_CRYPTO_RMD256 is not set
# CONFIG_CRYPTO_RMD320 is not set
CONFIG_CRYPTO_SHA1=y
# CONFIG_CRYPTO_SHA256 is not set
# CONFIG_CRYPTO_SHA512 is not set
# CONFIG_CRYPTO_TGR192 is not set
# CONFIG_CRYPTO_WP512 is not set
#
# Ciphers
#
CONFIG_CRYPTO_AES=y
# CONFIG_CRYPTO_ANUBIS is not set
# CONFIG_CRYPTO_ARC4 is not set
# CONFIG_CRYPTO_BLOWFISH is not set
# CONFIG_CRYPTO_CAMELLIA is not set
# CONFIG_CRYPTO_CAST5 is not set
# CONFIG_CRYPTO_CAST6 is not set
CONFIG_CRYPTO_DES=y
# CONFIG_CRYPTO_FCRYPT is not set
# CONFIG_CRYPTO_KHAZAD is not set
# CONFIG_CRYPTO_SALSA20 is not set
# CONFIG_CRYPTO_SEED is not set
# CONFIG_CRYPTO_SERPENT is not set
# CONFIG_CRYPTO_TEA is not set
# CONFIG_CRYPTO_TWOFISH is not set
# Compression
#
CONFIG_CRYPTO_DEFLATE=y
# CONFIG_CRYPTO_ZLIB is not set
# CONFIG_CRYPTO_LZO is not set
#
# Random Number Generation
#
# CONFIG_CRYPTO_ANSI_CPRNG is not set
CONFIG_CRYPTO_HW=y
# CONFIG_CRYPTO_DEV_HIFN_795X is not set
CONFIG_CRYPTO_DEV_TALITOS=y
# CONFIG_PPC_CLOCK is not set
CONFIG_PPC_LIB_RHEAP=y
# CONFIG_VIRTUALIZATION is not set

ANEXO B.4 DOFLUSH.SH


#!/bin/sh
echo "Eliminando criterios anteriores.<br>"
iptables -t filter -F
iptables -t nat -F
iptables -t mangle -F
echo "Eliminando clases anteriores.<br>"
tc qdisc del root dev eth0
tc qdisc del root dev eth2

132

echo "Habilitando IPv4 forwarding.<br>"


echo 1 > /proc/sys/net/ipv4/ip_forward

ANEXO B.5 CREARRUTAS.SH


#!/bin/sh
echo "Creando rutas estticas.<br>"
## Fin de sustitucin
/usr/sbin/genrutas /var/www/config.sqlite2 > /usr/sbin/cmdrutas
chmod 777 /usr/sbin/cmdrutas
/usr/sbin/cmdrutas

ANEXO B.6 CREARQDISCS.SH


#!/bin/sh
echo "Creando clases root (id=0).<br>"
tc qdisc add dev eth0 root handle 1: hfsc default 999
tc class add dev eth0 parent 1: classid 1:1 hfsc sc rate 100mbit ul rate 100mbit
tc class add dev eth0 parent 1:1 classid 1:999 hfsc sc rate 90mbit ul rate 90mbit
tc qdisc add dev eth2 root handle 2: hfsc default 999
tc class add dev eth2 parent 2: classid 2:2 hfsc sc rate 100mbit ul rate 100mbit
tc class add dev eth2 parent 2:2 classid 2:999 hfsc sc rate 90mbit ul rate 90mbit

ANEXO B.7 CREARCLASES.SH


#!/bin/sh
echo "Creando clases.<br>"
/usr/sbin/genclases /var/www/control.sqlite2 > /usr/sbin/cmdclases
chmod 777 /usr/sbin/cmdclases
/usr/sbin/cmdclases

ANEXO B.8 CREARCRITERIOS.SH


#!/bin/sh
echo "Creando reglas.<br>"
/usr/sbin/gencriterios /var/www/control.sqlite2 > /usr/sbin/cmdcriterios
chmod 777 /usr/sbin/cmdcriterios
/usr/sbin/cmdcriterios

133

ANEXO B.9 CONFLANWAN.SH


#!/bin/sh
echo "Aplicando configuracin de LAN y WAN.<br>"
/usr/sbin/genconfig /var/www/config.sqlite2 > /usr/sbin/configips
chmod 777 /usr/sbin/configips
/usr/sbin/configips

ANEXO B.10 CREARSFQ.SH


#!/bin/sh
echo "Creando qdiscs de clases leaf.<br>"
/usr/sbin/genqdiscs /var/www/control.sqlite2 > /usr/sbin/cmdsfq
chmod 777 /usr/sbin/cmdsfq
/usr/sbin/cmdsfq

ANEXO B.11 APACHE2 (SCRIPT DE INICIO)


#!/bin/sh
if [ ! -x /usr/bin/apachectl ]
then
exit 0
fi
if [ "$1" = "stop" -o "$1" = "restart" ]
then
echo "Deteniendo servidor apache2: "
/usr/bin/apachectl stop
fi
if [ "$1" = "start" -o "$1" = "restart" ]
then
echo "Iniciando servidor apache2: "
/usr/bin/apachectl start
Fi

134

135

ANEXO C INTERFAZ WEB

ANEXO C.1 LOGIN.HTML


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="contenttype"><title>login</title></head><body>
<table style="text-align: left; width: 900px; margin-left: auto; margin-right:
auto;" border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 900px; height: 82px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="2"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; height: 82px; width: 202px;"><img
src="images/sanbuena.gif" alt="sanbuena.gif"></td>
<td style="vertical-align: middle; text-align: center;">
<p class="MsoNormal" style="text-align: center;" align="center"><b
style=""><span style="line-height: 115%;"><big><span style="font-family:
monospace;">SISTEMA DE CONTROL DE TRFICO EN REDES
DE DATOS CON IMPLEMENTACIN DE
NPU</span></big> <o:p></o:p></span></b></p>
</td>
<td style="vertical-align: bottom; height: 82px; width: 202px; textalign: right;">
<dl>
<dt style="font-family: monospace;"><small><small><span
style="line-height: 150%;" lang="PT-BR">HARVEY DEMIAN BASTIDAS
CAICEDO<o:p></o:p></span></small></small><big><span style="line-height: 150%;"
lang="PT-BR"><small><small><small> <br>
</small></small></small></span></big></dt>
<dt><span style="line-height: 150%;" lang="PT-BR"><small
style="font-family: monospace;"><small>DIEGO ANDRS BELTRN
ORDUZ</small></small><span style=""> </span><o:p></o:p></span></dt>
</dl>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 900px; background-color: rgb(255,
102, 0); height: 20px;"><br>
</td>
</tr>
<tr align="center">
<td style="vertical-align: top; width: 900px;">

136

<table style="text-align: left; width: 900px;" border="0" cellpadding="10"


cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 202px; height: 900px;
background-color: rgb(255, 102, 0);"><br>
<br>
<br>
<span style="font-weight: bold;"></span><span style="font-weight:
bold;"></span><span style="font -weight: bold;"></span><span style="font-weight:
bold;"></span><span style="font -weight: bold;"></span><span style="font-weight:
bold;"></span><span style="font -weight: bold;"></span><span style="font-weight:
bold;"></span><br>
<br>
</td>
<td style="vertical-align: top; color: rgb(3, 5, 3);"><br>
<br>
<br>
<br>
<br>
<br>
<form style="margin-left: 0px; width: 650px;" method="post"
action="login_.php" name="login">
<table style="text-align: left; width: 647px; height: 69px;"
cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top; text-align: right; width:
323px;">Usuario<br>
</td>
<td style="vertical-align: top;">Admin<br>
</td>
</tr>
<tr>
<td style="vertical-align: top; text-align:
right;">Contrato<br>
</td>
<td style="vertical-align: top;"><input maxlength="8"
size="12" name="cf_contra" type="password"><br>
</td>
</tr>
</tbody>
</table>
&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp; <br>
<div style="text-align: center;">&nbsp;&nbsp; <input name="button"
value="Ingresar" type="button"><br>
</div>
<br>
<br>
<br>
<br>
<br>
</form>
<br>
<br>
<br>
<br>
<br>

137

<br>
<br>
<br>
<br>
<br>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<br>
<br>
</body></html>

ANEXO C.2 LOGIN.PHP


<?php try{
//crea o abre la base de datos
$database = new SQLiteDatabase('config.sqlite2', 0666, $error);
catch(Exception $e) {
die($error); }
// prepara la solicitud (query) de datos en la tabla t_cf_config para
verificar el password
$query = "SELECT * FROM t_cf_config where password=".$_POST['cf_contra'];
if($result = $database->query($query, SQLITE_BOTH, $error))
{
if (($result->numRows())==0) {
// Login no exitoso enva a login.html
header("location: login.html");
exit();}
} else
{
// Login no exitoso enva a login.html
header("location: login.html");
exit();
}// Login exitoso enva a lan.php
session_regenerate_id();
$_SESSION["admin"] = $_POST['cf_contra'];
// Guarda la sesion
session_write_close();
header("location: lan.php");
exit(); ?>

ANEXO C.3 LAN.PHP


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="contenttype"><title>Configuracion lan</title></head><body>
<table style="text-align: left; width: 900px; margin-left: auto; margin-right:
auto;" border="0" cellpadding="2" cellspacing="0">

138

<tbody>
<tr>
<td style="vertical-align: top; width: 900px; height: 82px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="2"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; height: 82px; width: 202px;"><img
src="images/sanbuena.gif" alt="sanbuena.gif"></td>
<td style="vertical-align: middle; text-align: center;">
<p class="MsoNormal" style="text-align: center;" align="center"><b
style=""><span style="line-height: 115%;"><big><span style="font-family:
monospace;">SISTEMA DE CONTROL DE TRFICO EN REDES
DE DATOS CON IMPLEMENTACIN DE
NPU</span></big> <o:p></o:p></span></b></p>
</td>
<td style="vertical-align: bottom; height: 82px; width: 202px; textalign: right;">
<dl>
<dt style="font-family: monospace;"><small><small><span
style="line-height: 150%;" lang="PT-BR">HARVEY DEMIAN BASTIDAS
CAICEDO<o:p></o:p></span></small></small><big><span style="line-height: 150%;"
lang="PT-BR"><small><small><small> <br>
</small></small></small></span></bi g></dt>
<dt><span style="line-height: 150%;" lang="PT-BR"><small
style="font-family: monospace;"><small>DIEGO ANDRS BELTRN
ORDUZ</small></small><span style=""> </span><o:p></o:p></span></dt>
</dl>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 900px; background-color: rgb(255,
102, 0); height: 20px;"><br>
</td>
</tr>
<tr align="center">
<td style="vertical-align: top; width: 900px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="10"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 202px; height: 900px;
background-color: rgb(255, 102, 0);"><br>
<br>
<br>
<span style="font-weight: bold;">Configuracion</span><br>
Lan<br><a href="wan.php">
Wan</a><br>
<a href="rutas.php">Rutas</a><br>
<br>
<a href="clases.php"><span style="font-weight:
bold;">Clases</span></a><br>
<br>
<a href="reglaslistas.php"><span style="font -weight: bold;">Reglas y
listas</span></a><br>
<br>

139

<span style="font-weight: bold;">Diagnstico</span><b r><a


href="ping.html">
Ping</a><br><a href="traceroute.html">
Traceroute</a><br>
<br>
<a href="aplicarcambios.html"><span style="font-weight:
bold;">Aplicar cambios</span><br style="font-weight: bold;">
</a>
<br style="font-weight: bold;">
<a href="reiniciar.html"><span style="font-weight:
bold;">Reiniciar</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="reiniciofabrica.html"><span style="font-weight:
bold;">Reinicio de fabrica</span><br style="font-weight: bold;">
</a>
<br style="font-weight: bold;">
<a href="contrasena.html"><span style="font-weight: bold;">Cambiar
contrasea</span></a><br>
<br>
</td>
<td style="vertical-align: top; color: rgb(3, 5, 3);"><br>
<br>
<br>
<?php
try
{
//crea o abre la base de datos (debe contener el path relativo al
root del servidor www)
$database = new SQLiteDatabase('config.sqlite2', 0666, $error);
}
catch(Exception $e)
{
die($error);
}
// prepara la solicitud (query) de datos en la tabla t_cl_clases
$query = "SELECT * FROM t_cf_config";
if($result = $database->query($query, SQLITE_BOTH, $error))
{
if (($result->numRows())>0)
{
$row = $result->fetch();
$cf_lan_ip4 = explode(".", $row['cf_lan_ip4']);
$cf_lan_nat = $row['cf_lan_nat'];
$cf_lan_mask = explode(".", $row['cf_lan_mask']);
$cf_lan_dhcp_server = $row['cf_lan_dhcp_server'];
}
}
?>
<form method="get" action="guardarconfiglan.php" name="lan">
<table style="text-align: left; width: 400px; height: 116px;
margin-left: auto; margin-right: auto;" border="0" cellpadding="4"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 200px; text -align: right;">IP lan
<br> </td>
<td style="vertical-align: top; width: 200px;">
<input maxlength="3" size="1" name="cf_lan_ip4_1" value= <?php
printf("\"%s\"", $cf_lan_ip4[0] ); ?> >

140

<input maxlength="3" size="1" name="cf_lan_ip4_2" value= <?php


printf("\"%s\"", $cf_lan_ip4[1] ); ?> >
<input maxlength="3" size="1" name="cf_lan_ip4_3" value= <?php
printf("\"%s\"", $cf_lan_ip4[2] ); ?> >
<input maxlength="3" size="1" name="cf_lan_ip4_4" value= <?php
printf("\"%s\"", $cf_lan_ip4[3] ); ?> >
</td>
</tr>
<tr>
<td style="vertical-align: top; text-align: right;">Mascara<br></td>
<td style="vertical-align: top;">
<input maxlength="3" size="1" name="cf_lan_mask_1" value= <?php
printf("\"%s\"", $cf_lan_mask[0] ); ?> >
<input maxlength="3" size="1" name="cf_lan_mask_2" value= <?php
printf("\"%s\"", $cf_lan_mask[1] ); ?> >
<input maxlength="3" size="1" name="cf_lan_mask_3" value= <?php
printf("\"%s\"", $cf_lan_mask[2] ); ?> >
<input maxlength="3" size="1" name="cf_lan_mask_4" value= <?php
printf("\"%s\"", $cf_lan_mask[3] ); ?> >
</td>
</tr>
<td style="vertical-align: top; text-align: right;">Habilitar NAT<br></td>
<td style="vertical-align: top;"><input name="cf_lan_nat" value="1"
type="checkbox" <?php if ($cf_lan_nat=="1") printf("checked"); ?> ><br></td>
</tr><tr>
<td style="vertical-align: top;text-align: right;"><br><input
name="submit" value="Guardar" type="submit"><br>
</td>
<td style="vertical-align: top; text-align: right;">
</td>
</tr>
</tbody>
</table>
</form>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<br>
<br>
</body></html>

ANEXO C.4 GUARDARCONFIGLAN.PHP


<?php
try
{

141

//crea o abre la base de datos (debe? contener el path relativo al


root del servidor www)
$database = new SQLiteDatabase('config.sqlite2', 0666, $error);
}
catch(Exception $e)
{
die($error);
}
$cf_lan_ip4="".$_GET['cf_lan_ip4_1'].".".$_GET['cf_lan_ip4_2'].".".$_GET['c
f_lan_ip4_3'].".".$_GET['cf_lan_ip4_4'];
$cf_lan_mask="".$_GET['cf_lan_mask_1'].".".$_GET['cf_lan_mask_2'].".".$_GET
['cf_lan_mask_3'].".".$_GET['cf_lan_mask_4'];
//se calcula la direccin network como el and entre la ip y la
mscara(se coloca 0+ debido al type juggling de php)
$cf_lan_network="".((0+$_GET['cf_lan_mask_1'])&(0+$_GET['cf_lan_ip4_1']))."
.".((0+$_GET['cf_lan_mask_2'])&(0+$_GET['cf_lan_ip4_2'])).".".
((0+$_GET['cf_lan_mask_3'])&(0+$_GET['cf_lan_ip4_3'])).".".((0+$_GET['cf_la
n_mask_4'])&(0+$_GET['cf_lan_ip4_4']));
$cf_lan_nat = "".$_GET['cf_lan_nat'];
$cf_lan_dhcp_server = "".$_GET['cf_lan_dhcp_server'];
$query = sprintf('update t_cf_config set cf_lan_ip4 = "%s",
cf_lan_nat = "%s", cf_lan_mask = "%s", cf_lan_dhcp_server = "%s", cf_lan_network
= "%s"',
$cf_lan_ip4, $cf_lan_nat, $cf_lan_mask,
$cf_lan_dhcp_server, $cf_lan_network);
//printf($query);
if($result = $database->query($query, SQLITE_BOTH, $error))
{
//$ref = $_SERVER['SERVER_ADDR'];
header( 'refresh: 1; url=/lan.php');
printf("La configuracin se guard exitosamente.
Redireccionando en 1 segundo.");
}
else
{
die($error);
}
?>

ANEXO C.5 WAN.PHP


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="contenttype"><title>Configuracion wan</title></head><body>
<table style="text-align: left; width: 900px; margin-left: auto; margin-right:
auto;" border="0" cellpadding="2" cellspacing="0">

142

<tbody>
<tr>
<td style="vertical-align: top; width: 900px; height: 82px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="2"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; height: 82px; width: 202px;"><img
src="images/sanbuena.gif" alt="sanbuena.gif"></td>
<td style="vertical-align: middle; text-align: center;">
<p class="MsoNormal" style="text-align: center;" align="center"><b
style=""><span style="line-height: 115%;"><big><span style="font-family:
monospace;">SISTEMA DE CONTROL DE TRFICO EN REDES
DE DATOS CON IMPLEMENTACIN DE
NPU</span></big> <o:p></o:p></span></b></p>
</td>
<td style="vertical-align: bottom; height: 82px; width: 202px; textalign: right;">
<dl>
<dt style="font-family: monospace;"><small><small><span
style="line-height: 150%;style="vertical-align: middle;" lang="PT-BR">HARVEY
DEMIAN BASTIDAS CAICEDO<o:p></o:p></span></small></small><big><span style="lineheight: 150%;" lang="PT-BR"><small><small><small> <br>
</small></small></small></span></big></dt>
<dt><span style="line-height: 150%;style="vertical-align: middle;"
lang="PT-BR"><small style="font-family: monospace;"><small>DIEGO ANDRS BELTRN
ORDUZ</small></small><span style=""> </span><o:p></o:p></span></dt>
</dl>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 900px; background-color: rgb(255,
102, 0); height: 20px;"><br>
</td>
</tr>
<tr align="center">
<td style="vertical-align: top; width: 900px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="10"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 202px; height: 900px;
background-color: rgb(255, 102, 0);"><br>
<br>
<br>
<span style="font-weight: bold;">Configuracion</span><br><a
href="lan.php">
Lan</a><br>
Wan<br><a href="rutas.php">
Rutas</a><br>
<br>
<a href="clases.php"><span style="font-weight:
bold;">Clases</span></a><br>
<br>
<a href="reglaslistas.php"><span style="font -weight: bold;">Reglas y
listas</span><br>

143

</a>
<br>
<span style="font-weight: bold;">Diagnstico</span><br><a
href="ping.html">
Ping</a><br><a href="traceroute.html">
Traceroute</a><br>
<br>
<a href="aplicarcambios.html"><span style="font-weight:
bold;">Aplicar cambios</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="reiniciar.html"><span style="font-weight:
bold;">Reiniciar</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="reiniciofabrica.html"><span style="font-weight:
bold;">Reinicio de fabrica</span><br style="font-weight: bold;">
</a>
<br style="font-weight: bold;">
<a href="contrasena.html"><span style="font-weight: bold;">Cambiar
contrasea</span></a><br>
<br>
</td>
<td style="vertical-align: top; color: rgb(3, 5, 3);"><br>&nbsp;
<br>
<br>
<?php
try
{
//crea o abre la base de datos (debe contener el path relativo al
root del servidor www)
$database = new SQLiteDatabase('config.sqlite2', 0666, $error);
}
catch(Exception $e)
{
die($error);
}
// prepara la solicitud (query) de datos en la tabla t_cl_clases
$query = "SELECT * FROM t_cf_config";
if($result = $database->query($query, SQLITE_BOTH, $error))
{
if (($result->numRows())>0)
{
while($row = $result->fetch())
{
$cf_wan_ip4_ = explode(".", $row['cf_wan_ip4']);
$cf_wan_mask_ = explode(".",
$row['cf_wan_mask']);
$cf_wan_gw_ = explode(".", $row['cf_wan_gw']);
$cf_wan_dns1_ = explode(".", $row['cf_wan_dns1']);
$cf_wan_dns2_ = explode(".", $row['cf_wan_dns2']);
$cf_wan_dhcp = $row['cf_wan_dhcp'];;
$cf_use_ntpserver=$row['cf_use_ntpserver'];
$cf_ntpserver=$row['cf_ntpserver'];
$cf_use_syslogserver=$row['cf_use_syslogserver'];
$cf_syslogserver=$row['cf_syslogserver'];
}
}
else
{
$cf_wan_ip4_[0]="192";
$cf_wan_ip4_[1]="168";

144

$cf_wan_ip4_[2]="0";
$cf_wan_ip4_[3]="254";
$cf_wan_mask_[0]="255";
$cf_wan_mask_[1]="255";
$cf_wan_mask_[2]="255";
$cf_wan_mask_[3]="0";
$cf_wan_gw_[0]="192";
$cf_wan_gw_[1]="168";
$cf_wan_gw_[2]="0";
$cf_wan_gw_[3]="1";
$cf_wan_dns1_[0]="192";
$cf_wan_dns1_[1]="168";
$cf_wan_dns1_[2]="0";
$cf_wan_dns1_[3]="1";
$cf_wan_dns2_[0]="200";
$cf_wan_dns2_[1]="24";
$cf_wan_dns2_[2]="7";
$cf_wan_dns2_[3]="3";
$cf_wan_dhcp="0";
$cf_use_ntpserver="0";
$cf_ntpserver="";
$cf_use_syslogserver="0";
$cf_syslogserver="";
//coloca valores por defecto en un nuevo registro para
configuracin LAN (ya que solo se usar update)
$query = "insert into t_cf_config (cf_lan_ip4, cf_lan_mask,
cf_lan_nat, cf_lan_dhcp_server) values
(\"192.168.0.254\",\"255.255.255.0\",\"0\",\"0\")";
if($result = $database->query($query, SQLITE_BOTH,
$error)){
printf("Base de datos creada");
}
else
{
die($error);
}
}
}
?>
<form method="get" action="guardarconfigwan.php" name="wan">
<table style="text-align: left; width: 693px; height: 116px;
margin-left: auto; margin-right: auto;" border="0" cellpadding="4"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 200px; text -align:
right;">IP wan
</td>
<td style="vertical-align: top; width: 200px;">
<input maxlength="3" size="1" name="cf_wan_ip4_1"
value= <?php printf("\"%s\"", $cf_wan_ip4_[0] ); ?> >
<input maxlength="3" size="1" name="cf_wan_ip4_2"
value= <?php printf("\"%s\"", $cf_wan_ip4_[1] ); ?> >

145

<input maxlength="3" size="1" name="cf_wan_ip4_3"


value= <?php printf("\"%s\"", $cf_wan_ip4_[2] ); ?> >
<input maxlength="3" size="1" name="cf_wan_ip4_4"
value= <?php printf("\"%s\"", $cf_wan_ip4_[3] ); ?> > </td>
</tr>
<tr>
<td style="vertical-align: top; text-align:
right;">Mascara<br>
</td>
<td style="vertical-align: top;">
<input maxlength="3" size="1" name="cf_wan_mask_1"
value= <?php printf("\"%s\"", $cf_wan_mask_[0] ); ?> >
<input maxlength="3" size="1" name="cf_wan_mask_2"
value= <?php printf("\"%s\"", $cf_wan_mask_[1] ); ?> >
<input maxlength="3" size="1" name="cf_wan_mask_3"
value= <?php printf("\"%s\"", $cf_wan_mask_[2] ); ?> >
<input maxlength="3" size="1" name="cf_wan_mask_4"
value= <?php printf("\"%s\"", $cf_wan_mask_[3] ); ?> >
</td>
</tr>
<tr>
<td style="vertical-align: top; text-align: right;">Puerta de
enlace
</td>
<td style="vertical-align: top;">
<input maxlength="3" size="1" name="cf_wan_gw_1" value=
<?php printf("\"%s\"", $cf_wan_gw_[0] ); ?> >
<input maxlength="3" size="1" name="cf_wan_gw_2" value=
<?php printf("\"%s\"", $cf_wan_gw_[1] ); ?> >
<input maxlength="3" size="1" name="cf_wan_gw_3" value=
<?php printf("\"%s\"", $cf_wan_gw_[2] ); ?> >
<input maxlength="3" size="1" name="cf_wan_gw_4" value=
<?php printf("\"%s\"", $cf_wan_gw_[3] ); ?> >
</td>
</tr>
<tr>
<td style="vertical-align: top; text-align: right;">DNS1</td>
<td style="vertical-align: top;">
<input maxlength="3" size="1" name="cf_wan_dns1_1"
value= <?php printf("\"%s\"", $cf_wan_dns1_[0] ); ?> >
<input maxlength="3" size="1" name="cf_wan_dns1_2"
value= <?php printf("\"%s\"", $cf_wan_dns1_[1] ); ?> >
<input maxlength="3" size="1" name="cf_wan_dns1_3"
value= <?php printf("\"%s\"", $cf_wan_dns1_[2] ); ?> >
<input maxlength="3" size="1" name="cf_wan_dns1_4"
value= <?php printf("\"%s\"", $cf_wan_dns1_[3] ); ?> > </td>
</tr>
<tr>
<td style="vertical-align: top; text-align: right;">DNS2</td>
<td style="vertical-align: top;">
<input maxlength="3" size="1" name="cf_wan_dns2_1"
value= <?php printf("\"%s\"", $cf_wan_dns2_[0] ); ?> >
<input maxlength="3" size="1" name="cf_wan_dns2_2"
value= <?php printf("\"%s\"", $cf_wan_dns2_[1] ); ?> >
<input maxlength="3" size="1" name="cf_wan_dns2_3"
value= <?php printf("\"%s\"", $cf_wan_dns2_[2] ); ?> >
<input maxlength="3" size="1" name="cf_wan_dns2_4"
value= <?php printf("\"%s\"", $cf_wan_dns2_[3] ); ?> > </td>
</tr>
<tr>

146

<td style="vertical-align: top; text-align: right;">Habilitar


cliente DHCP </td>
<td style="vertical-align: top;"><input name="cf_wan_dhcp"
value="1" type="checkbox" <?php if ($cf_wan_dhcp=="1") printf("\"checked\""); ?>
>
</td>
</tr>
<tr>
<td style="vertical-align: top; text-align: right;"><input
name="submit" value="Guardar" type="submit"></td>
<td style="vertical-align: top;"></td>
</tr>
</tbody>
</table>
</form>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<br>
<br>
</body></html>

ANEXO C.6 GUARDARCONFIGWAN.PHP


<?php
try
{
//crea o abre la base de datos (debe? contener el path relativo al
root del servidor www)
$database = new SQLiteDatabase('config.sqlite2', 0666, $error);
}
catch(Exception $e)
{
die($error);
}
$cf_wan_ip4="".$_GET['cf_wan_ip4_1'].".".$_GET['cf_wan_ip4_2'].".".$_GET['c
f_wan_ip4_3'].".".$_GET['cf_wan_ip4_4'];
$cf_wan_mask="".$_GET['cf_wan_mask_1'].".".$_GET['cf_wan_mask_2'].".".$_GET
['cf_wan_mask_3'].".".$_GET['cf_wan_mask_4'];
$cf_wan_gw="".$_GET['cf_wan_gw_1'].".".$_GET['cf_wan_gw_2'].".".$_GET['cf_w
an_gw_3'].".".$_GET['cf_wan_gw_4'];
$cf_wan_dns1 =
"".$_GET['cf_wan_dns1_1'].".".$_GET['cf_wan_dns1_2'].".".$_GET['cf_wan_dns1_3']."
.".$_GET['cf_wan_dns1_4'];
$cf_wan_dns2 =
"".$_GET['cf_wan_dns2_1'].".".$_GET['cf_wan_dns2_2'].".".$_GET['cf_wan_dns2_3']."
.".$_GET['cf_wan_dns2_4'];

147

//se calcula la direccin network como el and entre la ip y la


mscara(se coloca 0+ debido al type juggling de php)
$cf_wan_network="".((0+$_GET['cf_wan_mask_1'])&(0+$_GET['cf_wan_ip4_1']))."
.".((0+$_GET['cf_wan_mask_2'])&(0+$_GET['cf_wan_ip4_2'])).".".
((0+$_GET['cf_wan_mask_3'])&(0+$_GET['cf_wan_ip4_3'])).".".((0+$_GET['cf_wa
n_mask_4'])&(0+$_GET['cf_wan_ip4_4']))."";
$cf_wan_dhcp = $_GET['cf_wan_dhcp'];
$cf_use_ntpserver= $_GET['cf_use_ntpserver'];
$cf_ntpserver= $_GET['cf_ntpserver'];
$cf_use_syslogserver= $_GET['cf_use_syslogserver'];
$cf_syslogserver= $_GET['cf_syslogserver'];
$query = sprintf('update t_cf_config set cf_wan_ip4="%s",
cf_wan_mask="%s", cf_wan_gw="%s", cf_wan_dns1="%s",
cf_wan_dns2="%s", cf_wan_dhcp="%s", cf_use_ntpserver="%s",
cf_ntpserver="%s", cf_use_syslogserver="%s", cf_syslogserver="%s",
cf_wan_network="%s',
$cf_wan_ip4, $cf_wan_mask, $cf_wan_gw, $cf_wan_dns1, $cf_wan_dns2,
$cf_wan_dhcp, $cf_use_ntpserver, $cf_ntpserver, $cf_use_syslogserver,
$cf_syslogserver,$cf_wan_network);
//printf($query);
if($result = $database->query($query, SQLITE_BOTH, $error))
{
//$ref = $_SERVER['SERVER_ADDR'];
header( 'refresh: 1; url=/wan.php');
printf("La configuracin se guard exitosamente.
Redireccionando en 1 segundo.");
}
else
{
die($error);
}
?>

ANEXO C.7 NUEVARUTA.PHP


<?php
try
{
//crea o abre la base de datos (debe? contener el path relativo al
root del servidor www)
$database = new SQLiteDatabase('config.sqlite2', 0666, $error);
}
catch(Exception $e)
{
die($error);
}
$cf_rt_ip4="".$_GET['cf_rt_ip4_1'].".".$_GET['cf_rt_ip4_2'].".".$_GET['cf_r
t_ip4_3'].".".$_GET['cf_rt_ip4_4'];

148

$cf_rt_mask="".$_GET['cf_rt_mask_1'].".".$_GET['cf_rt_mask_2'].".".$_GET['c
f_rt_mask_3'].".".$_GET['cf_rt_mask_4'];
$cf_rt_nhop="".$_GET['cf_rt_nhop_1'].".".$_GET['cf_rt_nhop_2'].".".$_GET['c
f_rt_nhop_3'].".".$_GET['cf_rt_nhop_4'];
$query = 'insert into t_cf_rutas (cf_rt_ip4, cf_rt_mask, cf_rt_nhop)
values
('."\"".$cf_rt_ip4."\",\"".$cf_rt_mask."\",\"".$cf_rt_nhop."\")";// prepara la
solicitud (query) de datos en la tabla t_cl_criterios
//printf($query);
if($result = $database->query($query, SQLITE_BOTH, $error))
{
//$ref = $_SERVER['SERVER_ADDR'];
header( 'refresh: 0; url=/rutas.php');
}
else
{
die($error);
}
?>

ANEXO C.8 ELIMINARRUTA.PHP


<?php
try
{
//crea o abre la base de datos (debe? contener el path relativo al
root del servidor www)
$database = new SQLiteDatabase('config.sqlite2', 0666, $error);
}
catch(Exception $e)
{
die($error);
}
// prepara la solicitud (query) de datos en la tabla t_cl_clases
$query = "delete from t_cf_rutas where cf_tr_id=".$_GET['cf_tr_id'];
// printf("%s",$query);
if($result = $database->query($query, SQLITE_BOTH, $error))
{
$ref = $_SERVER['HTTP_REFERER']; //vuelve atrs
header( 'refresh: 0; url='.$ref);
}
else
{
die($error);
}
?>

ANEXO C.9 MODIFICARRUTA.PHP


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

149

<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="contenttype"><title>Modificar ruta</title></head><body>
<table style="text-align: left; width: 900px; margin-left: auto; margin-right:
auto;" border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 900px; height: 82px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="2"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; height: 82px; width: 202px;"><img
src="images/sanbuena.gif" alt="sanbuena.gif"></td>
<td style="vertical-align: middle; text-align: center;">
<p class="MsoNormal" style="text-align: center;" align="center"><b
style=""><span style="line-height: 115%;"><big><span style="font-family:
monospace;">SISTEMA DE CONTROL DE TRFICO EN REDES
DE DATOS CON IMPLEMENTACIN DE
NPU</span></big> <o:p></o:p></span></b></p>
</td>
<td style="vertical-align: bottom; height: 82px; width: 202px; textalign: right;">
<dl>
<dt style="font-family: monospace;"><small><small><span
style="line-height: 150%;" lang="PT-BR">HARVEY DEMIAN BASTIDAS
CAICEDO<o:p></o:p></span></small></small><big><span style="line-height: 150%;"
lang="PT-BR"><small><small><small> <br>
</small></small></small></span></big></dt>
<dt><span style="line-height: 150%;" lang="PT-BR"><small
style="font-family: monospace;"><small>DIEGO ANDRS BELTRN
ORDUZ</small></small><span style=""> </span><o:p></o:p></span></dt>
</dl>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 900px; background-color: rgb(255,
102, 0); height: 20px;"><br>
</td>
</tr>
<tr align="center">
<td style="vertical-align: top; width: 900px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="10"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 202px; height: 900px;
background-color: rgb(255, 102, 0);"><br>
<br>
<br>
<span style="font-weight: bold;">Configuracion</span><br><a
href="lan.php">
Lan</a><br><a href="wan.php">

150

Wan</a><br><a href="rutas.php">
Rutas</a><br>
<br>
<a href="clases.php"><span style="font-weight:
bold;">Clases</span></a><br>
<br>
<a href="reglaslistas.php"><span style="font -weight: bold;">Criterios
de clasificacin.</span></a><br>
<br>
<span style="font-weight: bold;">Diagnstico</span><br><a
href="ping.html">
Ping</a><br><a href="traceroute.html">
Traceroute<br>
</a>
<br>
<a href="aplicarcambios.html"><span style="font-weight:
bold;">Aplicar cambios</span><br style="font-weight: bold;">
</a>
<br style="font-weight: bold;">
<a href="reiniciar.html"><span style="font-weight:
bold;">Reiniciar</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="reiniciofabrica.html"><span style="font-weight:
bold;">Reinicio de fabrica</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="contrasena.html"><span style="font-weight: bold;">Cambiar
contrasea</span></a><br>
<br>
</td>
<td style="vertical-align: top; color: rgb(3, 5, 3);"><br>
<br>
<br>
<?php
try
{
//crea o abre la base de datos (debe contener el path relativo al
root del servidor www)
$database = new SQLiteDatabase('config.sqlite2', 0666, $error);
}
catch(Exception $e)
{
die($error);
}
// prepara la solicitud (query) de datos en la tabla t_cl_criterios
$query = "SELECT * FROM t_cf_rutas WHERE cf_id=".$_GET['cf_id'];
if($result = $database->query($query, SQLITE_BOTH, $error))
{
if (($result->numRows())>0)
{
$row = $result->fetch();
$cf_cr_ip_dst = explode(".", $row['cf_cr_ip_dst']);
$cf_cr_mask_dst = explode(".", $row['cf_cr_mask_dst']);
$cf_cr_nexthop = explode(":", $row['cf_cr_nexthop']);
}
}
?>

151

<form style="height: 335px;" method="get" action="editruta.php"


name="nueva">
<input name="cr_id" type="hidden" value=<?php
printf("\"%s\"",$_GET['cfr_id']); ?> >
<table style="text-align: left; height: 116px; marg in-left: auto;
margin-right: auto; width: 670px;" border="0" cellpadding="4" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; text-align: right;">IP
destino<br>
</td>
<td style="vertical-align: top; width: 216px;"><input
name="cl_cr_use_ip_src" value="0" type="checkbox" <?php if
($row['cl_cr_use_ip_src']=="1") printf("\"checked\""); ?> ><input maxlength="3"
size="1" name="cl_cr_ip_src_1" value= <?php printf("\"%s\"", $cl_cr_ip_src[0] );
?> ><input maxlength="3" size="1" name="cl_cr_ip_src_2" value= <?php
printf("\"%s\"", $cl_cr_ip_src[1] ); ?> ><input maxlength="3" size="1"
name="cl_cr_ip_src_3" value= <?php printf("\"%s\"", $cl_cr_ip_src[2] ); ?>
><input maxlength="3" size="1" name="cl_cr_ip_src_4" value= <?php
printf("\"%s\"", $cl_cr_ip_src[3] ); ?> > </td>
</tr>
<tr>
<tr>
<td style="vertical-align: top; text-align: right;">Mscara
destino<br>
</td>
<td style="vertical-align: top; width: 216px;"><input
name="cl_cr_use_mask_src" value= "0" type="checkbox" <?php if
($_row['cl_cr_use_mask_src']=="1") printf("\"checked\""); ?> ><input
maxlength="3" size="1" name="cl_cr_mask_src_1" value= <?php printf("\"%s\"",
$cl_cr_mask_src[0] ); ?> ><input maxlength="3" size="1" name="cl_cr_mask_src_2"
value= <?php printf("\"%s\"", $cl_cr_mask_src[1] ); ?> ><input maxlength="3"
size="1" name="cl_cr_mask_src_3" value= <?php printf("\"%s\"", $cl_cr_mask_src[2]
); ?> > <input maxlength="3" size="1" name="cl_cr_mask_src_4" value= <?php
printf("\"%s\"", $cl_cr_mask_src[3] ); ?> > </td>
</tr>
<tr>
<td style="vertical-align: top; text-align: right;">Prximo
salto<br>
</td>
<td style="vertical-align: top; width: 216px;"><input
name="cl_cr_use_ip_dst" value="0" type="checkbox" <?php if
($row['cl_cr_use_ip_dst']=="1") printf("\"checked\""); ?> ><input maxlength="3"
size="1" name="cl_cr_ip_dst_1" value= <?php printf("\"%s\"", $cl_cr_ip_dst[0] );
?> ><input maxlength="3" size="1" name="cl_cr_ip_dst_2" value= <?php
printf("\"%s\"", $cl_cr_ip_dst[1] ); ?> ><input maxlength="3" size="1"
name="cl_cr_ip_dst_3" value= <?php printf("\"%s\"", $cl_cr_ip_dst[2] ); ?>
><input maxlength="3" size="1" name="cl_cr_ip_dst_4" value= <?php
printf("\"%s\"", $cl_cr_ip_dst[3] ); ?> > </td>
</tr>
<tr>
</tbody>
</table>
</form>
</td>
</tr>
</tbody>
</table>

152

</td>
</tr>
</tbody>
</table>
<br>
<br>
</body></html>

ANEXO C.10 AGREGARCLASE.PHP


<?php
try
{
//crea o abre la base de datos (debe? contener el path relativo al
root del servidor www)
$database = new SQLiteDatabase('control.sqlite2', 0666, $error);
}
catch(Exception $e)
{
die($error);
}
$cad_velmax=$_GET['cl_velmax'];
$cad_ret=$_GET['cl_ret'];
$cad_use_ret="1";
$cad_use_velmax="1";
if($_GET['cl_use_ret']==NULL){
$cad_use_ret="0";
$cad_ret="NULL";
}
if($_GET['cl_use_velmax']==NULL){
$cad_use_velmax="0";
$cad_velmax="NULL";
}
// prepara la solicitud (query) de datos en la tabla t_cl_clases
$query = "insert into t_cl_clases (cl_subida, cl_padre, cl_use_ret,
cl_use_velmax, cl_ret, cl_vel, cl_velmax) values (".$_GET['cl_subida'].",".
$_GET['cl_padre'].",". $cad_use_ret.",". $cad_use_velmax.",". $cad_ret.",".
$_GET['cl_vel'].",". $cad_velmax.")";
//printf("%s",$query);
if($result = $database->query($query, SQLITE_BOTH, $error))
{
$ref = $_SERVER['HTTP_REFERER'];
header( 'refresh: 0; url='.$ref);
}
else
{
die($error);
}

?>

153

ANEXO C.11 MODIFICARCLASE.PHP


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="contenttype"><title>Modificar clase</title></head><body>
<table style="text-align: left; width: 900px; margin-left: auto; margin-right:
auto;" border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 900px; height: 82px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="2"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; height: 82px; width: 202px;"><img
src="images/sanbuena.gif" alt="sanbuena.gif"></td>
<td style="vertical-align: middle; text-align: center;">
<p class="MsoNormal" style="text-align: center;" align="center"><b
style=""><span style="line-height: 115%;"><big><span style="font-family:
monospace;">SISTEMA DE CONTROL DE TRFICO EN REDES
DE DATOS CON IMPLEMENTACIN DE
NPU</span></big> <o:p></o:p></span></b></p>
</td>
<td style="vertical-align: bottom; height: 82px; width: 202px; textalign: right;">
<dl>
<dt style="font-family: monospace;"><small><small><span
style="line-height: 150%;" lang="PT-BR">HARVEY DEMIAN BASTIDAS
CAICEDO<o:p></o:p></span></small></small><big><span style="line-height: 150%;"
lang="PT-BR"><small><small><small> <br>
</small></small></small></span></big></dt>
<dt><span style="line-height: 150%;" lang="PT-BR"><small
style="font-family: monospace;"><small>DIEGO ANDRS BELTRN
ORDUZ</small></small><span style=""> </span><o:p></o:p></span></dt>
</dl>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 900px; background-color: rgb(255,
102, 0); height: 20px;"><br>
</td>
</tr>
<tr align="center">
<td style="vertical-align: top; width: 900px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="10"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 202px; height: 900px;
background-color: rgb(255, 102, 0);"><br>

154

<br>
<br>
<span style="font-weight: bold;">Configuracion</span><br><a
href="lan.php">
Lan</a><br><a href="wan.php">
Wan</a><br><a href="rutas.php">
Rutas</a><br>
<br>
<a href="clases.php"><span style="font-weight:
bold;">Clases</span></a><br>
<br>
<a href="reglaslistas.php"><span style="font -weight: bold;">Criterios
de clasificacin.</span></a><br>
<br>
<span style="font-weight: bold;">Diagnstico</span><br><a
href="ping.html">
Ping</a><br><a href="traceroute.html">
Traceroute<br>
</a>
<br>
<a href="aplicarcambios.html"><span style="font-weight:
bold;">Aplicar cambios</span><b r style="font-weight: bold;">
</a>
<br style="font-weight: bold;">
<a href="reiniciar.html"><span style="font-weight:
bold;">Reiniciar</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="reiniciofabrica.html"><span style="font-weight:
bold;">Reinicio de fabrica</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="contrasena.html"><span style="font-weight: bold;">Cambiar
contrasea</span></a><br>
<br>
</td>
<td style="vertical-align: top; color: rgb(3, 5, 3);"><br>
<br>
<br>
<?php
try
{
//crea o abre la base de datos (debe contener el pa th relativo al
root del servidor www)
$database = new SQLiteDatabase('control.sqlite2', 0666, $error);
}
catch(Exception $e)
{
die($error);
}
// prepara la solicitud (query) de datos en la tabla t_cl_criterios
$query = "SELECT * FROM t_cl_clases WHERE cf_cl_id=".$_GET['cL_id'];
if($result = $database->query($query, SQLITE_BOTH, $error))
{
if (($result->numRows())>0)
{
$row = $result->fetch();
$cl_velocidad = explode(".", $row['cl_velocidad']);
$cl_velocidadmax = explode(".",
$row['cl_velocidadmax']);
$cl_retardo = explode(".", $row['cl_retardo']);

155

$cl_clase_padre = explode(".", $row['cl_cr_clasep']);


$cl_cr_clase = explode(":", $row['cl_cr_clase']);
}
}
?>
<form style="height: 335px;" method="get" action="editclase.php"
name="nueva">
<input name="cr_id" type="hidden" value=<?php
printf("\"%s\"",$_GET['cfr_id']); ?> >
<table style="text-align: left; height: 116px; margin-left: auto;
margin-right: auto; width: 670px;" border="0" cellpadding="4" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; text-align: right;">Velocidad
garantizada<br>
</td>
<td style="vertical-align: top; width: 216px;"><input
name="cl_velocidad" value="0" type="checkbox" <?php if
($row['cl_cr_use_ip_src']=="1") printf("\"checked\""); ?> ><input maxlength="3"
size="1" name="cl_cr_ip_src_1" value= <?php printf("\"%s\"", $cl_cr_ip_src[0] );
?> ><input maxlength="3" size="1" name="cl_cr_ip_src_2" value= <?php
printf("\"%s\"", $cl_cr_ip_src[1] ); ?> ><input maxlength="3" size="1"
name="cl_cr_ip_src_3" value= <?php printf("\"%s\"", $cl_cr_ip_src[2] ); ?>
><input maxlength="3" size="1" name="cl_cr_ip_src_4" value= <?php
printf("\"%s\"", $cl_cr_ip_src[3] ); ?> > </td>
</tr>
<tr>
<tr>
<td style="vertical-align: top; text-align: right;">Velocidad
mxima<br>
</td>
<td style="vertical-align: top; width: 216px;"><input
name="cl_velocidadmax" value= "0" type="checkbox" <?php if
($_row['cl_cr_use_mask_src']=="1") printf("\"checked\""); ?> ><input
maxlength="3" size="1" name="cl_cr_mask_src_1" value= <?php printf("\"%s\"",
$cl_cr_mask_src[0] ); ?> ><input maxlength="3" size="1" name="cl_cr_mask_src_2"
value= <?php printf("\"%s\"", $cl_cr_mask_src[1] ); ?> ><input maxlength="3"
size="1" name="cl_cr_mask_src_3" value= <?php printf("\"%s\"", $cl_cr_mask_src[2]
); ?> > <input maxlength="3" size="1" name="cl_cr_mask_src_4" value= <?php
printf("\"%s\"", $cl_cr_mask_src[3] ); ?> > </td>
</tr>
<tr>
<td style="vertical-align: top; text-align:
right;">Retardo<br>
</td>
<td style="vertical-align: top; width: 216px;"><input
name="cl_retardo" value="0" type="checkbox" < ?php if
($row['cl_cr_use_ip_dst']=="1") printf("\"checked\""); ?> ><input maxlength="3"
size="1" name="cl_cr_ip_dst_1" value= <?php printf("\"%s\"", $cl_cr_ip_dst[0] );
?> ><input maxlength="3" size="1" name="cl_cr_ip_dst_2" value= <?php
printf("\"%s\"", $cl_cr_ip_dst[1] ); ?> ><input maxlength="3" size="1"
name="cl_cr_ip_dst_3" value= <?php printf("\"%s\"", $cl_cr_ip_dst[2] ); ?>
><input maxlength="3" size="1" name="cl_cr_ip_dst_4" value= <?php
printf("\"%s\"", $cl_cr_ip_dst[3] ); ?> > </td>
</tr>
<tr>

156

<td style="vertical-align: top; text-align: right;">Clase


padre<br>
</td>
<td style="vertical-align: top; width: 216px;"><input
name="cl_padrep" value="0" type="check
</tr>
</tbody>
</table>
</form>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<br>
<br>
</body></html>

ANEXO C.12 ELIMINARCLASE.PHP


<?php
try
{
//crea o abre la base de datos (debe? contener el path relativo al
root del servidor www)
$database = new SQLiteDatabase('control.sqlite2', 0666, $error);
}
catch(Exception $e)
{
die($error);
}
// prepara la solicitud (query) de datos en la tabla t_cl_clases
$query = "delete from t_cl_clases where cl_id=".$_GET['cl_id'];
//printf("%s",$query);
if($result = $database->query($query, SQLITE_BOTH, $error))
{
$ref = $_SERVER['HTTP_REFERER']; //vuelve atrs
header( 'refresh: 0; url='.$ref);
}
else
{
die($error);
}
?>

ANEXO C.13 REGLASLISTAS.PHP


157

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"


"http://www.w3.org/TR/html4/strict.dtd">
<html><head>

<meta content="text/html; charset=ISO-8859-1" http-equiv="contenttype"><title>Reglas y listas</title></head><body>


<table style="text-align: left; width: 900px; margin-left: auto; margin-right:
auto;" border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 900px; height: 82px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="2"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; height: 82px; width: 202px;"><img
src="images/sanbuena.gif" alt="sanbuena.gif"></td>
<td style="vertical-align: middle; text-align: center;">
<p class="MsoNormal" style="text-align: center;" align="center"><b
style=""><span style="line-height: 115%;"><big><span style="font-family:
monospace;">SISTEMA DE CONTROL DE TRFICO EN REDES
DE DATOS CON IMPLEMENTACIN DE
NPU</span></big> <o:p></o:p></span></b></p>
</td>
<td style="vertical-align: bottom; height: 82px; width: 202px; textalign: right;">
<dl>
<dt style="font-family: monospace;"><small><small><span
style="line-height: 150%;" lang="PT-BR">HARVEY DEMIAN BASTIDAS
CAICEDO<o:p></o:p></span></small></small><big><span style="line-height: 150%;"
lang="PT-BR"><small><small><small> <br>
</small></small></small></span></big></dt>
<dt><span style="line-height: 150%;" lang="PT-BR"><small
style="font-family: monospace;"><small>DIEGO ANDRS BELTRN
ORDUZ</small></small><span style=""> </span><o:p></o:p></span></dt>
</dl>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 900px; background-color: rgb(255,
102, 0); height: 20px;"><br>
</td>
</tr>
<tr align="center">
<td style="vertical-align: top; width: 900px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="10"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 202px; height: 900px;
background-color: rgb(255, 102, 0);"><br>
<br>
<br>

158

<span style="font-weight: bold;">Configuracion</span><br><a


href="lan.php">
Lan</a><br><a href="wan.php">
Wan</a><br><a href="rutas.php">
Rutas</a><br>
<br>
<a href="clases.php"><span style="font-weight:
bold;">Clases</span></a><br>
<br>
<span style="font-weight: bold;">Criterios de
clasificacin</span><br>
<br>
<span style="font-weight: bold;">Diagnstico</span><br><a
href="ping.html">
Ping</a><br><a href="traceroute.html">
Traceroute</a><br>
<br>
<a href="aplicarcambios.html"><span style="font-weight:
bold;">Aplicar cambios</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="reiniciar.html"><span style="font-weight:
bold;">Reiniciar</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="reiniciofabrica.html"><span style="font-weight:
bold;">Reinicio de fabrica</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="contrasena.html"><span style="font-weight: bold;">Cambiar
contrasea</span></a><br>
<br>
</td>
<td style="vertical-align: top; color: rgb(3, 5, 3);"><br>
<br>
<div style="text-align: center;"><a href="agregaregla.php">Agregar
criterio de clasificacin.</a><br>
</div>
<br>
<table style="text-align: left; width: 690px;" border="1"
cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top; width: 60px; text-align:
center;"><small>Id<br>
</small></td>
<td style="vertical-align: top; text-align: center; width:
469px;"><small>Descripcin de los criterios<br>
</small></td>
<td style="vertical-align: top; width: 130px;">Opciones&nbsp;
</td>
</tr>
</tbody>
</table>
<table style="text-align: left; width: 690px;" border="1"
cellpadding="2" cellspacing="2">
<tbody>
<?php
try
{
//crea o abre la base de datos (debe? contener el path relativo al
root del servidor www)
$database = new SQLiteDatabase('control.sqlite2', 0666, $error);

159

}
catch(Exception $e)
{
die($error);
}
// prepara la solicitud (query) de datos en la tabla t_cl_clases
$query = "SELECT * FROM t_cl_criterios";
if($result = $database->query($query, SQLITE_BOTH, $error))
{
while($row = $result->fetch())
{
$claseCompleta=$row['cl_cr_clase'];//obtiene solo el id de la
clase hija tomando lo que sigue a : .
$clase = explode(":", $claseCompleta);
$resumen="";
if ($row['cl_cr_use_mac_src']==1) $resumen="
mac_s=".$row['cl_cr_mac_src'];
if($row['cl_cr_use_icmp']==1) $resumen=$resumen."
proto=ICMP";
if(($row['cl_cr_use_udp'])==1) $resumen=$resumen."
proto=UDP";
if(($row['cl_cr_use_tcp'])==1) $resumen=$resumen."
proto=TCP";
if ($row['cl_cr_use_ip_src']==1) $resumen=$resumen."
IPf=".$row['cl_cr_ip_src'];
if ($row['cl_cr_use_mask_src']==1)
$resumen=$resumen."/".$row['cl_cr_mask_src'];
if ($row['cl_cr_use_puerto_src']==1)
$resumen=$resumen." pf=".$row['cl_cr_puerto_src'];
if ($row['cl_cr_use_ip_dst']==1) $resumen=$resumen."
IPd=".$row['cl_cr_ip_dst'];
if ($row['cl_cr_use_mask_dst']==1)
$resumen=$resumen."/".$row['cl_cr_mask_dst'];
if ($row['cl_cr_use_puerto_dst']==1)
$resumen=$resumen." pd=".$row['cl_cr_puerto_dst'];
if ($clase[1]<3)
$resumen=$resumen." clase: root(0)";
else{
$num=$clase[1]-2;
$resumen=$resumen." clase:".$num;
}
printf("<tr>
<td style=\"vertical-align: middle; width: 61px;\"> %s </td>
<td style=\"vertical-align: middle; width: 475px;\"> %s </td>
<td style=\"vertical-align: middle;\"><a
href=\"modificarcriterio.php?cr_id=%s\">Modificar</a>|<a
href=\"eliminarcriterio.php?cr_id=%s \">Eliminar</a></td>
</tr>", $row['cr_id'], $resumen, $row['cr_id'], $row['cr_id']);
//muestra cada resultado
}
}
else
{
die($error);
}
?>

160

</tbody>
</table>
<br>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<br>
<br>
</body></html>

ANEXO C.14 AGREGAREGLA.PHP


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="contenttype"><title>nueva regla</title></head><body>
<table style="text-align: left; width: 900px; margin-left: auto; margin-right:
auto;" border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 900px; height: 82px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="2"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; height: 82px; width: 202px;"><img
src="images/sanbuena.gif" alt="sanbuena.gif"></td>
<td style="vertical-align: middle; text-align: center;">
<p class="MsoNormal" style="text-align: center;" align="center"><b
style=""><span style="line-height: 115%;"><big><span style="font-family:
monospace;">SISTEMA DE CONTROL DE TRFICO EN REDES
DE DATOS CON IMPLEMENTACIN DE
NPU</span></big> <o:p></o:p></span></b></p>
</td>
<td style="vertical-align: bottom; height: 82px; width: 202px; textalign: right;">
<dl>
<dt style="font-family: monospace;"><small><small><span
style="line-height: 150%;" lang="PT-BR">HARVEY DEMIAN BASTIDAS
CAICEDO<o:p></o:p></span></small></small><big><span style="line-height: 150%;"
lang="PT-BR"><small><small><small> <br>
</small></small></small></span></big></dt>
<dt><span style="line-height: 150%;" lang="PT-BR"><small
style="font-family: monospace;"><small>DIEGO ANDRS BELTRN
ORDUZ</small></small><span style=""> </span><o:p></o:p></span></dt>
</dl>

161

</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 900px; background-color: rgb(255,
102, 0); height: 20px;"><br>
</td>
</tr>
<tr align="center">
<td style="vertical-align: top; width: 900px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="10"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 202px; height: 900px;
background-color: rgb(255, 102, 0);"><br>
<br>
<br>
<span style="font-weight: bold;">Configuracion</span><br><a
href="lan.php">
Lan</a><br><a href="wan.php">
Wan</a><br><a href="rutas.php">
Rutas</a><br>
<br>
<a href="clases.php"><span style="font-weight:
bold;">Clases</span></a><br>
<br>
<a href="reglaslistas.php"><span style="font -weight: bold;">Criterios
de clasificacin.</span></a><br>
<br>
<span style="font-weight: bold;">Diagnstico</span><br><a
href="ping.html">
Ping</a><br><a href="traceroute.html">
Traceroute<br>
</a>
<br>
<a href="aplicarcambios.html"><span style="font-weight:
bold;">Aplicar cambios</span><br style="font-weight: bold;">
</a>
<br style="font-weight: bold;">
<a href="reiniciar.html"><span style="font-weight:
bold;">Reiniciar</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="reiniciofabrica.html"><span style="font-weight:
bold;">Reinicio de fabrica</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="contrasena.html"><span style="font-weight: bold;">Cambiar
contrasea</span></a><br>
<br>
</td>
<td style="vertical-align: top; color: rgb(3, 5, 3);"><br>
<br>
<br>
<form style="height: 335px;" method="get" action="nuevocriterio.php"
name="nueva">
<table style="text-align: left; height: 116px; margin-left: auto;
margin-right: auto; width: 670px;" border="0" cellpadding="4" cellspacing="0">

162

<tbody>
<tr>
<td style="vertical-align: top; width: 200px; text -align:
right;">MAC&nbsp; fuente <br>
</td>
<td style="vertical-align: top; width: 216px;"><input
name="cl_cr_use_mac_src" value="0" type="checkbox"><input maxlength="12"
size="20" name="cl_cr_mac_src" value="">&nbsp; </td>
</tr>
<tr>
<td style="vertical-align: top; text-align: right;">IP
fuente<br>
</td>
<td style="vertical-align: top; width: 216px;"><input
name="cl_cr_use_ip_src" value="0" type="checkbox"><input maxlength="3" size="1"
name="cl_cr_ip_src_1" value="0"><input maxlength="3" size="1"
name="cl_cr_ip_src_2" value="0"><input maxlength="3" size="1"
name="cl_cr_ip_src_3" value="0"><input maxlength="3" size="1"
name="cl_cr_ip_src_4" value="0"> </td>
</tr>
<tr>
<tr>
<td style="vertical-align: top; text-align: right;">Mscara
fuente<br>
</td>
<td style="vertical-align: top; width: 216px;"><input
name="cl_cr_use_mask_src" value="0" type="checkbox"><input maxlength="3" size="1"
name="cl_cr_mask_src_1" value="0"><input maxlength="3" size="1"
name="cl_cr_mask_src_2" value="0"><input maxlength="3" size="1"
name="cl_cr_mask_src_3" value="0"><input maxlength="3" size="1"
name="cl_cr_mask_src_4" value="0"> </td>
</tr>
<tr>
<td style="vertical-align: top; text-align: right;">IP
destino<br>
</td>
<td style="vertical-align: top; width: 216px;"><input
name="cl_cr_use_ip_dst" value="0" type="checkbox"><input maxlength="3" size="1"
name="cl_cr_ip_dst_1" value="0"><input maxlength="3" size="1"
name="cl_cr_ip_dst_2" value="0"><input maxlength="3" size="1"
name="cl_cr_ip_dst_3" value="0"><input maxlength="3" size="1"
name="cl_cr_ip_dst_4" value="0"> </td>
</tr>
<tr>
<tr>
<td style="vertical-align: top; text-align: right;">Mscara
destino<br>
</td>
<td style="vertical-align: top; width: 216px;"><input
name="cl_cr_use_mask_dst" value="0" type="checkbox"><input maxlength="3" size="1"
name="cl_cr_mask_dst_1" value="0"><input maxlength="3" size="1"
name="cl_cr_mask_dst_2" value="0"><input maxlength="3" size="1"
name="cl_cr_mask_dst_3" value="0"><input maxlength="3" size="1"
name="cl_cr_mask_dst_4" value="0"> </td>
</tr>
<tr>
<td style="vertical-align: top; text-align: right;">Puerto
fuente<br>

163

</td>
<td style="vertical-align: top; width: 216px;"><input
name="cl_cr_use_puerto_src" value="0" type="checkbox"><input maxlength="4"
size="5" name="cl_cr_puerto_src" value=""> </td>
</tr>
<tr>
<td style="vertical-align: top; text-align: right;">Puerto
destino<br>
</td>
<td style="vertical-align: top; width: 216px;"><input
name="cl_cr_use_puerto_dst" value="0" type="checkbox"><input maxlength ="4"
size="5" name="cl_cr_puerto_dst" value=""></td>
</tr>
<tr>
<td style="vertical-align: top; text-align:
right;">Protocolos<br>
<br>
<br>
Clase<br>
<br>
<br>
</td>
<td style="vertical-align: top; width: 216px;">
<select
<option
<option
<option
<option

name="cl_cr_use_lista">
value="1">IP</option>
value="2">ICMP</option>
value="3">TCP</option>
value="4">UDP</option>

</select>
<br>
<br>
<br>
<input
maxlength="4" size="5" name="cl_cr_clase" value="1">
<br>
<br>
<div style="text-align: right;"><input name="submit"
value="Guardar" type="submit"><br>
</div>
</td>
</tr>
</tbody>
</table>
</form>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<br>

164

<br>
</body></html>

ANEXO C.15 NUEVOCRITERIO.PHP


<?php
try
{
//crea o abre la base de datos (debe? contener el path relativo al
root del servidor www)
$database = new SQLiteDatabase('control.sqlite2', 0666, $error);
}
catch(Exception $e)
{
die($error);
}
$cl_cr_use_mac_src="1";
$cl_cr_mac_src=$_GET['cl_cr_mac_src'];
if($_GET['cl_cr_use_mac_src']==NULL){
$cl_cr_use_mac_src="0";
$cl_cr_mac_src="NULL";
}
$cl_cr_use_ip_src="1";
$cl_cr_ip_src="".$_GET['cl_cr_ip_src_1'].".".$_GET['cl_cr_ip_src_2'].".".$_
GET['cl_cr_ip_src_3'].".".$_GET['cl_cr_ip_src_4'];
if($_GET['cl_cr_use_ip_src']==NULL){
$cl_cr_use_ip_src="0";
$cl_cr_ip_src="NULL";
}
$cl_cr_use_mask_src="1";
$cl_cr_mask_src="".$_GET['cl_cr_mask_src_1'].".".$_GET['cl_cr_mask_src_2'].
".".$_GET['cl_cr_mask_src_3'].".".$_GET['cl_cr_mask_src_4'];
if($_GET['cl_cr_use_mask_src']==NULL){
$cl_cr_use_mask_src="0";
$cl_cr_mask_src="NULL";
}
$cl_cr_use_ip_dst="1";
$cl_cr_ip_dst="".$_GET['cl_cr_ip_dst_1'].".".$_GET['cl_cr_ip_dst_2'].".".$_
GET['cl_cr_ip_dst_3'].".".$_GET['cl_cr_ip_dst_4'];
if($_GET['cl_cr_use_ip_dst']==NULL){
$cl_cr_use_ip_dst="0";
$cl_cr_ip_dst="NULL";
}
$cl_cr_use_mask_dst="1";
$cl_cr_mask_dst="".$_GET['cl_cr_mask_dst_1'].".".$_GET['cl_cr_mask_dst_2'].
".".$_GET['cl_cr_mask_dst_3'].".".$_GET['cl_cr_mask_dst_4'];
if($_GET['cl_cr_use_mask_dst']==NULL){
$cl_cr_use_mask_dst="0";

165

$cl_cr_mask_dst="NULL";
}
$cl_cr_use_puerto_dst="1";
$cl_cr_puerto_dst=$_GET['cl_cr_puerto_dst'];
if($_GET['cl_cr_use_puerto_dst']==NULL){
$cl_cr_use_puerto_dst="0";
$cl_cr_puerto_dst="NULL";
}
$cl_cr_use_puerto_src="1";
$cl_cr_puerto_src=$_GET['cl_cr_puerto_src'];
if($_GET['cl_cr_use_puerto_src']==NULL){
$cl_cr_use_puerto_src="0";
$cl_cr_puerto_src="NULL";
}
$cl_cr_use_icmp=0;
//seleccionamos entre los protocolos
deacuerdo al form de agregaregla.php
$cl_cr_use_tcp=0;
$cl_cr_use_udp=0;
if ($_GET['cl_cr_use_lista']==2){
$cl_cr_use_icmp=1;
$cl_cr_use_puerto_src="0";
$cl_cr_puerto_src="NULL";
$cl_cr_use_puerto_dst="0";
$cl_cr_use_puerto_dst="NULL";
}
if ($_GET['cl_cr_use_lista']==3) $cl_cr_use_tcp=1;
if ($_GET['cl_cr_use_lista']==4) $cl_cr_use_udp=1;
$query = "select * from t_cl_clases where
cl_id=".$_GET['cl_cr_clase'];
//prepara query para buscar la interfaz
de la clase seleccionada: $_GET['cl_cr_clase']
if($result = $database->query($query, SQLITE_BOTH, $error))
{
if (($result->numRows())==1){
$row = $result->fetch();
if ($_GET['cl_cr_clase']==0)
{
if ($row['cl_subida']==0)
$cl_cr_clase="\"1:1\"";
else
$cl_cr_clase="\"2:2\"";
}
else
{
$num=$_GET['cl_cr_clase']+2;
if ($row['cl_subida']==0)
$cl_cr_clase="\"1:".$num."\"";
else
$cl_cr_clase="\"2:".$num."\"";
}
}
else if (($result->numRows())==0)
{
//header( 'refresh: 3; url=/reglaslistas.php');
//redirecciona en 3 segundos a reglaslistas
header( 'refresh: 3; url='.$_SERVER['HTTP_REFERER']);
//redirecciona a la pgina anterior

166

die("Error: La clase de destino no existe, redireccionando...


por favor espere.");
}
else if (($result->numRows())>1)
{
die("Error: La clase solicitada est definida ms de
una vez en la tabla de clases.");
}
}
else
{
die("Error: Ejecutando consulta en la base de datos.");
}
$query = 'insert into t_cl_criterios (cl_cr_use_mac_src,
cl_cr_mac_src, cl_cr_use_icmp, cl_cr_use_ip_src, cl_cr_ip_src,
cl_cr_use_ip_dst, cl_cr_ip_dst,
cl_cr_use_tcp, cl_cr_use_udp, cl_cr_use_puerto_src, cl_cr_puerto_src,
cl_cr_use_puerto_dst,
cl_cr_puerto_dst,cl_cr_clase,cl_cr_use_mask_src, cl_cr_mask_src,
cl_cr_use_mask_dst, cl_cr_mask_dst
)
values ('.$cl_cr_use_mac_src.", \"".
$cl_cr_mac_src."\",". $cl_cr_use_icmp.",". $cl_cr_use_ip_src.",\"".
$cl_cr_ip_src."\",". $cl_cr_use_ip_dst.",\"". $cl_cr_ip_dst."\",". $cl_cr_use_tcp
.",".
$cl_cr_use_udp.",".$cl_cr_use_puerto_src.",".$cl_cr_puerto_src.",".$cl_cr_use_pue
rto_dst.",". $cl_cr_puerto_dst.",".$cl_cr_clase.",". $cl_cr_use_mask_src.", \"".
$cl_cr_mask_src."\",". $cl_cr_use_mask_dst.",\"". $cl_cr_mask_dst."\")";//
prepara la solicitud (query) de datos en la tabla t_cl_criterios
//printf($query);
if($result = $database->query($query, SQLITE_BOTH, $error))
{
//$ref = $_SERVER['SERVER_ADDR'];
header( 'refresh: 0; url=/reglaslistas.php');
}
else
{
die($error);
}
?>

ANEXO C.16 MODIFICARCRITERIO.PHP


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="contenttype"><title>Modificar regla</title></head><body>
<table style="text-align: left; width: 900px; margin-left: auto; margin-right:
auto;" border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 900px; height: 82px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="2"
cellspacing="0">
<tbody>

167

<tr>
<td style="vertical-align: top; height: 82px; width: 202px;"><img
src="images/sanbuena.gif" alt="sanbuena.gif"></td>
<td style="vertical-align: middle; text-align: center;">
<p class="MsoNormal" style="text-align: center;" align="center"><b
style=""><span style="line-height: 115%;"><big><span style="font-family:
monospace;">SISTEMA DE CONTROL DE TRFICO EN REDES
DE DATOS CON IMPLEMENTACIN DE
NPU</span></big> <o:p></o:p></span></b></p>
</td>
<td style="vertical-align: bottom; height: 82px; width: 202px; textalign: right;">
<dl>
<dt style="font-family: monospace;"><small><small><span
style="line-height: 150%;" lang="PT-BR">HARVEY DEMIAN BASTIDAS
CAICEDO<o:p></o:p></span></small></small><big><span style="line-height: 150%;"
lang="PT-BR"><small><small><small> <br>
</small></small></small></span></bi g></dt>
<dt><span style="line-height: 150%;" lang="PT-BR"><small
style="font-family: monospace;"><small>DIEGO ANDRS BELTRN
ORDUZ</small></small><span style=""> </span><o:p></o:p></span></dt>
</dl>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 900px; background-color: rgb(255,
102, 0); height: 20px;"><br>
</td>
</tr>
<tr align="center">
<td style="vertical-align: top; width: 900px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="10"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 202px; height: 900px;
background-color: rgb(255, 102, 0);"><br>
<br>
<br>
<span style="font-weight: bold;">Configuracion</span><br><a
href="lan.php">
Lan</a><br><a href="wan.php">
Wan</a><br><a href="rutas.php">
Rutas</a><br>
<br>
<a href="clases.php"><span style="font-weight:
bold;">Clases</span></a><br>
<br>
<a href="reglaslistas.php"><span style="font -weight: bold;">Criterios
de clasificacin.</span></a><br>
<br>
<span style="font-weight: bold;">Diagnstico</span><br><a
href="ping.html">
Ping</a><br><a href="traceroute.html">
Traceroute<br>
</a>

168

<br>
<a href="aplicarcambios.html"><span style="font-weight:
bold;">Aplicar cambios</span><br style="font-weight: bold;">
</a>
<br style="font-weight: bold;">
<a href="reiniciar.html"><span style="font-weight:
bold;">Reiniciar</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="reiniciofabrica.html"><span style="font-weight:
bold;">Reinicio de fabrica</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="contrasena.html"><span style="font-weight: bold;">Cambiar
contrasea</span></a><br>
<br>
</td>
<td style="vertical-align: top; color: rgb(3, 5, 3);"><br>
<br>
<br>
<?php
try
{
//crea o abre la base de datos (debe contener el path relativo al
root del servidor www)
$database = new SQLiteDatabase('control.sqlite2', 0666, $error);
}
catch(Exception $e)
{
die($error);
}
// prepara la solicitud (query) de datos en la tabla t_cl_criterios
$query = "SELECT * FROM t_cl_criterios WHERE cr_id=".$_GET['cr_id'];
if($result = $database->query($query, SQLITE_BOTH, $error))
{
if (($result->numRows())>0)
{
$row = $result->fetch();
$cl_cr_ip_src = explode(".", $row['cl_cr_ip_src']);
$cl_cr_mask_src = explode(".", $row['cl_cr_mask_src']);
$cl_cr_ip_dst = explode(".", $row['cl_cr_ip_dst']);
$cl_cr_mask_dst = explode(".", $row['cl_cr_mask_dst']);
$cl_cr_clase = explode(":", $row['cl_cr_clase']);
}
}
?>
<form style="height: 335px;" method="get" action="editcriterio.php"
name="nueva">
<input name="cr_id" type="hidden" value=<?php
printf("\"%s\"",$_GET['cr_id']); ?> >
<table style="text-align: left; height: 116px; marg in-left: auto;
margin-right: auto; width: 670px;" border="0" cellpadding="4" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; text-align: right;">IP
fuente<br>
</td>

169

<td style="vertical-align: top; width: 216px;"><input


name="cl_cr_use_ip_src" value="0" type="checkbox" <?php if
($row['cl_cr_use_ip_src']=="1") printf("\"checked\""); ?> ><input maxlength="3"
size="1" name="cl_cr_ip_src_1" value= <?php printf("\"%s\"", $cl_cr_ip_src[0] );
?> ><input maxlength="3" size="1" name="cl_cr_ip_src_2" value= <?php
printf("\"%s\"", $cl_cr_ip_src[1] ); ?> ><input maxlength="3" size="1"
name="cl_cr_ip_src_3" value= <?php printf("\"%s\"", $cl_cr_ip_src[2] ); ?>
><input maxlength="3" size="1" name="cl_cr_ip_src_4" value= <?php
printf("\"%s\"", $cl_cr_ip_src[3] ); ?> > </td>
</tr>
<tr>
<tr>
<td style="vertical-align: top; text-align: right;">Mscara
fuente<br>
</td>
<td style="vertical-align: top; width: 216px;"><input
name="cl_cr_use_mask_src" value= "0" type="checkbox" <?php if
($_row['cl_cr_use_mask_src']=="1") printf("\"checked\""); ?> ><input
maxlength="3" size="1" name="cl_cr_mask_src_1" value= <?php printf("\"%s\"",
$cl_cr_mask_src[0] ); ?> ><input maxlength="3" size="1" name="cl_cr_mask_src_2"
value= <?php printf("\"%s\"", $cl_cr_mask_src[1] ); ?> ><input maxlength="3"
size="1" name="cl_cr_mask_src_3" value= <?php printf("\"%s\"", $cl_cr_mask_src[2]
); ?> > <input maxlength="3" size="1" name="cl_cr_mask_src_4" value= <?php
printf("\"%s\"", $cl_cr_mask_src[3] ); ?> > </td>
</tr>
<tr>
<td style="vertical-align: top; text-align: right;">IP
destino<br>
</td>
<td style="vertical-align: top; width: 216px;"><input
name="cl_cr_use_ip_dst" value="0" type="checkbox" <?php if
($row['cl_cr_use_ip_dst']=="1") printf("\"checked\""); ?> ><input maxlength="3"
size="1" name="cl_cr_ip_dst_1" value= <?php printf("\"%s\"", $cl_cr_ip_dst[0] );
?> ><input maxlength="3" size="1" name="cl_cr_ip_dst_2" value= <?php
printf("\"%s\"", $cl_cr_ip_dst[1] ); ?> ><input maxlength="3" size="1"
name="cl_cr_ip_dst_3" value= <?php printf("\"%s\"", $cl_cr_ip_dst[2] ); ?>
><input maxlength="3" size="1" name="cl_cr_ip_dst_4" value= <?php
printf("\"%s\"", $cl_cr_ip_dst[3] ); ?> > </td>
</tr>
<tr>
<tr>
<td style="vertical-align: top; text-align: right;">Mscara
destino<br>
</td>
<td style="vertical-align: top; width: 216px;"><input
name="cl_cr_use_mask_dst" value="0" type="checkbox" <?php if
($row['cl_cr_use_mask_dst']=="1") printf("\"checked\"");?> ><input maxlength="3"
size="1" name="cl_cr_mask_dst_1" value= <?php printf("\"%s\"", $cl_cr_mask_dst[0]
); ?> ><input maxlength="3" size="1" name="cl_cr_mask_dst_2" value= <?php
printf("\"%s\"", $cl_cr_mask_dst[1] ); ?> ><input maxlength="3" size="1"
name="cl_cr_mask_dst_3" value= <?php printf(" \"%s\"", $cl_cr_mask_dst[2] ); ?>
><input maxlength="3" size="1" name="cl_cr_mask_dst_4" value= <?php
printf("\"%s\"", $cl_cr_mask_dst[3] ); ?> > </td>
</tr>
<tr>
<td style="vertical-align: top; text-align: right;">Puerto
fuente<br>
</td>

170

<td style="vertical-align: top; width: 216px;"><input


name="cl_cr_use_puerto_src" value="0" type="checkbox" <?php if
($row['cl_cr_use_puerto_src']=="1") printf("\"checked\"");?> ><input
maxlength="4" size="5" name="cl_cr_puerto_src" value=<?php printf("\"%s\"",
$row['cl_cr_puerto_src'] ); ?> > </td>
</tr>
<tr>
<td style="vertical-align: top; text-align: right;">Puerto
destino<br>
</td>
<td style="vertical-align: top; width: 216px;"><input
name="cl_cr_use_puerto_dst" value="0" type="checkbox" <?php if
($row['cl_cr_use_puerto_dst']=="1") printf("\"checked\"");?> ><input
maxlength="4" size="5" name="cl_cr_puerto_dst" value=<?php printf("\"%s\"",
$row['cl_cr_puerto_dst'] ); ?> ></td>
</tr>
<tr>
<td style="vertical-align: top; text-align:
right;">Protocolos<br>
<br>
<br>
Clase<br>
<br>
<br>
</td>
<td style="vertical-align: top; width: 216px;">
<select name="cl_cr_use_lista">
<option value="1" >IP</option>
<option value="2" <?php if ($row['cl_cr_use_icmp']=="1")
printf("\"selected\"");?> >ICMP</option>
<option value="3" <?php if ($row['cl_cr_use_tcp']=="1")
printf("\"selected\"");?> >TCP</option>
<option value="4" <?php if ($row['cl_cr_use_udp']=="1")
printf("\"selected\"");?> >UDP</option>
</select>
<br>
<br>
<br>
<input
maxlength="4" size="5" name="cl_cr_clase" value=<?php printf("\"%s\"",
$cl_cr_clase[1]-2 ); ?> >
<br>
<br>
<div style="text-align: right;"><input name="submit"
value="Guardar" type="submit"><br>
</div>
</td>
</tr>
</tbody>
</table>
</form>
</td>
</tr>
</tbody>

171

</table>
</td>
</tr>
</tbody>
</table>
<br>
<br>
</body></html>

ANEXO C.17 ELIMINARCRITERIO.PHP


<?php
try
{
//crea o abre la base de datos (debe? contener el path relativo al
root del servidor www)
$database = new SQLiteDatabase('control.sqlite2', 0666, $error);
}
catch(Exception $e)
{
die($error);
}
// prepara la solicitud (query) de datos en la tabla t_cl_clases
$query = "delete from t_cl_criterios where cr_id=".$_GET['cr_id'];
//printf("%s",$query);
if($result = $database->query($query, SQLITE_BOTH, $error))
{
$ref = $_SERVER['HTTP_REFERER']; //vuelve atrs
header( 'refresh: 0; url='.$ref);
}
else
{
die($error);
}
?>

ANEXO C.18 PING.HTML


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="contenttype"><title>Ping</title></head><body>
<table style="text-align: left; width: 900px; margin-left: auto; margin-right:
auto;" border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 900px; height: 82px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="2"
cellspacing="0">

172

<tbody>
<tr>
<td style="vertical-align: top; height: 82px; width: 202px;"><img
src="images/sanbuena.gif" alt="sanbuena.gif"></td>
<td style="vertical-align: middle; text-align: center;">
<p class="MsoNormal" style="text-align: center;" align="center"><b
style=""><span style="line-height: 115%;"><big><span style="font-family:
monospace;">SISTEMA DE CONTROL DE TRFICO EN REDES
DE DATOS CON IMPLEMENTACIN DE
NPU</span></big> <o:p></o:p></span></b></p>
</td>
<td style="vertical-align: bottom; height: 82px; width: 202px; textalign: right;">
<dl>
<dt style="font-family: monospace;"><small><small><span
style="line-height: 150%;" lang="PT-BR">HARVEY DEMIAN BASTIDAS
CAICEDO<o:p></o:p></span></small></small><big><span style="line-height: 150%;"
lang="PT-BR"><small><small><small> <br>
</small></small></small></span></big></dt>
<dt><span style="line-height: 150%;" lang="PT-BR"><small
style="font-family: monospace;"><small>DIEGO ANDRS BELTRN
ORDUZ</small></small><span style=""> </span><o:p></o:p></span></dt>
</dl>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 900px; background-color: rgb(255,
102, 0); height: 20px;"><br>
</td>
</tr>
<tr align="center">
<td style="vertical-align: top; width: 900px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="10"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 202px; height: 900px;
background-color: rgb(255, 102, 0);"><br>
<br>
<br>
<span style="font-weight: bold;">Configuracion</span><br><a
href="lan.php">
Lan</a><br><a href="wan.php">
Wan</a><br><a href="rutas.php">
Rutas</a><br>
<br>
<a href="clases.php"><span style="font-weight:
bold;">Clases</span></a><br>
<br>
<a href="reglaslistas.php"><span style="font -weight: bold;">Reglas y
listas</span></a><br>
<br>
<span style="font-weight: bold;">Diagnstico</span><br>
Ping<br><a href="traceroute.html">
Traceroute</a><br>
<br>

173

<a href="aplicarcambios.html"><span style="font-weight:


bold;">Aplicar cambios</span><br style="font-weight: bold;">
</a>
<br style="font-weight: bold;">
<a href="reiniciar.html"><span style="font-weight:
bold;">Reiniciar</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="reiniciofabrica.html"><span style="font-weight:
bold;">Reinicio de fabrica</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="contrasena.html"><span style="font-weight: bold;">Cambiar
contrasea</span></a><br>
<br>
</td>
<td style="vertical-align: top; color: rgb(3, 5, 3);"><br>
<br>
<br>
<form method="get" action="/cgi-bin/ping.pl" name="ping">
<table style="text-align: left; width: 400px; height: 116px;
margin-left: auto; margin-right: auto;" border="0" cellpadding="4"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 200px; text -align:
right;">IP <br>
</td>
<td style="vertical-align: top; width: 200px;"><input
maxlength="50" size="30" name="ping_addr" value=" www.usbcali.edu.co"> </td>
</tr>
<tr>
<td style="vertical-align: top; text-align: right;">Nmero de
pings<br>
</td>
<td style="vertical-align: top;"><input maxlength="4"
size="3" name="ping_num" value="4"> &nbsp; &nbsp; &nbsp; </td>
</tr>
<td>
<input name="submit" value="Realizar" type="submit">
</td>
<td>
</td>
</tr>
</tbody>
</table>
</form>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<br>
<br>
</body></html>

174

ANEXO C.19 PING.PL


#!/usr/bin/perl
# declaracin de variables
local(%salida) ;
local($campo, $valor) ;
# Lee todas las variables GET en un arreglo asociativo (salida).
# Divide la cadena recibida usando & o ; y se obtienen solo los caractres
vlidos
foreach ( split(/[&;]/, $ENV{'QUERY_STRING'})) {
s/\+/ /g ;
($campo, $valor)= split('=', $_, 2) ;
$campo=~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge ;
$valor=~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge ;
$salida{$campo}.= "\0" if defined($salida{$campo}) ; # concatena varias
variables
$salida{$campo}.= $valor ;
}
print "Content-type: text/html", "\n\n";
print "<HTML>", "\n";
print "<HEAD>";
print "<TITLE>Resultado de ping</TITLE>", "\n";
print "<HEAD>", "\n";
print "<BODY>", "\n";
print "<br><br>Por favor espere mientras se generan los resultados.<br>Esto
tomar aproximadamente ",$salida{'ping_num'}," segundos.<br><br>";
system("sudo ping -q -c ".$salida{'ping_num'}." ".$salida{'ping_addr'} );
printf("<br><br><a href=/ping.html>Volver a men de ping</a>");
print "</BODY>", "\n";
print "</HTML>", "\n";

ANEXO C.20 TRACEROUTE.HTML


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="contenttype"><title>Traceroute</title></head><body>
<table style="text-align: left; width: 900px; margin-left: auto; margin-right:
auto;" border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 900px; height: 82px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="2"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; height: 82px; width: 202px;"><img
src="images/sanbuena.gif" alt="sanbuena.gif"></td>
<td style="vertical-align: middle; text-align: center;">

175

<p class="MsoNormal" style="text-align: center;" align="center"><b


style=""><span style="line-height: 115%;"><big><span style="font-family:
monospace;">SISTEMA DE CONTROL DE TRFICO EN REDES
DE DATOS CON IMPLEMENTACIN DE
NPU</span></big> <o:p></o:p></span></b></p>
</td>
<td style="vertical-align: bottom; height: 82px; width: 202px; textalign: right;">
<dl>
<dt style="font-family: monospace;"><small><small><span
style="line-height: 150%;" lang="PT-BR">HARVEY DEMIAN BASTIDAS
CAICEDO<o:p></o:p></span></small></small><big><span style="line-height: 150%;"
lang="PT-BR"><small><small><small> <br>
</small></small></small></span></big></dt>
<dt><span style="line-height: 150%;" lang="PT-BR"><small
style="font-family: monospace;"><small>DIEGO ANDRS BELTRN
ORDUZ</small></small><span style=""> </span><o:p></o:p></span></dt>
</dl>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 900px; background-color: rgb(255,
102, 0); height: 20px;"><br>
</td>
</tr>
<tr align="center">
<td style="vertical-align: top; width: 900px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="10"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 202px; height: 900px;
background-color: rgb(255, 102, 0);"><br>
<br>
<br>
<span style="font-weight: bold;">Configuracion</span><br><a
href="lan.php">
Lan</a><br><a href="wan.php">
Wan</a><br>
<a href="rutas.php">Rutas</a><br>
<br>
<a href="clases.php"><span style="font-weight:
bold;">Clases</span></a><br>
<br>
<a href="reglaslistas.php"><span style="font -weight: bold;">Reglas y
listas</span><br>
</a>
<br>
<span style="font-weight: bold;">Diagnstico</span><br><a
href="ping.html">
Ping</a><br>
Traceroute<br>
<br>
<a href="aplicarcambios.html"><span style="font-weight:
bold;">Aplicar cambios</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">

176

<a href="reiniciar.html"><span style="font-weight:


bold;">Reiniciar</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="reiniciofabrica.html"><span style="font-weight:
bold;">Reinicio de fabrica</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="contrasena.html"><span style="font-weight: bold;">Cambiar
contrasea</span><br>
</a>
<br>
</td>
<td style="vertical-align: top; color: rgb(3, 5, 3);"><br>
<br>
<br>
<form method="get" action="cgi-bin/traceroute.pl" name="tracerou">
<table style="text-align: left; width: 400px; height: 116px;
margin-left: auto; margin-right: auto;" border="0" cellpadding="4"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 200px; text -align:
right;">IP <br>
</td>
<td style="vertical-align: top; width: 200px;"><input
maxlength="50" size="30" name="traceroute_addr" value="www.usbcali.edu.co"></td>
</tr>
<tr>
<td style="vertical-align: top; text-align: right;">TTL<br>
</td>
<td style="vertical-align: top;"><input maxlength="6"
size="6" name="traceroute_ttl" value="128"> &nbsp; &nbsp;
&nbsp; </td>
</tr>
<tr>
<td style="vertical-align: top; text-align: right;"><br>
</td>
<td style="vertical-align: top; text-align: right;">
<input name="submit" value="Guardar" type="submit"><br>
</td>
</tr>
</tbody>
</table>
</form>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<br>
<br>
</body></html>

177

ANEXO C.21 TRACEROUTE.PL


#!/usr/bin/perl
# declaracin de variables
local(%salida) ;
local($campo, $valor) ;
# Lee todas las variables GET en un arreglo asociativo (salida).
# Divide la cadena recibida usando & o ; y se obtienen solo los caractres
vlidos
foreach ( split(/[&;]/, $ENV{'QUERY_STRING'})) {
s/\+/ /g ;
($campo, $valor)= split('=', $_, 2) ;
$campo=~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge ;
$valor=~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge ;
$salida{$campo}.= "\0" if defined($salida{$campo}) ; # concatena varias
variables
$salida{$campo}.= $valor ;
}
print "Content-type: text/html", "\n\n";
print "<HTML>", "\n";
print "<HEAD>";
print "<TITLE>Resultado de traceroute|</TITLE>", "\n";
print "<HEAD>", "\n";
print "<BODY>", "\n";
print "<br><br>Por favor espere mientras se generan los resultados.<br>Esto
tomar aproximadamente ",$salida{'ping_num'}," segundos.<br><br>";
system("sudo traceroute -m ".$salida{'traceroute_ttl'}."
".$salida{'traceroute_addr'} );
printf("<br><br><a href=traceroute.html>Volver a men de traceroute</a>");
print "</BODY>", "\n";
print "</HTML>", "\n";

ANEXO C.22 APLICARCAMBIOS.HTML


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="contenttype"><title>Aplicar cambios</title></head><body>
<table style="text-align: left; width: 900px; margin-left: auto; margin-right:
auto;" border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 900px; height: 82px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="2"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; height: 82px; width: 202px;"><img
src="images/sanbuena.gif" alt="sanbuena.gif"></td>
<td style="vertical-align: middle; text-align: center;">
<p class="MsoNormal" style="text-align: center;" align="center"><b
style=""><span style="line-height: 115%;"><big><span style="font-family:
monospace;">SISTEMA DE CONTROL DE TRFICO EN REDES

178

DE DATOS CON IMPLEMENTACIN DE


NPU</span></big> <o:p></o:p></span></b></p>
</td>
<td style="vertical-align: bottom; height: 82px; width: 202px; textalign: right;">
<dl>
<dt style="font-family: monospace;"><small><small><span
style="line-height: 150%;" lang="PT-BR">HARVEY DEMIAN BASTIDAS
CAICEDO<o:p></o:p></span></small></small><big><span style="line-height: 150%;"
lang="PT-BR"><small><small><small> <br>
</small></small></small></span></big></dt>
<dt><span style="line-height: 150%;" lang="PT-BR"><small
style="font-family: monospace;"><small>DIEGO ANDRS BELTRN
ORDUZ</small></small><span style=""> </span><o:p></o:p></span></dt>
</dl>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 900px; background-color: rgb(255,
102, 0); height: 20px;"><br>
</td>
</tr>
<tr align="center">
<td style="vertical-align: top; width: 900px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="10"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 202px; height: 900px;
background-color: rgb(255, 102, 0);"><br>
<br>
<br>
<span style="font-weight: bold;">Configuracion</span><br><a
href="lan.php">
Lan</a><br><a href="wan.php">
Wan</a><br><a href="rutas.php">
Rutas</a><br>
<br>
<a href="clases.php"><span style="font-weight:
bold;">Clases</span></a><br>
<br>
<a href="reglaslistas.php"><span style="font -weight: bold;">Reglas y
listas</span></a><br>
<br>
<span style="font-weight: bold;">Diagnstico</span><br><a
href="ping.html">
Ping</a><br><a href="traceroute .html">
Traceroute</a><br>
<br>
<span style="font-weight: bold;">Aplicar cambios</span><br
style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="reiniciar.html"><span style="font-weight:
bold;">Reiniciar</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">

179

<a href="reiniciofabrica.html"><span style="font-weight:


bold;">Reinicio de fabrica</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="contrasena.html"><span style="font-weight: bold;">Cambiar
contrasea</span><br>
</a>
<br>
</td>
<td style="vertical-align: top; color: rgb(3, 5, 3);"><br>
<br>
<br>
<div style="text-align: center;"><big><big>&nbsp;&nbsp;&nbsp;
Esta seguro de aplicar los
cambios?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>
</big></big></div>
&nbsp;&nbsp;&nbsp; <br>
<table style="text-align: left; height: 56px; width: 338px; marginleft: 135px;" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top; width: 97px;">
<div style="text-align: center;">
<form method="get" action="cgi-bin/aplicarcambios.pl"
name="aplicar"><input name="submit" value="SI" type="submit"><br>
</form>
</div>
<br>
</td>
<td style="vertical-align: top; width: 117px; text-align:
left;"><a href="lan.html"><img style="border: 0px solid ; width: 40px; height:
22px;" src="images/No.gif" alt="No.gif"></a>
</td>
</tr>
</tbody>
</table>
&nbsp;</td>
</tr>
<tr>
<td style="vertical-align: top;"><br>
</td>
<td style="vertical-align: top;"><br>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<br>
<br>
</body></html>

ANEXO C.23 APLICARCAMBIOS.PL


180

#!/usr/bin/perl
print "Content-type: text/html", "\n\n";
print "<HTML>", "\n";
print "<HEAD>";
print "<TITLE>Aplicando cambios</TITLE>", "\n";
print "<HEAD>", "\n";
print "<BODY>", "\n";
print "<br><br>Por favor espere mientras se realiza el proceso de
reconfiguracin.<br><br>";
system("sudo aplicarcambios.sh");
printf("<br><br><a href=/lan.php>Volver al men.</a>");
print "</BODY>", "\n";
print "</HTML>", "\n";

ANEXO C.24 REINICIAR.HTML


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="contenttype"><title>reinicia maquina</title></head><body>
<table style="text-align: left; width: 900px; margin-left: auto; margin-right:
auto;" border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 900px; height: 82px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="2"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; height: 82px; width:
202px;">&nbsp;<img src="images/sanbuena.gif" alt="sanbuena.gif"></td>
<td style="vertical-align: middle; text-align: center;">
<p class="MsoNormal" style="text-align: center;" align="center"><b
style=""><span style="line-height: 115%;"><big><span style="font-family:
monospace;">SISTEMA DE CONTROL DE TRFICO EN REDES
DE DATOS CON IMPLEMENTACIN DE
NPU</span></big> <o:p></o:p></span></b></p>
</td>
<td style="vertical-align: bottom; height: 82px; width: 202px; textalign: right;">
<dl>
<dt style="font-family: monospace;"><small><small><span
style="line-height: 150%;" lang="PT-BR">HARVEY DEMIAN BASTIDAS
CAICEDO<o:p></o:p></span></small></small><big><span style="line-height: 150%;"
lang="PT-BR"><small><small><small> <br>
</small></small></small></span></big></dt>
<dt><span style="line-height: 150%;" lang="PT-BR"><small
style="font-family: monospace;"><small>DIEGO ANDRS BELTRN
ORDUZ</small></small><span style=""> </span><o:p></o:p></span></dt>
</dl>
</td>
</tr>
</tbody>
</table>
</td>
</tr>

181

<tr>
<td style="vertical-align: top; width: 900px; background-color: rgb(255,
102, 0); height: 20px;"><br>
</td>
</tr>
<tr align="center">
<td style="vertical-align: top; width: 900px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="10"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 202px; height: 900px;
background-color: rgb(255, 102, 0);"><br>
<br>
<br>
<span style="font-weight: bold;">Configuracion</span><br><a
href="lan.html">
Lan</a><br><a href="wan.html">
Wan</a><br><a href="rutas.html">
Rutas</a><br>
<br>
<a href="clases.html"><span style="font -weight:
bold;">Clases</span></a><br>
<br>
<a href="reglaslistas.html"><span style="font-weight: bold;">Reglas y
listas</span></a><br>
<br>
<span style="font-weight: bold;">Diagnstico</span><br><a
href="ping.html">
Ping</a><br><a href="traceroute.html">
Traceroute</a><br>
<br>
<a href="aplicarcambios.html"><span style="font-weight:
bold;">Aplicar cambios</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<span style="font-weight: bold;">Reiniciar</span><br style="fontweight: bold;">
<br style="font-weight: bold;">
<a href="reiniciofabrica.html"><span style="font-weight:
bold;">Reinicio de fabrica</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="contrasena.html"><span style="font-weight: bold;">Cambiar
contrasea</span></a><br>
<br>
</td>
<td style="vertical-align: top; color: rgb(3, 5, 3);">&nbsp;<br>
<br>
<br>
<div style="text-align: center;"><big><big>&nbsp;&nbsp;&nbsp;
Esta seguro de reiniciar la maquina
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
</big></big></div>
&nbsp;&nbsp;&nbsp; <br>
<table style="text-align: left; height: 56px; width: 338px; marginleft: 135px;" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top; width: 97px;">
<div style="text-align: center;">

182

<form method="get" action="aplicar_.php" name="aplicar"><input


name="button" value="SI" type="button"><br>
</form>
</div>
<br>
</td>
<td style="vertical-align: top; width: 117px; text-align:
left;"><a href="lan.html"><img style="border: 0px solid ; width: 40px; height:
22px;" src="images/No.gif" alt="No.gif"></a> </td>
</tr>
</tbody>
</table>
&nbsp;</td>
</tr>
<tr>
<td style="vertical-align: top;"><br>
</td>
<td style="vertical-align: top;"><br>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<br>
<br>
</body></html>

ANEXO C.25 RESTAURARVALORES.HTML


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="contenttype"><title>Restaurar valores por defecto</title></head><body>
<table style="text-align: left; width: 900px; margin-left: auto; margin-right:
auto;" border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 900px; height: 82px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="2"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; height: 82px; width: 202px;"><img
src="images/sanbuena.gif" alt="sanbuena.gif"></td>
<td style="vertical-align: middle; text-align: center;">
<p class="MsoNormal" style="text-align: center;" align="center"><b
style=""><span style="line-height: 115%;"><big><span style="font-family:
monospace;">SISTEMA DE CONTROL DE TRFICO EN REDES
DE DATOS CON IMPLEMENTACIN DE
NPU</span></big> <o:p></o:p></span></b></p>
</td>
<td style="vertical-align: bottom; height: 82px; width: 202px; textalign: right;">

183

<dl>
<dt style="font-family: monospace;"><small><small><span
style="line-height: 150%;" lang="PT-BR">HARVEY DEMIAN BASTIDAS
CAICEDO<o:p></o:p></span></small></small><big><span style="line-height: 150%;"
lang="PT-BR"><small><small><small> <br>
</small></small></small></span></big></dt>
<dt><span style="line-height: 150%;" lang="PT-BR"><small
style="font-family: monospace;"><small>DIEGO ANDRS BELTRN
ORDUZ</small></small><span style=""> </span><o:p></o:p></span></dt>
</dl>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 900px; background-color: rgb(255,
102, 0); height: 20px;"><br>
</td>
</tr>
<tr align="center">
<td style="vertical-align: top; width: 900px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="10"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 202px; height: 900px;
background-color: rgb(255, 102, 0);"><br>
<br>
<br>
<span style="font-weight: bold;">Configuracion</span><br><a
href="lan.html">
Lan</a><br><a href="wan.html">
Wan</a><br><a href="rutas.html">
Rutas</a><br>
<br>
<a href="clases.html"><span style="font -weight:
bold;">Clases</span></a><br>
<br>
<a href="reglaslistas.html"><span style="font-weight: bold;">Reglas y
listas</span></a><br>
<br>
<span style="font-weight: bold;">Diagnstico</span><br><a
href="ping.html">
Ping</a><br><a href="traceroute.html">
Traceroute</a><br>
<br>
<a href="aplicarcambios.html"><span style="font-weight:
bold;">Aplicar cambios</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="reiniciar.html"><span style="font-weight:
bold;">Reiniciar</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<span style="font-weight: bold;">Reinicio de fabrica</span><br
style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="contrasena.html"><span style="font-weight: bold;">Cambiar
contrasea</span></a><br>
<br>

184

</td>
<td style="vertical-align: top; color: rgb(3, 5, 3);"><br>
<br>
<br>
<div style="text-align: center;"><big><big>&nbsp;&nbsp;&nbsp; Desea
restaurar los valores&nbsp; de fabrica
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>
</big></big></div>
&nbsp;&nbsp;&nbsp; <br>
<table style="text-align: left; height: 56px; width: 338px; marginleft: 135px;" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top; width: 97px;">
<div style="text-align: center;">
<form method="get" action="aplicar_.php" name="aplicar"><input
name="button" value="SI" type="button"><br>
</form>
</div>
<br>
</td>
<td style="vertical-align: top; width: 117px; text-align:
left;"><a href="lan.html"><img style="border: 0px solid ; width: 40px; height:
22px;" src="images/No.gif" alt="No.gif"></a>
</td>
</tr>
</tbody>
</table>&nbsp;
<br>
&nbsp; <br>
<div style="text-align: center; color: red;"><big><big><big>Se
perderan todas las configuraciones <br>
</big></big></big></div>
</td>
</tr>
<tr>
<td style="vertical-align: top;"><br>
</td>
<td style="vertical-align: top;"><br>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<br>
<br>
</body></html>

ANEXO C.26 RUTAS.PHP


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head>

185

<meta content="text/html; charset=ISO-8859-1" http-equiv="contenttype"><title>Rutas</title></head><body>


<table style="text-align: left; width: 900px; margin-left: auto; margin-right:
auto;" border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 900px; height: 82px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="2"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; height: 82px; width: 202px;"><img
src="images/sanbuena.gif" alt="sanbuena.gif"></td>
<td style="vertical-align: middle; text-align: center;">
<p class="MsoNormal" style="text-align: center;" align="center"><b
style=""><span style="line-height: 115%;"><big><span style="font-family:
monospace;">SISTEMA DE CONTROL DE TRFICO EN REDES
DE DATOS CON IMPLEMENTACIN DE
NPU</span></big> <o:p></o:p></span></b></p>
</td>
<td style="vertical-align: bottom; height: 82px; width: 202px; textalign: right;">
<dl>
<dt style="font-family: monospace;"><small><small><span
style="line-height: 150%;" lang="PT-BR">HARVEY DEMIAN BASTIDAS
CAICEDO<o:p></o:p></span></small></small><big><span style="line-height: 150%;"
lang="PT-BR"><small><small><small> <br>
</small></small></small></span></big></dt>
<dt><span style="line-height: 150%;" lang="PT-BR"><small
style="font-family: monospace;"><small>DIEGO ANDRS BELTRN
ORDUZ</small></small><span style=""> </span><o:p></o:p></span></dt>
</dl>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 900px; background-color: rgb(255,
102, 0); height: 20px;"><br>
</td>
</tr>
<tr align="center">
<td style="vertical-align: top; width: 900px;">
<table style="text-align: left; width: 900px;" border="0" cellpadding="10"
cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 202px; height: 900px;
background-color: rgb(255, 102, 0);"><br>
<br>
<br>
<span style="font-weight: bold;">Configuracion</span><br>
<a href="lan.php">Lan</a><br>
<a href="wan.php">Wan</a><br>
Rutas<br>
<br>
<a href="clases.php"><span style="font-weight:
bold;">Clases</span></a><br>

186

<br>
<a href="reglaslistas.php"><span style="font -weight: bold;">Reglas y
listas</span></a><br>
<br>
<span style="font-weight: bold;">Diagnstico</span><br><a
href="ping.html">
Ping</a><br><a href="traceroute.html">
Traceroute</a><br>
<br>
<a href="aplicarcambios.html"><span style="font-weight:
bold;">Aplicar cambios</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="reiniciar.html"><span style="font-weight:
bold;">Reiniciar</span></a><br style="font-weight: bold;">
<br style="font-weight: bold;">
<a href="reiniciofabrica.html"><span style="font-weight:
bold;">Reinicio de fabrica</span></a><br style="font-weight: bold;">
<a href="contrasena.html"><br style="font-weight: bold;">
<span style="font-weight: bold;">Cambiar contrasea</span><br>
</a>
<br>
</td>
<td style="vertical-align: top; color: rgb(3, 5, 3);">
<br>
<table style="text-align: left; width: 693px;" border="1"
cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top; text-align: center; width:
170px;"><small>IP Destino
</small></td>
<td style="vertical-align: top; text-align: center; width:
170px;"><small>Mscara de destino </small>
</td>
<td style="vertical-align: top; text-align: center; width:
170px;">Proximo salto
</td>
<td style="vertical-align: top;">opciones
</td>
</tr>
</tbody>
</table>
<form method="get" action="nuevaruta.php" name="clases">
<table style="text-align: left; width: 692px;" border="1"
cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top; width: 175px; text -align:
center;">
<input maxlength="3" size="1" name="cf_rt_ip4_1"
value="0">
<input maxlength="3" size="1" name="cf_rt_ip4_2"
value="0">
<input maxlength="3" size="1" name="cf_rt_ip4_3"
value="0">
<input maxlength="3" size="1" name="cf_rt_ip4_4"
value="0">
</td>
<td style="vertical-align: top; text-align: center; width:
170px;">

187

<input maxlength="3" size="1" name="cf_rt_mask_1"


value="0">
<input maxlength="3" size="1" name="cf_rt_mask_2"
value="0">
<input maxlength="3" size="1" name="cf_rt_mask_3"
value="0">
<input maxlength="3" size="1" name="cf_rt_mask_4"
value="0">
</td>
<td style="vertical-align: top; text-align: center; width:
170px;">
<input maxlength="3" size="1" name="cf_rt_nhop_1"
value="0">
<input maxlength="3" size="1" name="cf_rt_nhop_2"
value="0">
<input maxlength="3" size="1" name="cf_rt_nhop_3"
value="0">
<input maxlength="3" size="1" name="cf_rt_nhop_4"
value="0">
</td>
<td style="vertical-align: top; text-align: center; width:
144px;">
<input name="submit" value="Agregar" type="submit">
</td>
</tr>
</tbody>
</table>
</form>
<table style="text-align: left; width: 692px;" border="1"
cellpadding="2" cellspacing="2">
<tbody>
<?php
try
{
//crea o abre la base de datos (debe? contener el path relativo al
root del servidor www)
$database = new SQLiteDatabase('config.sqlite2', 0666, $error);
}
catch(Exception $e)
{
die($error);
}
// prepara la solicitud (query) de datos en la tabla t_cl_clases
$query = "SELECT * FROM t_cf_rutas";
if($result = $database->query($query, SQLITE_BOTH, $error))
{
if (($result->numRows())>0)
{
while($row = $result->fetch())
{
printf("<tr>
<td style=\"vertical-align: middle; width: 170px;\">
%s
</td>
<td style=\"vertical-align: middle; width: 170px;\">
%s
</td>
<td style=\"vertical-align: middle; width: 170px;\">
%s
</td>

188

<td style=\"vertical-align: middle; width: 144px;\">


<a
href=\"modificarruta.php?cf_tr_id=%s \">Modificar</a>|<a
href=\"eliminarruta.php?cf_tr_id=%s\">Eliminar</a>
</td>
</tr>
", $row['cf_rt_ip4'], $row['cf_rt_mask'],$row['cf_rt_nhop'],
$row['cf_tr_id'],$row['cf_tr_id']);
}
}
else{
printf("No se han agregado rutas
estticas.");
}
}
?>
</tbody>
</table>
<br>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<br>
<br>
</body></html>

189

ANEXO D GENERADORES DE COMANDOS

ANEXO D.1 GENCLASES.C


#include <stdlib.h>
#include <stdio.h>
#include <sqlite.h>
// Funci que imprime el comando para cada resultado de la consulta realizada
static int callback(void *NotUsed, int argc, char **argv, char **azColName){
//orden de los campos: 0cl_id , 1cl_subida, 2cl_padre, 3cl_use_ret,
4cl_use_velmax, 5cl_ret, 6cl_vel, 7cl_velmax
// int i;
static char tmp[300]="\0";
/*
// si hay errorres en la regla, no imprime nada
for(i=0;i<3;i++)
if (argv[i]==NULL) return(0);
*/
//sprintf(tmp, "/usr/sbin/tc qdisc add dev %s classid %i:%i hfsc sc",
atoi(argv[1])==0 ? "eth0 parent " : "eth2 parent ", atoi(argv[1])==0 ? 1 : 2,
atoi(argv[0])+2 );
// genera la cadena de salida tmp
sprintf(tmp, "/usr/sbin/tc class add dev %s%i classid %i:%i hfsc sc",
atoi(argv[1])==0 ? "eth0 parent 1:" : "eth2 parent 2:", atoi(argv[2])==0 ?
atoi(argv[1])==0 ? 1 : 2 : atoi(argv[2])+2 , atoi(argv[1])==0 ? 1 : 2,
atoi(argv[0])+2 );
//TODO: verificar si hay errores en los dem params dependiendo si se usan
// si tiene retardo imprime dmax
if (argv[3]>0)
{
if (argv[5]!=NULL)
sprintf(tmp, "%s dmax %ims", tmp, atoi(argv[5]));
}
//imprime el rate
if (argv[6]!=NULL)
sprintf(tmp, "%s rate %ikbit", tmp, atoi(argv[6]));
//imprime el upper limit si se usa, sino, coloca como ul el mismo rate
if (argv[4]>0)
{
if (argv[7]!=NULL)
sprintf(tmp, "%s ul rate %ikbit", tmp, atoi(argv[7]));
else
sprintf(tmp, "%s ul rate %ikbit", tmp, atoi(argv[6]));
}
else{
sprintf(tmp, "%s ul rate %ikbit", tmp, atoi(argv[6]));
}
printf("%s\n",tmp);
return(0);
}

190

int main(int argc, char **argv){


sqlite *db;
char *zErrMsg = 0;
int rc; // handler
// Verifica el nmero de argumentos
if( argc!=2 ){
fprintf(stderr, "Uso: %s <sqliteDB de control>\n", argv[0]);
return(1);
}
// Se conecta (abre) la base de datos
db = sqlite_open(argv[1],666,&zErrMsg);
if( db==NULL ){
fprintf(stderr, "No se puede abrir el archivo. \n");
sqlite_close(db);
return(1);
}
// Ejecuta query para leer todas las columnas de la tabla t_cl_clases
rc = sqlite_exec(db, "select * from t_cl_clases\0", callback, 0, &zErrMsg);
if( rc!=SQLITE_OK ){
fprintf(stderr, "Error de SQL: %s\n", zErrMsg);
}
// Se desconecta de la base de datos.
sqlite_close(db);
return(0);
}

ANEXO D.2 GENCRITERIOS.C


#include <stdlib.h>
#include <stdio.h>
#include <sqlite.h>
// Funci que imprime el comando para cada resultado de la consulta realizada
static int callback(void *NotUsed, int argc, char **argv, char **azColName) {
/* cr_id=0 cl_cr_use_mac_src=1, cl_cr_use_mac_dst=2, cl_cr_use_ip_src=3,
cl_cr_use_ip_dst=4
, cl_cr_use_puerto_src=5, cl_cr_use_puerto_dst=6, cl_cr_use_icmp=7,
cl_cr_use_udp=8, cl_cr_use_tcp=9
, cl_cr_use_timestart=10, cl_cr_use_timestop=11, cl_cr_use_day_mon=12,
cl_cr_use_day_tue=13, cl_cr_use_day_wed=14
, cl_cr_use_day_thu=15, cl_cr_use_day_fri=16, cl_cr_use_day_sat=17,
cl_cr_use_day_sun=18, cl_cr_mac_src=19txt
, cl_cr_mac_dst=20, cl_cr_ip_src=21, cl_cr_ip_dst=22, cl_cr_puerto_src=23i,
cl_cr_puerto_dst=24
, cl_cr_timestart=25t, cl_cr_timestop=26, cl_cr_day=27, cl_cr_clase=28,
cl_cr_use_mask_src=29,
cl_cr_mask_src=30, cl_cr_use_mask_dst=31, cl_cr_mask_dst=32
Regla: iptables -t mangle -A POSTROUTING -j CLASSIFY --set-class 1:20
*/
// int i;
static char tmp[200]="\0";
/*
// si hay errorres en la regla, no imprime nada (comprueba hasta
cr_use_tcp)
for(i=0; i<=9; i++)
if (argv[i]==NULL) return(0);
*/
// genera la cadena de salida tmp

191

sprintf(tmp, "/usr/sbin/iptables -t mangle -A POSTROUTING" );


//TODO: falta comprobar por MAC, comosolo se puede de macsrc, quitar la
opcin de mac de destino.
// verificamos si el proocolo es IP, icmp, tcp o u udp,
// si hay IP fuente la adiciona
if (atoi(argv[3])>0) {
if (argv[21]!=NULL)
sprintf(tmp, "%s -s %s", tmp, argv[21]);
//si hay mask la adiciona
if (atoi(argv[29])>0) {
if (argv[30]!=NULL)
sprintf(tmp, "%s/%s", tmp, argv[30]);
}
}
// si hay IP de destino la adiciona
if (atoi(argv[4])>0) {
if (argv[22]!=NULL)
sprintf(tmp, "%s -d %s", tmp, argv[22]);
//si hay mask la adiciona
if (atoi(argv[31])>0) {
if (argv[32]!=NULL)
sprintf(tmp, "%s/%s", tmp, argv[32]);
}
}
// si se usa protocolo icmp de destino la adiciona y termina la cadena ya que
no puede recbir ms params
if (atoi(argv[7])>0) {
sprintf(tmp, "%s -p icmp", tmp);
}
else //si no es icmp mira si es tcp o udp y coloca el respectivo nmero de
puerto fuente o destino si aplica
{
// si el protocolo es tcp
if (atoi(argv[9])>0) {
sprintf(tmp, "%s -p tcp", tmp);
//si tiene puerto fuente lo coloca
if (atoi(argv[5])>0) {
if (argv[23]!=NULL)
sprintf(tmp, "%s --sport %i", tmp,atoi(argv[23]));
}
//si tiene puerto de destino lo coloca
if (atoi(argv[6])>0) {
if (argv[24]!=NULL)
sprintf(tmp, "%s --dport %i", tmp,atoi(argv[24]));
}
}
//si el protocolo es udp

192

if (atoi(argv[8])>0) {
sprintf(tmp, "%s -p udp", tmp);
//si tiene puerto fuente lo coloca
if (atoi(argv[5])>0) {
if (argv[23]!=NULL)
sprintf(tmp, "%s --sport %i", tmp,atoi(argv[23]));
}
//si tiene puerto de destino lo coloca
if (atoi(argv[6])>0) {
if (argv[24]!=NULL)
sprintf(tmp, "%s --dport %i", tmp,atoi(argv[24]));
}
}
}
//imprime la clase de destino
if (argv[28]==NULL) return(0);
sprintf(tmp, "%s -j CLASSIFY --set-class %s",tmp , argv[28] );
// imprime el comando completo
printf("%s\n",tmp);
return(0);
}
int main(int argc, char **argv) {
sqlite *db;
char *zErrMsg = 0;
int rc; // handler
// Verifica el nero de argumentos
if( argc!=2 ) {
fprintf(stderr, "Uso: %s <sqliteDB de control>\n", argv[0]);
return(1);
}
// Se conecta (abre) la base de datos
db = sqlite_open(argv[1], 666,&zErrMsg);
if( db==NULL ) {
fprintf(stderr, "No se puede abrir el archivo. \n");
sqlite_close(db);
return(1);
}
// Ejecuta query para leer todas las columnas de la tabla t_cl_criterios
rc = sqlite_exec(db, "select * from t_cl_criterios\0", callback, 0,
&zErrMsg);
if( rc!=SQLITE_OK ) {
fprintf(stderr, "Error de SQL: \n");
}
// Se desconecta de la base de datos.
sqlite_close(db);
return(0);
}

ANEXO D.3 GENQDISCS.C


#include <stdlib.h>
#include <stdio.h>
#include <sqlite.h>

193

// Funci que imprime el comando para cada resultado de la consulta realizada


static int callback(void *NotUsed, int argc, char **argv, char **azColName){
//orden de los campos: 0cl_id , 1cl_subida, 2cl_padre, 3cl_use_ret,
4cl_use_velmax, 5cl_ret, 6cl_vel, 7cl_velmax
// int i;
static char tmp[300]="\0";
/*
// si hay errorres en la regla, no imprime nada
for(i=0;i<3;i++)
if (argv[i]==NULL) return(0);
*/
//sprintf(tmp, "/usr/sbin/tc qdisc add dev %s classid %i:%i hfsc sc",
atoi(argv[1])==0 ? "eth0 parent " : "eth2 parent ", atoi(argv[1])==0 ? 1 : 2,
atoi(argv[0])+2 );
// genera la cadena de salida tmp
sprintf(tmp, "/usr/sbin/tc qdisc add dev %s%i sfq perturb 20",
atoi(argv[1])==0 ? "eth0 parent 1:" : "eth2 parent 2:", atoi(argv[0])+2 );
//TODO: verificar si hay errores en los dem params dependiendo si se usan
printf("%s\n",tmp);
return(0);
}
int main(int argc, char **argv){
sqlite *db;
char *zErrMsg = 0;
int rc; // handler
// Verifica el nmero de argumentos
if( argc!=2 ){
fprintf(stderr, "Uso: %s <sqliteDB de control>\n", argv[0]);
return(1);
}
// Se conecta (abre) la base de datos
db = sqlite_open(argv[1],666,&zErrMsg);
if( db==NULL ){
fprintf(stderr, "No se puede abrir el archivo. \n");
sqlite_close(db);
return(1);
}
// Ejecuta query para leer todas las columnas de la tabla t_cl_clases
rc = sqlite_exec(db, "select * from t_cl_clases\0", callback, 0, &zErrMsg);
if( rc!=SQLITE_OK ){
fprintf(stderr, "Error de SQL: %s\n", zErrMsg);
}
// Se desconecta de la base de datos.
sqlite_close(db);
return(0);
}

ANEXO C.4 GENCONFIG.C


#include <stdlib.h>
#include <stdio.h>
#include <sqlite.h>

194

#include <string.h>
/**
TODO: Sera bueno adicionar estos dos controles a wan.php
<tr>
<td style="vertical-align: top; text-align: right;">servidor
NTP </td>
<td style="vertical-align: top;"><input
name="cf_use_ntpserver" value="1" type="checkbox" <?php if
($cf_use_ntpserver=="1") printf("\"checked\""); ?> >
<input maxlength="80" size="30" name="cf_ntpserver" value=
<?php printf("\"%s\"", $cf_ntpserver ); ?> ></td
</tr>
<tr>
<td style="vertical-align: top; text-align: right;">Servidor
syslog </td>
<td style="vertical-align: top;"><input
name="cf_use_syslogserver" value="1" type="checkbox" <?php if
($cf_use_syslogserver=="1") printf(" \"checked\""); ?> >
<input maxlength="80" size="30" name="cf_syslogserver" value=
<?php printf("\"%s\"", $cf_syslogserver ); ?> ></td>
</tr>
*/
// Funci que imprime el comando para cada resultado de la consulta realizada
static int callback(void *NotUsed, int argc, char **argv, char **azColName){
//char* networkaddr[300]; //parqa calcular la direccin network con ip y
mask
//orden de los campos: 0cf_id, 1cf_lan_ip4, 2cf_lan_nat ,3cf_lan_mask,
4cf_lan_dhcp_server, 5cf_wan_ip4, 6cf_wan_mask, 7cf_wan_gw, 8cf_wan_dns1,
9cf_wan_dns2, 10cf_wan_dhcp, 11cf_use_ntpserver, 12cf_ntpserver,
13cf_use_syslogserver, 14cf_syslogserver, 15cf_descripcionperfil,
16cf_wan_network, 17cf_lan_network
/*
// si hay errorres en la regla, no imprime nada
for(i=0;i<3;i++)
if (argv[i]==NULL) return(0);
*/
// desactiva las interfaces
printf("#!/bin/bash\nifconfig eth0 down\nifconfig eth2 down\nifconfig eth0
hw ether 00:22:19:27:8b:9d\nifconfig eth2 hw ether 00:22:19:27:8b:9f\n");
// configura ip y mask de las ifs
printf("ifconfig eth0 %s\nifconfig eth0 netmask %s\n",argv[1],argv[3]);
printf("ifconfig eth2 %s\nifconfig eth2 netmask %s\n",argv[5],argv[6]);
// crea de nuevo el archivo resolv.conf que se usar para los DNS, se hace
aqu debido a que el cliente dhcp puede sobreescribirlo o no.
printf("echo \"#Archivo generado por Sistema de Control de trfico\" >
/etc/resolv.conf\n");
// activa el cliente dhcp en eth2 (wan) si est seleccionado
if (argv[10]!=NULL)
if (atoi(argv[10])==1)
printf("echo -e \"Configurando cliente DHCP en interfaz
WAN\\n\"\ndhclient -v eth2\n");
//TODO: verificar si hay errores en los dem params dependiendo si se usan
// activa las interfaces
printf("ifconfig eth0 up\nifconfig eth2 up\n");
// activa nat
if (argv[2]!=NULL)
if (atoi(argv[2])==1)

195

printf("echo \"Habilitando NAT.<br>\"\n/usr/sbin/iptables -t


nat -A POSTROUTING -o eth2 -j MASQUERADE\n/usr/sbin/iptables -A FORWARD -i eth0 j ACCEPT\n");
// elimina rutas existentes y coloca rutas por defecto
printf("echo \"Eliminando rutas existentes y creando ruta por
defecto.<br>\"\n");
printf("ip route flush dev eth0 \n");
printf("ip route flush dev eth2 \n");
printf("route add -net 127.0.0.0 netmask 255.0.0.0 dev lo\n");
printf("route add -net %s netmask %s dev eth0\n",argv[17],argv[3]);
printf("route add -net %s netmask %s dev
eth2\n","192.168.0.0","255.255.255.0");
// agrega la ruta por defecto
printf("ip route add default via %s\n",argv[7]);
// adiciona DNS aresolv.conf
printf("echo \"Adicionando DNS a resolv.conf <br> \"\n");
printf("echo \"nameserver %s\" >> /etc/resolv.conf\n",argv[8]);
printf("echo -e \"nameserver %s\\n\\n\" >> /etc/resolv.conf\n",argv[9]); //el e es para que el echo procese los \n
return(0);
}
int main(int argc, char **argv){
sqlite *db;
char *zErrMsg = 0;
int rc; // handler
// Verifica el nmero de argumentos
if( argc!=2 ){
fprintf(stderr, "Uso: %s <sqliteDB de control>\n", argv[0]);
return(1);
}
// Se conecta (abre) la base de datos
db = sqlite_open(argv[1],666,&zErrMsg);
if( db==NULL ){
fprintf(stderr, "No se puede abrir el archivo. \n");
sqlite_close(db);
return(1);
}
// Ejecuta query para leer todas las columnas de la tabla t_cl_clases
rc = sqlite_exec(db, "select * from t_cf_config\0", callback, 0, &zErrMsg);
if( rc!=SQLITE_OK ){
fprintf(stderr, "Error de SQL: %s\n", zErrMsg);
}
// Se desconecta de la base de datos.
sqlite_close(db);
return(0);
}

ANEXO C.5 GENRUTAS.C


#include <stdlib.h>
#include <stdio.h>
#include <sqlite.h>

196

// Funci que imprime el comando para cada resultado de la consulta realizada


static int callback(void *NotUsed, int argc, char **argv, char **azColName){
//orden de los campos: 0cf_tr_id , 1cf_rt_ip4 , 2cf_rt_mask, 3cf_rt_nhop
// int i;
static char tmp[300]="\0";
/*
// si hay errorres en la regla, no imprime nada
for(i=0;i<3;i++)
if (argv[i]==NULL) return(0);
*/
// genera la cadena de salida tmp
sprintf(tmp, "route add -net %s netmask %s gw %s", argv[1], argv[2],
argv[3]);
//TODO: verificar si hay errores en los dem params dependiendo si se usan
printf("%s\n",tmp);
return(0);
}
int main(int argc, char **argv){
sqlite *db;
char *zErrMsg = 0;
int rc; // handler
// Verifica el nmero de argumentos
if( argc!=2 ){
fprintf(stderr, "Uso: %s <sqliteDB de control>\n", argv[0]);
return(1);
}
// Se conecta (abre) la base de datos
db = sqlite_open(argv[1],666,&zErrMsg);
if( db==NULL ){
fprintf(stderr, "No se puede abrir el archivo. \n");
sqlite_close(db);
return(1);
}
// Ejecuta query para leer todas las columnas de la tabla t_cl_clases
rc = sqlite_exec(db, "select * from t_cf_rutas\0", callback, 0, &zErrMsg);
if( rc!=SQLITE_OK ){
fprintf(stderr, "Error de SQL: %s\n", zErrMsg);
}
// Se desconecta de la base de datos.
sqlite_close(db);
return(0);
}

197

ANEXO E SCRIPTS DE SQL

ANEXO E.1 CONFIG.SQL


create table t_cf_config( cf_id INTEGER PRIMARY KEY ASC, cf_lan_ip4 TEXT,
cf_lan_nat ,cf_lan_mask, cf_lan_dhcp_server, cf_wan_ip4, cf_wan_mask, cf_wan_gw,
cf_wan_dns1, cf_wan_dns2, cf_wan_dhcp, cf_use_ntpserver, cf_ntpserver,
cf_use_syslogserver, cf_syslogserver, cf_descripcionperfil, cf_wan_network,
cf_lan_network );
create table t_cf_rutas( cf_tr_id INTEGER PRIMARY KEY ASC, cf_rt_ip4 TEXT,
cf_rt_mask, cf_rt_nhop );
.quit

ANEXO D.2 CONTROL.SQL


create table t_cl_clases( cl_id INTEGER PRIMARY KEY ASC, cl_s ubida, cl_padre,
cl_use_ret, cl_use_velmax, cl_ret, cl_vel, cl_velmax,cl_descrip );
create table t_cl_criterios( cr_id INTEGER PRIMARY KEY ASC, cl_cr_use_mac_src,
cl_cr_use_mac_dst, cl_cr_use_ip_src, cl_cr_use_ip_dst, cl_cr_use_puerto_src,
cl_cr_use_puerto_dst, cl_cr_use_icmp, cl_cr_use_udp, cl_cr_use_tcp,
cl_cr_use_timestart, cl_cr_use_timestop, cl_cr_use_day_mon, cl_cr_use_day_tue,
cl_cr_use_day_wed, cl_cr_use_day_thu, cl_cr_use_day_fri, cl_cr_use_day_sat,
cl_cr_use_day_sun,
cl_cr_mac_src TEXT, cl_cr_mac_dst, cl_cr_ip_src, cl_cr_ip_dst, cl_cr_puerto_src
INTEGER, cl_cr_puerto_dst, cl_cr_timestart TEXT, cl_cr_timestop, cl_cr_day,
cl_cr_clase, cl_cr_use_mask_src, cl_cr_mask_src, cl_cr_use_mask_dst,
cl_cr_mask_dst);
.quit

ANEXO D.3 PRUEBA.SQL


insert into t_cl_criterios (cl_cr_use_mac_src, cl_cr_mac_src, cl_cr_use_icmp,
cl_cr_use_ip_src, cl_cr_ip_src,cl_cr_use_ip_dst, cl_cr_ip_dst, cl_cr_use_tcp,
cl_cr_use_udp, cl_cr_use_puerto_src, cl_cr_puerto_src, cl_cr_use_puerto_dst,
cl_cr_puerto_dst,cl_cr_clase,cl_cr_use_mask_src, cl_cr_mask_src,
cl_cr_use_mask_dst, cl_cr_mask_dst ) values
(0,NULL,0,0,NULL,1,"192.168.1.252",1,0,0,NULL,1,"84","2:4",0,NULL,0,NULL);
insert into t_cl_criterios (cl_cr_use_mac_src, cl_cr_mac_src, cl_cr_use_icmp,
cl_cr_use_ip_src, cl_cr_ip_src,cl_cr_use_ip_dst, cl_cr_ip_dst, cl_cr_use_tcp,
cl_cr_use_udp, cl_cr_use_puerto_src, cl_cr_puerto_src, cl_cr_use_puerto_dst,
cl_cr_puerto_dst,cl_cr_clase,cl_cr_use_mask_src, cl_cr_mask_src,
cl_cr_use_mask_dst, cl_cr_mask_dst ) values
(0,NULL,0,0,NULL,1,"192.168.21.253",1,0,0,NULL,1,"80","1:7",0,NULL,0,NULL);
insert into t_cl_criterios (cl_cr_use_mac_src, cl_cr_mac_src, cl_cr_use_icmp,
cl_cr_use_ip_src, cl_cr_ip_src,cl_cr_use_ip_dst, cl_cr_ip_dst, cl_cr_use_tcp,

198

cl_cr_use_udp, cl_cr_use_puerto_src, cl_cr_puerto_src, cl_cr_use_puerto_dst,


cl_cr_puerto_dst,cl_cr_clase,cl_cr_use_mask_src, cl_cr_mask_src,
cl_cr_use_mask_dst, cl_cr_mask_dst ) values
(0,NULL,0,0,NULL,1,"192.168.1.252",1,0,0,NULL,1,"84","2:4",0,NULL,0,NULL);
insert into t_cl_criterios (cl_cr_use_mac_src, cl_cr_mac_src, cl_cr_use_icmp,
cl_cr_use_ip_src, cl_cr_ip_src,cl_cr_use_ip_dst, cl_cr_ip_dst, cl_cr_use_tcp,
cl_cr_use_udp, cl_cr_use_puerto_src, cl_cr_puerto_src, cl_cr_use_puerto_dst,
cl_cr_puerto_dst,cl_cr_clase,cl_cr_use_mask_src, cl_cr_mask_src,
cl_cr_use_mask_dst, cl_cr_mask_dst ) values
(0,NULL,0,0,NULL,1,"192.168.21.253",1,0,0,NULL,1,"80","1:7",0,NULL,0,NULL);
.
.
.
1007 instrucciones similares
.
.
insert into t_cl_criterios (cl_cr_use_mac_src, cl_cr_mac_src, cl_cr_use_icmp,
cl_cr_use_ip_src, cl_cr_ip_src,cl_cr_use_ip_dst, cl_cr_ip_dst, cl_cr_use_tcp,
cl_cr_use_udp, cl_cr_use_puerto_src, cl_cr_puerto_src, cl_cr_use_puerto_dst,
cl_cr_puerto_dst,cl_cr_clase,cl_cr_use_mask_src, cl_cr_mask_src,
cl_cr_use_mask_dst, cl_cr_mask_dst ) values
(0,NULL,0,0,NULL,1,"192.168.1.252",1,0,0,NULL,1,"84","2:4",0,NULL,0,NULL);
insert into t_cl_criterios (cl_cr_use_mac_src, cl_cr_mac_src, cl_cr_use_icmp,
cl_cr_use_ip_src, cl_cr_ip_src,cl_cr_use_ip_dst, cl_cr_ip_dst, cl_cr_use_tcp,
cl_cr_use_udp, cl_cr_use_puerto_src, cl_cr_puerto_src, cl_cr_use_puerto_dst,
cl_cr_puerto_dst,cl_cr_clase,cl_cr_use_mask_src, cl_cr_mask_src,
cl_cr_use_mask_dst, cl_cr_mask_dst ) values
(0,NULL,0,0,NULL,1,"192.168.21.253",1,0,0,NULL,1,"80","1:7",0,NULL,0,NULL);
insert into t_cl_criterios (cl_cr_use_mac_src, cl_cr_mac_src, cl_cr_use_icmp,
cl_cr_use_ip_src, cl_cr_ip_src,cl_cr_use_ip_dst, cl_cr_ip_dst,

199

Vous aimerez peut-être aussi