OpenVPN Site-to-Site Setup Guide (When WireGuard Fails)
Why this exists: WireGuard runs the rest of our multi-site mesh, but one location's ISP was quietly rate-limiting or blocking UDP after periods of inactivity — the handshake would complete, traffic would flow for 20-30 minutes, then silently die. OpenVPN over TCP port 443 solved it. Here's the full two-day path to a working setup, every error included.
WireGuard gets all the attention these days — fast, modern, built into the Linux kernel. We use it for most of our locations. But one site's residential-grade connection kept dropping WireGuard's UDP handshake after 6+ minutes of idle time despite a 25-second persistent keepalive. Running WireGuard over TCP via udp2raw worked but added 30ms latency and real complexity. OpenVPN's native TCP/443 mode was the cleaner answer: every ISP on earth allows outbound TCP 443, because blocking it breaks all HTTPS traffic.
Need Site-to-Site VPN Setup?
Need help? Connect on WhatsApp 👉 wa.link/uw9n3f
Or ask on website chat for freelancer support.
The Tradeoff, Stated Plainly
TCP-over-TCP double encapsulation causes latency spikes under packet loss — the outer TCP retransmits, which delays the inner TCP's own recovery. For a link that already has elevated latency and occasional loss, that's an acceptable tradeoff in exchange for a connection that simply doesn't get silently blocked.
ScenarioRecommendation
ISP blocks or rate-limits UDPOpenVPN over TCP/443
Client has a dynamic IP, no DDNSOpenVPN — client always connects outbound
Maximum throughput / minimum latency priorityWireGuard
Embedded routers (MikroTik, OpenWRT)WireGuard — built in, no extra package
20+ clients, need PKI-style managementOpenVPN scales better here
Server Setup — the PKI Trap
The first hour was lost to outdated tutorials using the easy-rsa 2.x workflow, which doesn't exist anymore in easy-rsa 3.x:
# OLD — fails on modern Debian/Ubuntu
source /usr/share/easy-rsa/vars # bash: No such file or directory
./build-ca # command doesn't exist in v3
# CORRECT — easy-rsa 3.x
make-cadir /etc/openvpn/easy-rsa
cd /etc/openvpn/easy-rsa
./easyrsa init-pki
./easyrsa build-ca nopass
./easyrsa build-server-full server nopass
./easyrsa gen-dh
openvpn --genkey secret /etc/openvpn/ta.key
Diffie-Hellman generation over SSH is a trap of its own — it can run 5-8 minutes, and an idle SSH timeout mid-generation leaves a corrupted, undersized dh.pem (812 bytes of garbage instead of the correct ~424). Run it inside screen or tmux so a dropped connection doesn't kill it.
IP Forwarding and NAT — Where Two Hours Went
The tunnel came up, the client got its IP, but nothing beyond the tunnel itself was reachable. The checklist that actually found it:
# 1. Is forwarding even enabled on the server?
cat /proc/sys/net/ipv4/ip_forward # 0 = disabled, this is the first thing to check
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.d/99-vpn.conf
# 2. Does the LAN side know how to route back to the tunnel subnet?
# Two options: NAT masquerade on the OpenVPN server (usually simpler),
# or an explicit route on the LAN router pointing the tunnel subnet
# back through the OpenVPN server.
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
iptables -A FORWARD -i tun0 -j ACCEPT
iptables -A FORWARD -o tun0 -j ACCEPT
Without the masquerade, LAN devices see traffic arrive from the tunnel subnet, have no route back to it, and send replies to their default gateway instead — the request looks fine on the client side, the reply just never arrives.
Client Certificates: One Silent Failure Mode
A TLS handshake that fails with no useful client-side error is almost always a server log problem, not a client one:
tail -f /var/log/openvpn/server.log
# TLS_ERROR: BIO read tls_read_plaintext error
# TLS Error: TLS handshake failed
In this case the client config used verify-x509-name "server" name but the server certificate's actual common name didn't match. The faster, more portable fix: drop the exact-name check in favor of remote-cert-tls server, which just confirms it's a server certificate, not a specific name.
Two Clients Fighting Over the Same Routes
With more than one client connected (an India endpoint plus a LAN-side gateway VM), the server was pushing both clients the same routes, which created a routing loop — traffic destined for one client's LAN was being routed back through the other client's tunnel. The fix is client-config-dir (CCD), giving each client its own specific routes instead of one global push:
mkdir /etc/openvpn/ccd
# This client's own LAN is reachable via this tunnel
cat > /etc/openvpn/ccd/india-client /etc/openvpn/ccd/ovh-gateway