skip to content
PingTraceSSH Logo
Donate
Table of Contents

Why Your VPN Tunnel Breaks at Midnight (and How to Stop It)

It’s 11:59 PM. You’re brushing your teeth. Ping.
The monitoring system lights up: VPN tunnel down.

If this happens every night at midnight, you’re not cursed—it’s timers, certificates, or clocks conspiring against you.

This article breaks down why VPN tunnels (IPsec/IKE) often fail at predictable times like midnight, how to diagnose the root cause, and what you can do to make sure you never lose sleep over a rekey again.


The Midnight Pattern

Why midnight? Because humans love round numbers.

  • Security admins configure 24-hour lifetimes.
  • Certificate management systems often issue certs tied to calendar days.
  • Cron jobs and automated scripts default to midnight.

So when the stars align (bad timers + sloppy configs + NTP drift), tunnels predictably fail just as you’re clocking out.


The Usual Suspects

1. IKE Security Association (SA) Lifetime

  • By default, many firewalls/vendors use a 24-hour Phase 1 (IKE SA) lifetime.
  • If two peers negotiate different timers, the rekey will fail at expiration.
  • Rekeys often happen right around midnight if the SA was established the day before at that time.

Example (Palo Alto default):

IKEv2 SA lifetime: 28800 seconds (8 hours)
IPSec SA lifetime: 3600 seconds (1 hour)