Skip to content
Contents
GuidesOpenWrt

Measuring WireGuard throughput at the tunnel endpoints

The router forwarding terminal traffic via WireGuard, versus the router establishing a WireGuard tunnel itself, represents two distinct test scenarios. The former may only handle outer-layer UDP routing or NAT, while the latter additionally involves cryptographic operations and encapsulation at the tunnel endpoint. A standard NAT performance cannot be directly translated into this device's WireGuard performance.

The router forwarding terminal traffic via WireGuard, versus the router establishing a WireGuard tunnel itself, represents two distinct test scenarios. The former may only handle outer-layer UDP routing or NAT, while the latter additionally involves cryptographic operations and encapsulation at the tunnel endpoint. A standard NAT performance cannot be directly translated into this device's WireGuard performance.

WireGuard uses ChaCha20-Poly1305 for authenticated data encryption. It does not use AES.WireGuard Protocol DescriptionLists its cryptographic primitives. Therefore, "CPU has AES acceleration" or "chip has a network NPU" alone is insufficient to infer a specific WireGuard throughput; the actual implementation, CPU instruction path, and overall system environment must also be considered.

This paper presents an isolation experiment scheme and evaluation methodology, without running performance benchmarks, nor with fabricated throughput or power consumption figures.

First, mark on the diagram who holds the tunnel key.

Categorize your cabling into one of the following types, recording the inner address, outer address, and the role of each device:

Test topology What role does the test router play? What can be evaluated?
A → Test router R's WireGuard → Experiment peer E → B R is the tunnel endpoint and forwards service traffic from A. The entire device's end-to-end capabilities as a VPN gateway
A runs WireGuard → R → E → B R forwards only the encrypted outer-layer packets The outer-layer router/NAT path cannot serve as R's encryption performance.
Launch iperf3 on the R device locally, and have the WireGuard tunnel on R send packets. R serves as both the application endpoint and the tunnel endpoint. This device's packet transmission load combination cannot replace the previous row or the first row.

Actual usage may not involve an independent B; if the server runs directly on E, it will also consume CPU resources on the tunnel peer end. Regardless of the approach chosen, this condition must be clearly stated. A general VPN topology does not require separate equivalent documentation for each query; the focus of this article is on the WireGuard implementation and measurement methodology.

The outer link, A, E, and B in the experiment are under your control and are disconnected from the public internet and production networks. First, use low-speed traffic to verify the path, then proceed to discuss load testing. Do not use public WireGuard demonstration nodes or unfamiliar speed-test servers to measure throughput limits.

Check router, handshake, and data count; do not export keys

Start with a working lab tunnel. This example uses interface wgtest and address 10.77.0.2 on B. Substitute the interface and nonconflicting private address you verified in your own setup. The checks do not change the default route or VPN keys.

Record device and implementation information in the R SSH terminal, then read the specified fields:

ubus call system board
uname -r
wg --version
wg show interfaces
wg show wgtest endpoints
wg show wgtest allowed-ips
wg show wgtest latest-handshakes
wg show wgtest transfer
ip link show dev wgtest
ip route get 10.77.0.2

endpoints are the outer-side peer ends; allowed-ips must correspond to the expected inner network; latest-handshakes and transfer must be compared before and after business operations. The age of handshake during tunnel idleness does not indicate failure; only after low-speed traffic is initiated and no handshake occurs or no expected increment in transmission is observed, should connectivity be further verified. A successful handshake only proves completion of control plane exchange and cannot independently verify application-layer connectivity.

On A, also execute ip route get 10.77.0.2. In the first topology, the traffic should first pass through R; on R, the expected tunnel route should be visible. When using policy routing or marking, verify against the actual source address and rules—do not infer based on default routes alone.

Record MTU, kernel implementation or user-space implementation, and software version. Before installing tools, first install the WireGuard package matching the current firmware; if the interface is not found, halt subsequent transmissions. Do not post wg showconf, queries containing private-key, or dump outputs in articles, as they may contain private keys or pre-shared keys.wg handbookThese output formats are described.

Existing isolation: OpenWrt WireGuard routing verification, protected source routed via wg_home selection

This SSH screenshot only records the routing result for the protected source selection wg_home. Effective throughput can only be filled after verifying the business bytes at the receiving end.

First perform limited bidirectional service validation

On B start a one-time iperf3 service bound to an experimental IP address. B must indeed hold this address and already have the correct path from E to A:

iperf3 -s -1 -B 10.77.0.2 -p 5201

Initiate limited TCP transmission over an established tunnel path in A:

iperf3 -c 10.77.0.2 -p 5201 -b 1M -t 15

1 Mbit/s, 15 seconds is merely a probe in this example. Check whether the receiver end reports transmission completion, and simultaneously compare the WireGuard receive and transmit increments for R and E. Then, restart the one-time service on B, and append -R to the command on A to measure the reverse direction. If transmission succeeds but the reverse fails, first verify AllowedIPs, return path, forwarding permissions, and MTU—do not immediately attribute the cause to encryption speed.

Low-speed testing should bypass the expected interface; any subsequent "benchmarking" must be paused. Benchmarking is only authorized after path validation, at which point controlled load experiments in isolated environments can be designed.iperf3 manualdefines -b as the target sending rate. Record the receiver's result for delivered throughput.

Each group indicates which layer it tests.

Formally compare at least three independent labels: the unencrypted baseline under the same topology, R-terminated tunnel, and end-terminal terminated tunnel. Do not combine the fastest numbers from different endpoints or different paths into a single chip performance ranking. Regarding offload, modify only explicitly defined switches and record actual hit evidence; do not infer hardware encryption has been enabled based solely on CPU reduction.

The quantities to record What to record
Receive business throughput iperf3 receiver payload rate, specify TCP/UDP, direction, and number of connections
Inner packet length Application load and inner IP packet are separated; UDP's -l is not the on-link frame length
Outer-layer traffic UDP tunnel and link encapsulation are counted separately; no one-to-one correspondence with the inner-layer bytes is required.
CPU/Soft interrupt R, E, and test end shall observe separately; do not rely solely on the overall average value.
Latency and packet loss Measure under no load and under specified load, specifying sample size and statistical method.
Environment Firmware, implementation, MTU, temperature, frequency, port negotiation, duration and repetition count

In Linux flowtable, HW_OFFLOAD describes hardware forwarding of a particular flow. This flag cannot demonstrate hardware acceleration of WireGuard's ChaCha20-Poly1305 computation. If R only forwards the outer UDP packets between tunnel endpoints, the entry describes only that outer flow.Linux flowtable documentationShould be used in conjunction with specific driver documentation.

If the remote E or test end B is already near saturation, first eliminate limitations at these endpoints before evaluating router R. If a specific core of R reaches its limit first, further investigate the tunnel processing, forwarding, and interrupt paths handled by that core; upgrading the remote end cannot directly resolve bottlenecks in R. If anomalies only occur when packet length is changed, return to troubleshooting MTU, fragmentation, and packet loss. If rate variations coincide with frequency or temperature changes, the issue cannot be solely attributed to offload switching. Without wall-end instrumentation, consider power consumption as unmeasured; do not estimate power in watts based on CPU utilization.

Close with real business scenarios and remove the experimental entry point.

Within the same tunnel, retrieve a pre-prepared small test file or complete one round of controlled application request to verify business outcomes and return paths; do not treat tests consisting of only handshake records as business acceptance. Divide observations into "path passed", "business function passed under this load", and "performance unmeasured/measured"; leave unmeasured values as null.

Terminate the client, causing the one-time service to exit; if it does not exit, press Ctrl-C in the foreground of B. If the test only used the aforementioned read-only queries and transfers, no changes to the tunnel configuration are needed. If routing, MTU, or offload options were adjusted otherwise, restore them one by one according to the pre-test records and re-verify the original communication; finally revoke the temporary port permissions. Do not perform arbitrary deletion of tunnels or full-network resets on interfaces carrying management connections.

How to route your home through WireGuard on OpenWrt and verify the egress IP

Reference

Explore hardware

Comments