vSensor deployment in Libvirt
Review KVM requirements, networking guidance, VM operations, and vSensor deployment before pairing and updating.
Preparation
Ensure that
libvirt(includinglibvirt-client) andvirt-installare installed locally on the KVM host server.You must either be a root user or ensure that the user that will later launch the deployment script is in the
libvirtgroup on the KVM host server.
Libvirt Networking Guidance
Ensure that the desired Libvirt networks (that will be used for management and capture) are present, persistent, active, and autostarted using
virsh net-list –all.The default driver supported for the network interface is
virtio-pci.
Vectra recommends that customers create a new virtual network on the Libvirt host server from which they want to capture packets and set the interface to promiscuous mode.
This is the only configuration that Vectra officially tests and supports.
The Vectra vSensor(s) should be the only virtual machine(s) on this network, unless there are other similar virtual machines that you want to provide the same set of traffic into.
Traffic mirroring may be implemented using either Open vSwitch or
tc.The steps to create a new mirror from an existing physical network interface to a new virtual one are as follows:
Open vSwitch
# Define the interfaces and the mirror
BRIDGE="br0"
SRC="eth0"
DST="vnet0"
MIRROR="span"
# Create a bridge and set all ports up
ovs-vsctl add-br ${BRIDGE}
ip link set dev ${BRIDGE} up
ip link set dev ${SRC} up
ip link set dev ${DST} up
# Enable promiscuous mode on the source interface
ip link set ${SRC} promisc on
# Add the ports to the bridge and enable a traffic mirror from SRC to DST
ovs-vsctl \
-- add-port ${BRIDGE} ${SRC} \
-- add-port ${BRIDGE} ${DST} \
-- --id=@${SRC} get port ${SRC} \
-- --id=@${DST} get port ${DST} \
-- --id=@${MIRROR} create mirror \
name=${MIRROR} \
select-src-port=@${SRC} \
select-dst-port=@${SRC} \
output-port=@${DST} \
-- set bridge ${BRIDGE} mirrors=@${MIRROR}tc
Jumbo Frame Support
If your deployment requires jumbo frame support, please see the below additional guidance:
To process jumbo frames, the
MTUneeds to be set to9000on both the host bridge and thevnetinterface used for capture.virsh net-info <network>can be used to show the bridge associated with the network you have defined as your capture network. In the below example,captureis the network name being used for capture. In this example the bridge isvirbr1.
If the bridge is set to
9000before deploying your Vectra KVM vSensor then the target device will be set to9000automatically during the vSensor deployment.If you need to set
MTUto9000after the vSensor has been deployed,virsh dumpxml <sensor name>will show the bridge and the associated target device that need to be set to9000. Replace<sensor name>with the name of your Vectra KVM vSensor name.Please note that the output of this command is long, and we only care about the interface sections.
In the above example (the output was truncated to only show the relevant section) , you can see the
bridgeandtarget device(virbr1andvnet6) are annotatedThe command to set the
MTUto9000on a network (bridge or target device/interface) isip link set dev <network> mtu 9000. The command has no output as seen in the example below:
You can validate the current MTU settings with the
ip acommand. Please see abridged example below:
Basic Interaction with KVM Virtual Machines
The easiest way to interact with KVM VMs via the command line is by using the virsh series of commands. Vectra’s deployment script will automatically start and configure the guest you, however these basic commands could prove helpful when diagnosing setup issues:
View the list of configured virtual machines:
virsh list --all
Start - In order to start a given virtual machine for which a configuration already exists:
virsh start <name of vm>
Stop and save state:
virsh shutdown <name of vm>
Stop quickly and don't save state (used only when you know you are going to purge the vm):
virsh destroy <name of vm>
Purge the vm after stopping (needs to be used in tandem with destroy):
virsh undefine <name of vm>
View the IP address(es) and MAC address(es) of a given virtual machine and its interfaces:
virsh qemu-agent-command <name of vm> '{"execute":"guest-network-get-interfaces"}' | jq .
Downloading the KVM vSensor Image
The KVM vSensor image is available under Configuration → COVERAGE → Data Sources → Network → Sensors in your Vectra UI. Navigate to this area, click Download Virtual Image at the top right, and select the KVM vSensor (QCOW2) option.

Deploying the KVM vSensor
Once downloaded, the machine image can be placed in the directory of your choice and uncompressed. It is a tar file. On an Ubuntu machine the tar -xf command will uncompress the file fully. Using other tools may require 2 steps.

The script to start the deployment is vectra-vsensor.sh which has help that can be displayed as shown below:
Execute the script to begin the deployment:
As you can see in the above output, you will need to select some options:
VM configuration- See the KVM vSensor Requirements and Throughput in the earlier section of this guide for details on the expected performance and resource requirements for each configuration.management NIC– Which NIC to use for the management interface of the vSensor.Capture NIC– Which NIC to use for the capture interface of the vSensor.
Your KVM vSensor will start automatically once the deployment script has finished.
Last updated
Was this helpful?