Ejemplo: configuración de instancia de muestreo
Puede configurar el muestreo activo mediante una instancia de muestreo y asociarla a un concentrador de puerto flexible (FPC), un concentrador de puerto modular (MPC) o un concentrador de puerto denso (DPC) determinados. Además, puede definir varias instancias de muestreo asociadas a varios destinos y familias de protocolos por destino de instancia de muestreo.
Ejemplos de detalles de red
En el siguiente ejemplo se muestra la configuración de dos instancias de muestreo en un enrutador MX480 que ejecuta Junos OS versión 9.6.
En la figura 1, los paquetes del enrutador 1 llegan a la interfaz Gigabit Ethernet ge-0/1/0 del enrutador de supervisión, la interfaz de servicios muestrea los paquetes y la interfaz sp-2/0/0 ge-1/0/4de exportación envía al servidor cflowd . Los paquetes del enrutador 3 llegan a la interfaz Gigabit Ethernet ge-3/1/0 del enrutador de monitoreo, los paquetes son muestreados por la interfaz sp-2/1/0 de servicios y enviados al servidor cflowd por la interfaz ge-1/0/4de exportación. El flujo de tráfico normal desde ge-0/1/0 y ge-3/1/0 hacia ge-1/0/0 y hacia el enrutador 2 continúa sin interrupciones durante el proceso de muestreo. En la supervisión activa de flujo, tanto la interfaz de entrada como la interfaz de salida pueden ser de cualquier tipo de interfaz (como SONET/SDH, Gigabit Ethernet, etc.).
Solo se puede adjuntar una instancia de muestreo a un FPC, MPC o DPC. Se pueden configurar varias familias en una instancia de muestreo. Cada familia puede tener su propia dirección de coleccionista. Puede definir instancias de muestreo y adjuntar cada instancia a diferentes FPC, o bien se puede adjuntar una sola instancia de muestreo a todas las FPC.
La configuración de muestreo para este ejemplo incluye lo siguiente:
-
Dos instancias de
s0muestreo ys1, configuradas para recopilar datos de muestreo en el nivel jerárquico[edit forwarding-options]. Laflow-serverinstrucción incluye la dirección IP, el puerto y la plantilla del servidor de flujo. Lainterfaceinstrucción incluye la interfaz de servicios,sp-2/0/0osp-2/1/0, para el procesamiento de registros de flujo y la dirección de origen del enrutador entrante en la interfaz de muestra. -
La vinculación de las dos instancias de muestreo a los CPE 0 y 3. Estos se configuran con la
sampling-instanceinstrucción en el nivel de[edit chassis fpc slot]jerarquía. -
Muestreo activado en las interfaces
ge-0/1/0de entrada yge-3/1/0utilizando lasamplinginstrucción en el nivel jerárquico[edit interfaces interface-name unit unit-number family family].
En este ejemplo, el comando se emite en el ping enrutador 1 al enrutador 2 a través del enrutador MX480 para generar tráfico. Una vez generados los paquetes, show se emiten comandos para comprobar que la configuración de muestreo funciona como se esperaba.
Ejemplo de configuración de enrutador
La siguiente salida muestra la configuración de un enrutador MX480 con dos instancias de muestreo.
user@MX480–router> show configuration
[...Output Truncated...]
}
chassis {
fpc 0 { # The fpc number is associated with the interface on which sampling is enabled, ge-0/1/0 in this statement.
sampling-instance s0;
}
fpc 3 { # The fpc number is associated with the interface on which sampling is enabled, ge-3/1/0 in this statement.
sampling-instance s1;
}
}
interfaces {
ge-0/1/0 { # This interface has sampling activated.
unit 0 {
family inet {
sampling { # Here sampling is activated.
input;
}
address 10.0.0.1/30;
}
}
}
ge-1/0/0 { # The interface on which packets are exiting the router.
unit 0 {
family inet {
address 192.0.2.1/30;
}
}
}
ge-1/0/4 { # The interface connected to the cflowd server.
unit 0 {
family inet {
address 198.51.100.1/32;
}
}
}
sp-2/0/0 { # The service interface that samples the packets from Router 1.
unit 0 {
family inet;
}
}
sp-2/1/0 { # The service interface that samples the packets from Router 3.
unit 0 {
family inet;
}
}
ge-3/1/0 { # This interface has sampling activated.
unit 0 {
family inet {
sampling { # Here sampling is activated.
input;
}
address 192.168.2.1/30;
}
}
}
}
forwarding-options {
sampling {
instance {
s0 {
input {
rate 1;
run-length 0;
}
family inet {
output {
flow-server 198.51.100.2 { # The address of the external server.
port 2055;
version9 {
template {
v4
}
}
}
interface sp-2/0/0 {
source-address 192.168.1.1; # Source address of the sampled packets
}
}
}
}
s1 {
input {
rate 1;
run-length 0;
}
family inet {
output {
flow-server 198.51.100.2 { # The address of the external server.
port 2055;
version9 {
template {
v4
}
}
}
interface sp-2/1/0 {
source-address 192.168.1.2; # Source address of the sampled packets
}
}
}
}
}
}
}
routing-options {
static {
route 203.0.113.0/8 next-hop 192.0.2.2;
}
}
services {
flow-monitoring {
version9 {
template v4 {
flow-active-timeout 30;
flow-inactive-timeout 30;
ipv4-template;
}
}
}
}
Comandos de configuración utilizados para el ejemplo de configuración
En este ejemplo, se utilizan los siguientes set comandos para la configuración de la instancia de muestreo. Reemplace los valores de estos comandos por valores relevantes para su propia red.
-
set chassis fpc 0 sampling-instance s0 -
set chassis fpc 3 sampling-instance s1 -
set interfaces ge-0/1/0 unit 0 family inet sampling input -
set interfaces ge-0/1/0 unit 0 family inet address -
set interfaces ge-1/0/0 unit 0 family inet address -
set interfaces sp-2/0/0 unit 0 family inet -
set interfaces sp-2/1/0 unit 0 family inet -
set interfaces ge-3/1/0 unit 0 family inet sampling input -
set interfaces ge-3/1/0 unit 0 family inet address -
set forwarding-options sampling instance s0 input rate 1 -
set forwarding-options sampling instance s0 input run-length 0 -
set forwarding-options sampling instance s0 family inet output flow-server 198.51.100.2 port 2055 -
set forwarding-options sampling instance s0 family inet output flow-server 198.51.100.2 version9 template v4; -
set forwarding-options sampling instance s0 family inet output interface sp-2/0/0 source-address 192.168.1.1 -
set forwarding-options sampling instance s1 input rate 1 -
set forwarding-options sampling instance s1 input run-length 0 -
set forwarding-options sampling instance s1 family inet output flow-server 198.51.100.2 port 2055 -
set forwarding-options sampling instance s1 family inet output flow-server 198.51.100.2 version9 template v4; -
set forwarding-options sampling instance s1 family inet output interface sp-2/1/0 source-address 192.168.1.2 -
set routing-options static route 203.0.113.0/8 next-hop 192.0.2.2 -
set services flow-monitoring version9 template v4 flow-active-timeout 30 -
set services flow-monitoring version9 template v4 flow-inactive-timeout 30 -
set services flow-monitoring version9 template v4 ipv4-template
Verificación de su trabajo
Para comprobar que la configuración funciona como se esperaba, utilice los siguientes comandos en el enrutador configurado con la instancia de muestreo:
-
show services accounting aggregation template template-name template-name -
show services accounting flow
A continuación se muestra el resultado de los show comandos emitidos en el enrutador MX480 utilizado en este ejemplo de configuración:
user@MX480–router> show services accounting aggregation template template-name v4
Src Dst
Port/ Port/
Source Destination ICMP ICMP Packet
Address Address Type Code Proto TOS Count
10.0.0.6 203.0.113.3 100 1000 17 8 14
10.0.0.5 203.0.113.2 100 1000 17 8 15
10.0.0.3 203.0.113.3 100 1000 17 8 15
10.0.0.2 203.0.113.3 100 1000 17 8 15
10.0.0.4 203.0.113.2 100 1000 17 8 15
10.0.0.6 203.0.113.2 100 1000 17 8 15
10.0.0.4 203.0.113.3 100 1000 17 8 15
10.0.0.2 203.0.113.2 100 1000 17 8 16
10.0.0.3 203.0.113.2 100 1000 17 8 15
10.0.0.5 203.0.113.3 100 1000 17 8 15
user@MX480–router> show services accounting aggregation template template-name v4
Src Dst
Port/ Port/
Source Destination ICMP ICMP Packet
Address Address Type Code Proto TOS Count
10.0.0.6 203.0.113.3 100 1000 17 8 16
10.0.0.5 203.0.113.2 100 1000 17 8 17
10.0.0.3 203.0.113.3 100 1000 17 8 16
10.0.0.2 203.0.113.3 100 1000 17 8 16
10.0.0.4 203.0.113.2 100 1000 17 8 17
10.0.0.6 203.0.113.2 100 1000 17 8 17
10.0.0.4 203.0.113.3 100 1000 17 8 16
10.0.0.2 203.0.113.2 100 1000 17 8 17
10.0.0.3 203.0.113.2 100 1000 17 8 17
10.0.0.5 203.0.113.3 100 1000 17 8 16
user@MX480–router> show services accounting flow
Flow information
Interface name: sp-2/0/0, Local interface index: 152
Flow packets: 884, Flow bytes: 56576
Flow packets 10-second rate: 0, Flow bytes 10-second rate: 628
Active flows: 10, Total flows: 35
Flows exported: 75, Flows packets exported: 14
Flows inactive timed out: 25, Flows active timed out: 75
user@MX480–router> show services accounting flow
Flow information
Interface name: sp-2/0/0, Local interface index: 152
Flow packets: 898, Flow bytes: 57472
Flow packets 10-second rate: 0, Flow bytes 10-second rate: 628
Active flows: 10, Total flows: 35
Flows exported: 75, Flows packets exported: 14
Flows inactive timed out: 25, Flows active timed out: 75