
With nothing to send WireGuard says nothing. That saves power and hides it, but NAT routers forget it.
Perhaps the most copied and least understood line. One sentence: it is about others finding me, not about me getting out.
NAT forgets
A home router notes a temporary port for each UDP flow and deletes it when it is quiet, often after about 30 seconds. After that nothing can come in. An empty packet every 25 seconds is just in time.

Do you need it?
| Case | Add it? |
|---|---|
| Behind NAT and others must reach it | Yes |
| The box at home you reach from outside | Yes |
| A phone that only connects out | No |
| A server with a public IP | No |
| Public IPs on both sides | No |
Write it only on the side behind NAT.
Battery
An empty packet is tiny, under 1 MB a day. The cost is waking: an idle phone's radio must wake every 25 seconds. If nothing needs to reach the phone, leave it out.
- Nobody connects to itDelete the line
- You want pushes from homeKeep it, or try 60
- Only at workUse on-demand instead

Why not 60
Some routers forget after 30 seconds, and 60 works only now and then. 25 is the value from the official documentation that suits most NATs.
An example
A small machine sits behind a router without a forward; a VPS has a public address. The machine sends first, and the router notes: inside 192.168.1.20:51820 is outside port 40123 towards the VPS. Answers to 40123 find their way. After a minute without traffic the router deletes the note. Now you connect from outside, the VPS sends to 40123, and the router drops it: "it worked a moment ago". An empty packet every 25 seconds keeps the note alive.
Where to write it
On the side behind NAT that must be found, in the [Peer] that points to the public side.
[Peer]
PublicKey = vps-public-key
Endpoint = vps-address:51820
AllowedIPs = 10.8.0.0/24
PersistentKeepalive = 25The VPS does not need it.
Who does not need it
Phones above all. You open the NAS from the phone, so the phone sends first and the note is made on the spot. Only if something at home must reach the phone is it needed. Laptops are alike; a desktop you connect to remotely does need it.
How long does my router remember
sleep 30; ping -c1 10.8.0.2
sleep 60; ping -c1 10.8.0.2
sleep 120; ping -c1 10.8.0.2Let the machine send one packet first. The note was deleted before the first failure. Home routers keep it 30 seconds to 3 minutes. With three minutes, 60 is enough and wakes a phone half as often.
Battery
A keepalive is under a hundred bytes; three thousand a day are a few hundred KB. The cost is waking the radio, which needs seconds to sleep again. Every 25 seconds it hardly sleeps at all, and a few percent overnight is normal.
Other keepalives
| Name | Layer | For |
|---|---|---|
| PersistentKeepalive | WireGuard | The NAT note |
| TCP keepalive | Connections inside | Noticing the other end is gone |
| ServerAliveInterval | SSH | Not losing the session |
If the tunnel is up and SSH still drops, it is the last two.
Is 1 more stable?
No. More battery and more visible.
Still dropping?
It may not be NAT. If the handshake in wg show is over three minutes old, see no handshake.
Both behind NAT, both 25?
No; neither can be found first. Forward a port on one or add a relay.
The counters move by themselves?
Yes, that is the keepalive.
What is 0?
Off, the same as leaving it out.


