Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Fix Slow OpenVPN Speeds on Your VPS

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

If your OpenVPN connection on your own VPS is crawling, this guide walks you through the most common causes and fixes. You'll check your VPS's network limits, adjust OpenVPN and kernel settings, and test each change to see real speed improvements. You'll need SSH access to your VPS (root or sudo) and permission to restart the OpenVPN service.

What You'll Need

  • SSH client (like PuTTY on Windows, or Terminal on macOS/Linux)
  • Root or sudo access to your VPS
  • OpenVPN server already installed and working (you can connect, but speeds are poor)
  • A speed test tool (like speedtest-cli or a web-based speed test) to measure before/after

Step-by-Step

  1. Measure your baseline speed. Connect to your VPN and run a speed test (e.g., speedtest-cli if installed, or visit speedtest.net in a browser). Note the download and upload speeds. Also test without the VPN to know your ISP's raw speed – this tells you the ceiling you're aiming for.
  2. Check your VPS's network throughput. On the VPS, run iperf3 -s in one terminal, and from your local machine (with VPN off) run iperf3 -c your_vps_ip. If the raw throughput is already low (e.g., under 50 Mbps on a gigabit plan), the bottleneck is the VPS provider, not OpenVPN. Contact your host or consider upgrading.
  3. Enable TCP BBR congestion control. BBR often improves throughput on high-latency links. Edit /etc/sysctl.conf and add or change these lines:
    net.core.default_qdisc = fq
    net.ipv4.tcp_congestion_control = bbr
    Then run sysctl -p to apply. Verify with sysctl net.ipv4.tcp_congestion_control – it should show bbr.
  4. Increase the send/receive buffer sizes. OpenVPN's default buffers can be too small. In the same sysctl.conf, add:
    net.core.rmem_max = 67108864
    net.core.wmem_max = 67108864
    net.ipv4.tcp_rmem = 4096 87380 33554432
    net.ipv4.tcp_wmem = 4096 65536 33554432
    Apply with sysctl -p.
  5. Optimize OpenVPN server config. Edit your server config (usually /etc/openvpn/server.conf). Add or modify these lines:
    sndbuf 0
    rcvbuf 0
    tun-mtu 1500
    mssfix 1450
    cipher AES-256-GCM
    auth SHA256
    fast-io
    sndbuf 0 and rcvbuf 0 let the OS handle buffers. fast-io uses a faster UDP path (only works if you're using UDP, which is default). If you're using TCP, remove fast-io.
  6. Switch to UDP if you're using TCP. OpenVPN over TCP has extra overhead. In your server config, ensure you have proto udp (instead of proto tcp). On the client, match with proto udp. UDP is almost always faster for VPNs.
  7. Check MTU and MSS clamping. If you see packet fragmentation or connection drops, add mssfix 1450 and tun-mtu 1500 (already in step 5). This prevents MTU issues that silently slow down transfers.
  8. Restart OpenVPN and test. After changes, restart the service: systemctl restart openvpn@server (or service openvpn restart). Reconnect your client and run the same speed test as in step 1. Compare results.
  9. Consider using a faster cipher. If your VPS CPU is old, AES-256-GCM might be slow. Try cipher AES-128-GCM – it's still secure and faster on hardware without AES-NI. You can also test cipher CHACHA20-POLY1305 if both server and client support it.
  10. Check for CPU bottlenecks. If your VPS has only 1 vCPU, encryption can max it out. Run top while a speed test is running. If the CPU is at 100%, consider upgrading the VPS or using a lighter cipher (like AES-128-GCM).

Common Mistakes

  • Using TCP when UDP is available. TCP adds retransmission overhead, which is especially bad on lossy connections.
  • Forgetting to restart OpenVPN after config changes. Many settings only take effect on restart.
  • Setting fixed buffer sizes too small. sndbuf 0 and rcvbuf 0 are usually better than fixed values like 65536.
  • Ignoring the VPS provider's bandwidth cap. Some budget VPS plans are limited to 100 Mbps or less, regardless of your settings.
  • Not testing without the VPN. If your raw internet is slow, no VPN tweak will help.

Tips

  • Use a VPS with a CPU that supports AES-NI (most modern Intel/AMD do). Check with grep aes /proc/cpuinfo – if you see aes, you're good.
  • Place your VPS geographically close to you to reduce latency, which often improves throughput.
  • If you're on Wi-Fi, test over ethernet to rule out wireless interference.
  • Consider using the tun-mtu 1500 with mssfix 1450 – this is a common, safe combination.
  • Update OpenVPN to the latest version – performance improvements are frequently added.

Troubleshooting

  • Connection drops after changes: Revert the config changes one by one to isolate the culprit. Check the OpenVPN log (journalctl -u openvpn@server or /var/log/openvpn.log) for errors.
  • No speed improvement: Run iperf3 again to see if the raw throughput is the limit. If it is, no OpenVPN setting will help.
  • CPU at 100%: Try a lighter cipher (AES-128-GCM) or disable compression (comp-lzo no). Compression can actually slow things down on modern CPUs.
  • MTU-related issues (packet loss, stalls): Try lowering mssfix to 1400 or 1360. Test with ping -M do -s 1472 your_vps_ip to find the max MTU.
  • BBR not available: Your kernel might be too old. Update the VPS OS or install a newer kernel if possible.

Frequently Asked Questions

Why is my OpenVPN slow even though my VPS has gigabit internet?

Common reasons: single-threaded CPU bottleneck (encryption), TCP overhead, small buffers, or the VPS provider's actual bandwidth cap. Check with iperf3 first.

Should I use UDP or TCP for OpenVPN?

UDP is almost always faster because it avoids TCP's retransmission and congestion control overhead. Use UDP unless you're on a network that blocks it.

Does the cipher matter for speed?

Yes. AES-256-GCM is fast on CPUs with AES-NI, but on older CPUs, AES-128-GCM or CHACHA20-POLY1305 can be faster. Test to see which works best.

What is the best MTU setting for OpenVPN?

For most setups, tun-mtu 1500 with mssfix 1450 works well. If you have issues, lower mssfix to 1400.

Can I speed up OpenVPN by using compression?

Usually not. Compression adds CPU overhead and can actually reduce speed on modern hardware and already-compressed data (like video). It's best to leave it off.

Do I need to change anything on the client side?

Yes, ensure the client config matches the server's protocol (UDP/TCP) and cipher. Also, on the client, you can add sndbuf 0 and rcvbuf 0 to the client config to let the OS handle buffers.