Linux VPS

Speed test a server: bandwidth vs throughput with iperf3 and curl

Why a 1 Gbps port rarely shows 1 Gbps in a download, and how to measure real throughput to and from your VPS with iperf3, curl and speedtest tools.

IntermediateLinux VPS2 min read

Bandwidth is the capacity of a link, like the width of a road. Throughput is how much data actually gets through, which depends on latency, packet loss, the other end and TCP behaviour. A server on a 1 Gbps port can easily show 200 Mbps in a careless test. This guide shows how to measure properly.

Before you start

Why throughput is lower than bandwidth

  • Latency: a single TCP stream can only have so much data in flight. Over 150 ms, one stream may top out far below the port speed. Multiple streams fix this.
  • Packet loss: even 1% loss makes TCP slow down sharply (see MTR report).
  • The slowest link wins: your home connection, the remote server or a congested route.
  • Disk and CPU: a download written to slow disk measures the disk, not the network.
  • Bits vs bytes: 1 Gbps ≈ 119 MB/s at most. Browsers show MB/s.

Quick test with speedtest

sudo apt install speedtest-cli
speedtest-cli --simple

This tests to the nearest public Speedtest server. Useful as a sanity check, but the result depends on that server.

Test a download with curl

curl -o /dev/null -w "speed: %{speed_download} bytes/s\n" https://SPEEDTEST-FILE-URL

Writing to /dev/null takes the disk out of the measurement. Use a large test file from a provider near the server.

Accurate test between two machines with iperf3

  1. Install iperf3 on both machines (apt install iperf3 or dnf install iperf3).
  2. On the server, start a listener and open its port temporarily:
sudo ufw allow 5201/tcp
iperf3 -s
  1. On the other machine, test upload, then download with -R, then with 8 parallel streams:
iperf3 -c SERVER-IP -t 20
iperf3 -c SERVER-IP -t 20 -R
iperf3 -c SERVER-IP -t 20 -P 8
  1. Stop the server with Ctrl+C and remove the firewall rule: sudo ufw delete allow 5201/tcp.

Read the results

  • Parallel much faster than single stream: latency limits one stream. Normal over long distances.
  • Many Retr (retransmissions): packet loss or an MTU issue (troubleshoot MTU problems).
  • One direction slow: often your home upload speed, or an asymmetric route.

Tip: On a modern kernel, enabling BBR congestion control can help long-distance throughput: sysctl net.ipv4.tcp_congestion_control=bbr. Test before and after.

Troubleshooting

  • iperf3 connection refused: the listener is not running or the port is closed (UFW rules).
  • Website feels slow but iperf3 is fast: the network is fine; look at the application and caching.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.