Port-Based Mirroring
SUMMARY This section describes port-based mirroring in Juniper® Cloud-Native Contrail Networking (CN2) Release 22.2 and later in a Kubernetes-orchestrated environment.
Overview: Port-Based Mirroring
Port mirroring sends network traffic from defined ports to a network analyzer where you can monitor and analyze the data. In CN2, the following is supported:
-
Mirroring configuration is primarily driven from the pod configuration for both the receiver and interface being mirrored. You don't need to configure the virtual machine interface (VMI) directly.
-
Mirroring configuration involves creating a
MirrorDestinationresource and associating theMirrorDestinationresource to the pod interface to be mirrored. -
MirrorDestinationidentifies the mirrored traffic receiver pod and interface. WhenjuniperHeaderis enabled, the receiver pod IP address and port are used. WhenjuniperHeaderis disabled, the receiver pod MAC addressroutingInstanceis used to forward mirrored traffic. - A
MirrorDestinationcan be associated with multiple VMIs to be mirrored. - A
MirrorDestinationresource defines the mirrored traffic receiver such as IP address, port used for receiving mirrored traffic, Juniper header configuration, dynamic or static next-hop, and so on. - A pod interface to be mirrored can be configured when creating the pod or by editing the pod.
Example: Configure Port-Based Mirroring
The following procedure is an example configuration that creates a
MirrorDestination resource and specifies the
MirrorDestination resource name, such as
mirrordestinationprofile1, on the interface to be
mirrored.
Summary
SUMMARY This section describes configuration changes for port-based mirroring in CN2 Release 22.2.
From the analyzer pod annotations and labels, the VM and VMI are associated with
the pod to be used in the MirrorDestination controller.
Analyzer VM Labels:
The VirtualMachine resource corresponding to the pod will have
the label core.juniper.net/analyzer-pod label.
apiVersion: core.contrail.juniper.net/v1alpha1
kind: VirtualMachine
metadata:
annotations:
kube-manager.juniper.net/pod-cluster-name: contrail-k8s-kubemanager-ocp-kparmar-6mpccd
kube-manager.juniper.net/pod-name: analyzerpod
kube-manager.juniper.net/pod-namespace: multinode-ns
labels:
core.juniper.net/analyzer-pod: analyzerpod
Analyzer VMI Labels:
The VirtualMachineInterface resource for the analyzer pod will
have the label core.juniper.net/analyzer-interface.
apiVersion: core.contrail.juniper.net/v1alpha1
kind: VirtualMachineInterface
metadata:
annotations:
index: 0/1
interface: eth0
kube-manager.juniper.net/pod-cluster-name: contrail-k8s-kubemanager-ocp-kparmar-6mpccd
kube-manager.juniper.net/pod-name: analyzerpod
kube-manager.juniper.net/pod-namespace: multinode-ns
labels:
core.juniper.net/analyzer-interface: ""
Source VMI Label indicating MirrorDestination:
Source VirtualMachineInterface corresponding to the pod
interface being mirrored will have the label
core.juniper.net/mirror-destination. The annotations will
have the mirror configuration.
apiVersion: core.contrail.juniper.net/v1alpha1
kind: VirtualMachineInterface
metadata:
annotations:
core.juniper.net/mirroring-configuration: '{"analyzer_name":"mirrordestinationprofile1","analyzer_ip_address":"10.128.0.200","analyzer_macaddress":"02:76:6c:25:f2:8c","ri":"default-
domain:contrail-k8s-kubemanager-ocp-kparmar-6mpccd-contrail:default-podnetwork:default-podnetwork"}'
labels:
core.juniper.net/mirror-destination: mirrordestinationprofile1