On this page
When it drops, and why
“Disconnects, but the internet is fine” is the usual case: the internet works, the path to the server or the protocol doesn't. Start from the moment of the drop.
When you go from Wi-Fi to mobile data, or between access points
Likely causeThe network changed under the tunnel
What to doTurn on reconnect after a drop; on Android, Always-on VPN too
Every few minutes while nothing is going on
Likely causeThe router or the operator forgot the UDP mapping of WireGuard, AmneziaWG or Hysteria2
What to doKeepalive:
PersistentKeepalive = 25in WireGuardOn the phone, a while after the screen goes off
Likely causeA battery saver stopped the VPN app
What to doRemove battery limits for the VPN app
A minute or a few after connecting, or when a big download starts
Likely causeThe network recognises the protocol and cuts it or freezes it
What to doAnother protocol or port
When a second device connects with the same config
Likely causeTwo devices with one key push each other off the server
What to doA separate key or config for each device
Big pages and downloads hang, small things work
Likely causePackets are too large for this network (MTU)
What to doLower the MTU, for WireGuard
MTU = 1280At about the same time every day
Likely causeThe provider renews your address or the router restarts
What to doNothing in the VPN: reconnect after a drop covers it
Only on one Wi-Fi: a hotel, an office, a café
Likely causeThe network blocks VPNs or wants its sign-in page again
What to doSign in on the network's page; if it still drops, another protocol
After sleep
Likely causeThe tunnel's connections died while the machine slept
What to doSee the guide on VPN after sleep
The causes in more detail
- The network changes. Moving from Wi-Fi to mobile data, or between two access points, gives the device a new address. A client that doesn't notice keeps sending into the old network. It lasts a few seconds if the client reconnects by itself, and forever if it doesn't.
- The router forgets idle UDP. Home routers and mobile operators keep a UDP mapping only for a short while without traffic, often from half a minute to a few minutes. WireGuard is silent when nothing is sent, so the next packet after a pause may not get back to you.
- The phone saves battery. Android's Doze and the brands' own battery savers stop apps in the background, and a VPN app is one of them. On some phones that happens within minutes of the screen going off.
- The network cuts the protocol. Where VPNs are filtered, a connection can be reset after a minute, or frozen once more data has gone through it. The client reconnects, the network cuts it again, and it looks like constant drops.
- One key on two devices. A WireGuard server knows one key at one address: when the second device makes a handshake, the first one loses the tunnel, and then the other way round. Panels with a limit on devices or addresses cut the extra connection too.
- Packets are too big. If the tunnel's MTU is larger than the network carries, small requests pass and large ones are lost. Pages half-load, downloads hang, and the client may decide the tunnel is dead.
- The server side. The server restarts, the subscription has run out of time or traffic, or the panel limits the number of connections.
- Two VPNs at once. Two VPN apps fight over routes and the system's VPN slot: on Android, starting a second one stops the first.
What helps
- 1
Turn on reconnect after a drop
Most clients can bring the tunnel back by themselves. The most useful kind also checks that traffic really flows, because a tunnel can be up and carry nothing.
- 2
Add keepalive to UDP protocols
In a WireGuard or AmneziaWG config,
PersistentKeepalive = 25in[Peer]sends a tiny packet every 25 seconds of silence, and the router keeps the path open. - 3
Remove the battery limits on the phone
Settings → Apps → the VPN app → Battery: Unrestricted (names differ between brands). Then Settings → Network & internet → VPN → the gear next to the app → Always-on VPN: the system restarts the VPN by itself.
- 4
One key per device
Make a separate key, profile or config for each phone and computer. On your own server this is a new user or key; with a provider, check how many devices the subscription allows.
- 5
Change the protocol where the network cuts
If drops start a minute after connecting or on big downloads, the network is cutting this protocol. Try one that disguises itself as ordinary HTTPS, such as VLESS with Reality, or one over UDP (Hysteria2), whichever the network leaves alone.
- 6
Lower the MTU
For WireGuard and AmneziaWG,
MTU = 1280in[Interface]fits almost any network, mobile data included. It costs a little speed, and the drops on big pages go away. - 7
Keep one VPN
Turn off or remove other VPN apps and proxy extensions in the browser.
Find the moment and the cause
Keep a ping to the VPN server's address running with times on it. If pings stop at the same moments the VPN drops, it is your network or the path to the server. If they carry on while the VPN drops, the network is cutting the protocol, or the app is being stopped.
ping.exe -t vpn.example.com | ForEach-Object { "{0:HH:mm:ss} {1}" -f (Get-Date), $_ }Every line gets a time. Request timed out in a row means the path to the server went away. Ctrl+C stops it.
Get-WinEvent -LogName 'Microsoft-Windows-NetworkProfile/Operational' -MaxEvents 10 | Format-List TimeCreated, Id, MessageWhen Windows lost and found the network: 10001 is disconnected, 10000 is connected. If these times match the VPN's drops, the cause is the network.
netsh wlan show wlanreportA report on Wi-Fi drops over the last days; the path to the HTML file is in the answer.
ping vpn.example.com | while read l; do echo "$(date +%T) $l"; doneThe same ping with times. Gaps in the times are the moments the path went away. Ctrl+C stops it.
journalctl -u NetworkManager --since "1 hour ago" | grep -E "state change|disconnected"When NetworkManager dropped and brought back Wi-Fi or a cable in the last hour.
Which protocols hold up on a shaky network
WireGuard and AmneziaWG keep no connection open: after a short gap or a new address they carry on with the next handshake, so a drop of a second costs about a second. Hysteria2 and TUIC also run over UDP and get back quickly, but some mobile networks and offices squeeze UDP, and there they drop more often. Protocols over TCP (VLESS, Trojan, VMess, Shadowsocks) get through where UDP is squeezed, but every drop takes the open connections with them, and apps open them again. On a network that switches a lot, UDP protocols with keepalive hold up better. On a network that squeezes UDP, TCP ones do.