Traffic Capture
Proxmox VE capture
Deliver the core switch mirror into a HOSSIDARK virtual machine on Proxmox through a dedicated capture bridge.
On this page
Overview
The physical switch sends its SPAN copy to a free physical NIC of the Proxmox host. A capture-only bridge carries it to the second virtual NIC of the HOSSIDARK VM.
Core switch --SPAN--> enp3s0f1 -> vmbr1 (no IP, ageing 0) -> HOSSIDARK net1 (no IP)
Management LAN ------> enp3s0f0 -> vmbr0 -> HOSSIDARK net0 (console and SSH)
Steps
- Create the capture bridge in
/etc/network/interfaceson the host:
auto vmbr1
iface vmbr1 inet manual
bridge-ports enp3s0f1
bridge-stp off
bridge-fd 0
bridge-ageing 0
bridge-ageing 0 makes the bridge forward every frame to all ports instead of learning addresses, so the VM sees the whole copy. Apply with ifreload -a.
2. Give the VM two VirtIO NICs: net0 on vmbr0, net1 on vmbr1. Disable the Proxmox firewall on net1.
3. Do not give net1 an IP address inside HOSSIDARK.
4. Keep VLAN tags: do not set a VLAN tag on net1 and do not make vmbr1 VLAN-aware, unless you deliberately filter VLANs.
Traffic between VMs on the same host
Mirror the VM taps on the host to the capture bridge with tc:
tc qdisc add dev tap101i0 handle ffff: ingress
tc filter add dev tap101i0 parent ffff: matchall action mirred egress mirror dev vmbr1
tc qdisc add dev tap101i0 handle 1: root prio
tc filter add dev tap101i0 parent 1: matchall action mirred egress mirror dev vmbr1
With Open vSwitch bridges, use an OVS mirror instead:
ovs-vsctl -- --id=@p get port tap200i1 -- --id=@m create mirror name=hd select-all=true output-port=@p -- set bridge vmbr0 mirrors=@m
Here tap200i1 is the HOSSIDARK capture NIC. Tap names change when a VM is recreated; reapply them from a hook script.
Before you start
| Requirement | Detail |
|---|---|
| Proxmox VE | 7.x or 8.x. |
| Host NIC | One free physical port connected to the switch SPAN destination. |
| VM | 2 VirtIO NICs, multiqueue equal to the vCPU count for high volume, CPU type host. |
| Shell | Root shell on the Proxmox host. |
Keep mirrors after VM restarts (hook script)
Tap interfaces are recreated each time a VM starts, so tc rules disappear. Save this as /var/lib/vz/snippets/hd-mirror.sh, make it executable and attach it with qm set 101 --hookscript local:snippets/hd-mirror.sh on every watched VM:
#!/bin/bash
vmid="$1"; phase="$2"
[ "$phase" = "post-start" ] || exit 0
for tap in /sys/class/net/tap${vmid}i*; do
dev=$(basename "$tap")
tc qdisc replace dev "$dev" handle ffff: ingress
tc filter replace dev "$dev" parent ffff: matchall action mirred egress mirror dev vmbr1
tc qdisc replace dev "$dev" handle 1: root prio
tc filter replace dev "$dev" parent 1: matchall action mirred egress mirror dev vmbr1
done
How to confirm it works
- On the host:
tc -s filter show dev tap101i0 ingressshows a growing packet counter on the mirred action. cat /sys/class/net/vmbr1/bridge/ageing_timereturns0.- In the console, Network Settings > Sensing shows the card as Receiving.
Common problems
| Symptom | Cause | Fix |
|---|---|---|
| Only broadcast seen | Bridge learning addresses | Set bridge-ageing 0 and run ifreload -a. |
| Mirror stops after VM reboot | Tap recreated | Use the hook script above. |
| Nothing on net1 | Proxmox firewall on net1 | Uncheck Firewall on the capture NIC. |
| VLANs stripped | vmbr1 VLAN-aware or tag on net1 | Remove the tag; leave the bridge not VLAN-aware. |
| Drops | Single queue | Set queues on net1 to the vCPU count. |