We would like to resolve an issue of commonly having "Authenticate/Decrypt packet error: bad packet ID (may be a replay)" messages.
We believe the underlying cause is that we have three load-balancing Internet-facing routers at the OpenVPN client site. Presumably the client's public IP address changes, the server somehow continues service but the UDP packet stream arriving at the client is disrupted.
Research suggests the solution is to configure the client's replay-window to suit the characteristics of the network and the value to use can be determined by running with verb to 4 to get "Replay-window backtrack occurred [x]" messages.
The client's config was changed and openvpn restarted using SIGUSR1 which seems to have worked. From the log:
SIGUSR1[soft,ping-restart] received, process restarting
Restart pause, 2 second(s)
After two days of running with verb 4, we still have plenty of "Authenticate/Decrypt packet error: bad packet ID (may be a replay)" messages but not a single "Replay-window backtrack occurred [x]" message.
Versions and configurations ...
Client running OpenVPN 2.1.3 on Debian 6.0.6 with this config:
client
dev tun
proto udp
remote XXX 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca /etc/openvpn/XXX/ca.crt
cert /etc/openvpn/XXX/XXX.crt
key /etc/openvpn/XXX/XXX.key
tls-auth /etc/openvpn/XXX/ta.key 1
ns-cert-type server
comp-lzo
verb 4
explicit-exit-notify 2
mssfix 1541
Server running OpenVPN 2.1.3 on Debian 6.0.6 with this config
port 1194 #Use this port for OpenVPN
proto udp #Use UDP protocol
mssfix 1400
dev tun #Use network routing
ca /etc/openvpn/keys/ca.crt #Full path to main certificate file
cert /etc/openvpn/keys/server.crt #Full path to server certificate
key /etc/openvpn/keys/server.key #and key files
dh /etc/openvpn/keys/dh1024.pem #Full path to Diffie Hellman file
tls-auth /etc/openvpn/keys/ta.key 0 #Full path to TLS key file
server 10.42.0.0 255.255.0.0 #Specify the virtual network address range and netmask
route 10.42.5.0 255.255.255.0
route 10.42.23.0 255.255.255.0
topology subnet
client-config-dir ccd #Push specific IPs to clients;
route 10.42.0.0 255.255.255.252 #see section 14 below
push "dhcp-option WINS 10.42.0.137"
push "dhcp-option NBT 8"
client-to-client #Enable the VPN clients to see each other
keepalive 10 120
comp-lzo #Enable compression
user nobody #On UNIX systems, that will strip the
group nogroup #OpenVPN daemon from root access after launch for improved security
persist-key
persist-tun
ifconfig-pool-linear
status openvpn-status.log
log /var/log/openvpn.log
verb 1