LLI Wiki — My Digital Knowledge Base

Testing network performance: iperf3, psping and PowerShell

Commands to measure throughput, latency, MTU and DNS resolution with iperf3, psping, ping and the PowerShell network cmdlets.

Quick reference of commands to test network throughput, latency, MTU and name resolution between two machines (for example a SQL Server and its clients). Background reading: Azure network latency and SQL Server optimization.

Throughput with iperf3

Run a server on one machine and a client on the other. Public test servers are listed in public-iperf3-servers.

# server
.\iperf3.exe -s

# client, 60 seconds test
.\iperf3.exe -c 192.0.2.10 -t 60

# public server: -R reverse (download), -4/-6 force IP version, -P parallel streams
iperf3 -c paris.testdebit.info -p <PORT> -R
iperf3 -c speedtest.wtnet.de -p <PORT> -P <STREAMS> -4

See also how to use iperf.

Latency with psping (Sysinternals)

# server
psping.exe -4 -f -s 192.0.2.10:5001

# client
psping.exe -4 -h 20 -n 20 -l 100M 192.0.2.10:5001
psping -l 16k -n 100000 -h 100 192.0.2.10:5001

# continuous TCP ping with timestamp
psping.exe -t -T -i 1 192.0.2.11 | Foreach{"{0} - {1}" -f (Get-Date),$_}

Ping with timestamps and MTU test

# test jumbo frames: -f = do not fragment, -l = payload size
ping -f -l 2000 192.0.2.10

ping -w 1500 -l 1000 -t sqlserver01 | Foreach{"{0} - {1}" -f (Get-Date),$_}
ping -t 192.0.2.13 | Foreach{"{0} - {1}" -f (Get-Date),$_} > c:\ping_log.txt

Test-Connection -Count 9999 -ComputerName sqlserver01 | Format-Table @{Name='TimeStamp';Expression={Get-Date}},Address,ProtocolAddress,ResponseTime

Network interfaces and MTU

netsh interface show interface
netsh interface ip show interfaces
netsh interface ipv4 show subinterface
netsh interface tcp show chimneystats <NIC ID>

# change the MTU persistently
netsh interface ipv4 set subinterface "Local Area Connection" mtu=1458 store=persistent

PowerShell equivalents of classic network tools

# ipconfig
Get-NetIPConfiguration
Get-NetIPAddress | Sort InterfaceIndex | FT InterfaceIndex, InterfaceAlias, AddressFamily, IPAddress, PrefixLength -Autosize
Get-NetIPAddress | ? AddressFamily -eq IPv4 | FT -AutoSize

# ping / port test
Test-NetConnection -ComputerName sqlserver01 -InformationLevel Detailed
Test-NetConnection -ComputerName sqlserver01 | Select -ExpandProperty PingReplyDetails | FT Address, Status, RoundTripTime -Autosize
1..10 | % { Test-NetConnection -ComputerName sqlserver01 -RemotePort 80 } | FT -AutoSize

# nslookup
Resolve-DnsName www.example.com
Resolve-DnsName example.com -Type SOA
Resolve-DnsName example.com -Server 8.8.8.8 -Type A

# route
Get-NetRoute -Protocol Local -DestinationPrefix 192.168*

# tracert
Test-NetConnection www.example.com -TraceRoute
Test-NetConnection sqlserver01 -TraceRoute | Select -ExpandProperty TraceRoute | % { Resolve-DnsName $_ -Type PTR -ErrorAction SilentlyContinue }

# netstat
Get-NetTCPConnection | Group State, RemotePort | Sort Count | FT Count, Name -Autosize
Get-NetTCPConnection | ? State -eq Established | FT -Autosize
Get-NetTCPConnection | ? State -eq Established | ? RemoteAddress -notlike 127* | % { $_; Resolve-DnsName $_.RemoteAddress -Type PTR -ErrorAction SilentlyContinue }

Screenshots

OSI versus TCP/IP model comparison

The seven layers of the OSI model

Mastodon LLIMastodon SocialFosstodon