Hello @Emma Brooks
The large number of TIME_WAIT connections is important, but I wouldn't treat TCP tuning as the primary fix yet. For a persistent iSCSI workload, thousands of short-lived TCP connections usually indicate sessions are repeatedly torn down and re-established.
Microsoft’s current iSCSI troubleshooting guidance specifically identifies network instability, MPIO configuration problems, NIC/driver issues, and storage connectivity problems as common causes of iSCSI disconnect/reconnect behavior.
I would first capture the current state while the problem is occurring:
Get-IscsiSession
Get-IscsiConnection
Get-NetTCPConnection |
Group-Object State |
Sort-Object Count -Descending
Get-NetTCPConnection -State TimeWait |
Select-Object LocalAddress,LocalPort,RemoteAddress,RemotePort
Also check the configured dynamic TCP range:
netsh int ipv4 show dynamicport tcp
netsh int ipv6 show dynamicport tcp
On modern Windows Server versions, the default dynamic TCP range is normally 49152–65535. Microsoft supports changing this range using netsh if diagnostics confirm that dynamic ports really are being exhausted.
For example, the supported syntax is:
netsh int ipv4 set dynamicport tcp start=<start> num=<number-of-ports>
However, I wouldn't change this until you've confirmed that the initiator is actually exhausting its local dynamic ports. Increasing the range can provide additional headroom, but it won't fix whatever is causing persistent iSCSI sessions to disconnect.
I would also be cautious about changing TcpTimedWaitDelay. Reducing TIME_WAIT can make ports reusable sooner, but doing that simply to compensate for repeated iSCSI reconnects can mask the actual storage/network problem.
For the iSCSI side, I'd investigate:
- Event Viewer for iSCSI/Storport events, particularly 9, 20, 27, 39, 129, and 153
- NIC errors, drops, and link resets
- NIC driver and firmware versions
- MTU/Jumbo Frame consistency end-to-end
- iSCSI network isolation/VLAN configuration
- MPIO configuration and path stability
- Target-side logs at the exact disconnect timestamps
- Whether each MPIO/iSCSI path is using the intended dedicated NIC
Microsoft specifically recommends checking Get-IscsiConnection, Get-IscsiSession, MPIO configuration, network configuration, and current NIC/storage firmware when investigating iSCSI disconnects.
You can also collect a Windows network trace during a disconnect:
netsh trace start scenario=netconnection capture=yes tracefile=C:\Temp\iscsi.etl
Reproduce the disconnect/reconnect, then:
netsh trace stop
I'd correlate that trace with the iSCSI Target/Initiator and System event logs. That should tell you whether the initiator, target, or something along the network path is resetting the TCP sessions.
So I agree with the earlier response: don't start by aggressively lowering TIME_WAIT. First, determine why the supposedly persistent iSCSI connections keep closing. If you correct the root cause, port exhaustion will likely disappear.
Sharing these references with you:
iSCSI storage connectivity troubleshooting guidance
TCP/IP port exhaustion troubleshooting
If you can share the Windows Server version, output of Get-IscsiConnection, netsh int ipv4 show dynamicport tcp, and the relevant iSCSI/Storport event IDs around one disconnect, we can narrow down whether this is genuine port exhaustion or a symptom of the underlying iSCSI path failure.
Please "Accept the Answer" if this information helped you. This will help us and others in the community.