Real-World Scenario: Diagnosing Network Bottlenecks at 2 AM
At exactly 2:00 AM, PagerDuty started screaming. Payment services reported massive timeouts, and database latency spiked past 5,000 ms. I grabbed my laptop, fired up the VPN, and jumped in to inspect our 8-node ESXi cluster running vSphere 7.0.
Checking the core switch dashboard showed that the 10Gbps uplink was only utilizing about 12-15% of bandwidth. CPU and RAM across all ESXi nodes stayed comfortably below 40%. Where was the bottleneck? As it turned out, the two VMs handling the heaviest workload were co-located on the same host, communicating via the same Distributed Portgroup. All internal East-West traffic was routed through the vSwitch in the physical host’s RAM, never touching the physical fiber optic cables outside. At this point, traditional SNMP polling and physical SPAN ports were completely blind.
To illuminate this invisible traffic, built-in NetFlow/IPFIX (NetFlow v10) on the vSphere Distributed Switch (vDS) is the fastest lifesaver. Instead of capturing full payloads—which creates substantial overhead—vDS only collects metadata for each flow: the 5-tuple (source/destination IP, source/destination port, protocol) along with byte and packet counts. This allows you to immediately pinpoint which VM is flooding traffic, which machine is running abnormal port scans, or which rogue backup script is running during peak hours.
Setting Up a Flow Collector (NetFlow Collector)
Before configuring anything in vCenter, you need a Collector to receive flow records. You can send flows to tools like PRTG, SolarWinds, ManageEngine NetFlow Analyzer, or spin up lightweight open-source solutions like nfdump or ntopng.
For fast troubleshooting during an outage, spinning up an Ubuntu VM running nfdump is the quickest option. By default, NetFlow uses UDP port 2055. On the Collector host, run a few basic installation commands:
sudo apt-get update && sudo apt-get install -y nfdump
# Create directory to store flow dump files
sudo mkdir -p /var/log/netflow
# Run nfcapd listening on UDP port 2055, rotating log files every 5 minutes (-t 300)
sudo nfcapd -w -D -l /var/log/netflow -p 2055 -t 300
Don’t forget to allow UDP port 2055 through the firewall:
sudo ufw allow 2055/udp
sudo ufw reload
Detailed Configuration on vSphere Distributed Switch
Setting this up on a vSphere Distributed Switch consists of two steps: defining the Collector at the switch level, and then enabling monitoring on specific Distributed Portgroups.
Step 1: Configure the NetFlow Collector on the vDS
- Log in to the vSphere Client (HTML5).
- Navigate to Networking > select your cluster’s Distributed Switch (vDS).
- Go to the Configure tab > scroll down to NetFlow (under Settings).
- Click Edit and configure the following parameters:
- Collector IP and Port: Enter the IP of your collector VM (e.g.,
192.168.10.50) and port2055. - Switch IP: Enter the vCenter IP or the management vmk0 interface IP (e.g.,
192.168.10.10). This serves as the switch identifier in NetFlow packets. - Active flow export timeout (seconds): Lower this from 60 to 30 seconds. This sends flow records more frequently, making real-time troubleshooting easier during an incident.
- Idle flow export timeout (seconds): Keep the default of 15 seconds.
- Sampling rate: Defaults to
0(1:1, capturing all flows). If your infrastructure handles over 40 Gbps of throughput, set it to50or100(capturing 1 out of every 100 packets) to protect ESXi host CPU.
- Collector IP and Port: Enter the IP of your collector VM (e.g.,
- Click Save so vCenter pushes and syncs the configuration across all ESXi hosts.
Step 2: Enable NetFlow on Distributed Portgroups
Configuring the switch only sets global parameters. You must enable it on target portgroups for the vDS to start tracking traffic:
- In the networking inventory, right-click the target Distributed Portgroup (e.g.,
DPortGroup_Production_DB) > select Edit Settings. - Click Monitoring in the left sidebar.
- Next to NetFlow, change the status from
Disabledto Enabled. - Click OK to finish. Traffic traversing vNICs on this portgroup will immediately generate flow records and export to your collector periodically.
Pro Tip: Bulk Enablement via PowerCLI
If your cluster has dozens of portgroups, clicking through them manually is tedious. You can automate the process with this PowerCLI script:
# Connect to vCenter
Connect-VIServer -Server vcenter.corp.local -User [email protected]
$vDSName = "vDS-Core-Cluster01"
$CollectorIP = "192.168.10.50"
$CollectorPort = 2055
# Configure collector on vDS
$vDS = Get-VDSwitch -Name $vDSName
Set-VDSwitch -VDSwitch $vDS -NetFlowCollectorIP $CollectorIP -NetFlowCollectorPort $CollectorPort -NetFlowActiveFlowTimeout 30
# Automatically enable NetFlow on all Production Portgroups
Get-VDPortgroup -VDSwitch $vDS | Where-Object { $_.Name -like "*Prod*" } | ForEach-Object {
$_ | Get-View | ForEach-Object {
$spec = New-Object VMware.Vim.DVPortgroupConfigSpec
$spec.configVersion = $_.Config.ConfigVersion
$spec.defaultPortConfig = New-Object VMware.Vim.VMwareDVSPortSetting
$spec.defaultPortConfig.filterPolicy = New-Object VMware.Vim.DvsFilterPolicy
$spec.defaultPortConfig.ipfixEnabled = New-Object VMware.Vim.BoolPolicy
$spec.defaultPortConfig.ipfixEnabled.value = $true
$spec.defaultPortConfig.ipfixEnabled.inherited = $false
$_.ReconfigureDVPortgroup_Task($spec)
}
}
Verifying Data and Isolating the Issue
How do you confirm that ESXi is successfully exporting flow records?
Verifying Outbound Packets from ESXi Using pktcap-uw
SSH directly into an ESXi host in the cluster and capture UDP 2055 packets on the management vmkernel interface:
# Capture 5 NetFlow packets sent to the collector via vmk0
pktcap-uw --vmk vmk0 --ip 192.168.10.50 --port 2055 -c 5
# Check vDS status on the host
esxcli network vswitch dvs vmware list
If the terminal outputs matching UDP 2055 frames, the export pipeline is functioning properly.
Analyzing Real Traffic on the Collector
Switch back to the collector terminal and read the latest logs using nfdump:
# List the top 10 bandwidth-consuming IPs in the last 5 minutes
nfdump -R /var/log/netflow -s ip/bytes -n 10
On that night on call, the output revealed the culprit immediately:
Top 10 IP ordered by bytes:
Date first seen Duration Proto IP Addr:Port Packets Bytes bps
2026-11-28 01:58:12.102 124.512 TCP 10.10.20.45:48912 18.2 M 24.1 G 1.5 Gbps
2026-11-28 01:58:12.105 124.509 TCP 10.10.20.12:3306 12.1 M 18.4 G 1.1 Gbps
IP 10.10.20.45 (a staging worker VM belonging to the dev team) was running a mysqldump cron job pulling the entire production database from 10.10.20.12 over port 3306. The internal traffic surged to 1.5 Gbps, exhausting the virtual portgroup buffer and causing payment requests to suffer severe packet drops. I temporarily disabled the network adapter on that dev VM. Database latency dropped from 5,000 ms back down to 2 ms in less than 30 seconds.
Enabling NetFlow on vDS consumes under 1-2% host CPU when configured with an appropriate sampling rate. In return, you get complete visibility into every virtual machine’s vNIC without purchasing expensive virtual appliances. When things break in the middle of the night, it gives you actionable data rather than guesswork.
