Battery drain and VPN disconnects during screen lock: test them separately
If the connection stays active after you lock the screen but the battery drains quickly, check scheduled updates, node health checks, and network reconnects. If the VPN indicator disappears while the screen is locked, or the connection returns only when you reopen the app, note when it disconnects and check whether that coincides with battery-saving behavior, a network change, or another VPN starting. Lifting background restrictions may stabilize the connection, but it can also allow frequent background requests to keep running.
- Run a controlled standby test. Stay in the same place, use the same Wi-Fi network, and keep Low Power Mode, screen settings, and other background tasks unchanged. Lock the screen for 60 minutes with the VPN disconnected, then repeat with it connected. Record the starting and ending battery levels, VPN status, and client log timestamps. Don’t charge the phone or run speed tests or cloud backups during the test.
- Compare disconnects with request timestamps. If the logs show node tests every five minutes, check the health-check interval first. If you see clusters of DNS timeouts or connection failures, investigate the network and nodes. A rule download or health check immediately after connecting doesn’t represent activity over the entire standby period.
- Change one setting at a time. For example, increase the health-check interval, retest, then adjust DNS if needed. If the battery indicator only shows whole percentages, a one-point difference in a single test isn’t enough to judge the result. Repeat each test twice or extend it to two hours.
Compare the app’s share of battery usage in system settings with the phone’s actual battery drain. For example, if the battery drops from 80% to 76% and one app tops the list, that doesn’t mean the app alone used four percentage points. System stats may not clearly separate network extensions, system network activity, and the client interface.
Rule updates, subscription refreshes, and node health checks
These three tasks run on separate schedules. The client usually handles subscription refreshes by fetching the entire configuration again. Rule updates download a specific rule file, while node health checks send requests to test nodes. Changing the subscription refresh interval won’t stop the core from checking nodes or change the rule update interval.
| Background task | Where to check | Suggested starting point |
|---|---|---|
| Subscription refresh | The client’s subscription or configuration details | If supported, start with every 24 hours. You can still update manually when needed. |
| HTTP rule provider updates | The interval for the relevant rule provider under mihomo’s rule-providers | For rule sets that rarely change, increase the interval from 3600 to 86400 seconds. |
| Node health checks | The interval for an automatic URL-test group, or health-check.interval for a proxy provider | Once you’ve identified what’s running the checks, try increasing the interval from 300 to 900 seconds. |
Before making changes, check whether the software uses the original Clash, mihomo (formerly Clash Meta), or another implementation that supports only some Clash configuration formats. The YAML fields below use mihomo as an example; being able to import YAML into a subscription manager doesn’t mean every field will take effect. When changing an HTTP rule provider, edit only the existing interval entry, leaving the URL, rule behavior, and file path unchanged. If the client supports local overrides, make the change there first, then refresh the subscription and confirm the value hasn’t been overwritten.
Troubleshooting DNS timeouts and network changes
Prioritize DNS troubleshooting when logs repeatedly show resolution timeouts, upstream failures, or repeated queries for the same domain—not simply because your configuration uses encrypted DNS. In mihomo, dns.nameserver is one of the upstreams used for regular queries. With policies such as nameserver-policy, specific domains may use a different route. So a successful test of one upstream doesn’t prove that failed requests actually used it.
- Test both networks separately. Use the same node and a familiar domain, reconnect once over Wi-Fi and once over cellular, then compare the logs by timestamp. If timeouts occur on only one network, test a replacement for the upstream used by that configuration. Don’t change the node and routing mode at the same time.
- Distinguish the proxy server’s hostname from the websites you visit. If the client can’t connect to the proxy server after a network change, determine whether the server hostname failed to resolve or resolved successfully but the connection failed. With mihomo, check
proxy-server-nameserverseparately if it’s configured. Changing the regularnameservermay not affect this lookup path. - Keep the original configuration for comparison. After making a change, reload the configuration and confirm that regular websites, frequently used apps, and services that rely on local DNS still work. Then repeat the screen-lock test. If a domain that worked before stops resolving, revert the DNS change you just made.
fake-ip is a way for the core to map domains to addresses, not a battery-saving switch. You don’t need to replace encrypted DNS with plaintext across the board, either: a reliably reachable upstream and one that repeatedly times out or reconnects can cause different levels of background activity, regardless of protocol name. If the logs show repeated reconnects only when switching between Wi-Fi and cellular, compare standby results on a stable network separately from results during your commute.
Android: relax background restrictions only if the VPN disconnects while locked
On a Pixel running Android 14, go to Settings → Apps → See all apps → select the client → App battery usage to review background usage and battery optimization options. Menu names vary by Android version and manufacturer. You can also long-press the app icon, open App info, and look for battery settings. Usually, leave the app optimized. Only try Unrestricted, or an equivalent option, for that client if you can reproduce screen-lock disconnects and have ruled out node and network issues.
- Connect over a stable Wi-Fi network and lock the screen for 30 minutes. After unlocking, check the system VPN indicator before opening the client to review its logs. This helps avoid a reconnect triggered by reopening the app from masking the disconnect.
- If the system needs to keep the VPN connected, go to Settings → Network & internet → VPN on a Pixel and tap the settings icon beside the relevant VPN. Check whether the app supports Always-on VPN. This controls whether Android tries to keep the VPN active; it’s separate from the app’s battery optimization settings.
- Don’t enable Block connections without VPN just to keep the VPN alive. This setting blocks traffic that doesn’t go through the VPN, so your phone may temporarily lose network access if the tunnel isn’t ready. Enable it based on your traffic protection requirements, not battery drain.
If the VPN indicator is still visible but websites won’t load, troubleshoot the connection or DNS errors rather than assuming the system stopped the background process. If the VPN still disconnects under the same conditions after you set the app to Unrestricted, restore the original battery setting. Then check whether another VPN is replacing the client or whether the disconnect happens only during network changes.
iOS: check On Demand settings instead of using Android-style battery exemptions
On iOS 18, go to Settings → General → VPN & Device Management → VPN to view existing configurations. If the configuration details or client provide a Connect On Demand option, it controls whether the VPN connects automatically under the configured conditions. If it reconnects after you disconnect it manually, check this setting before treating the behavior as a failed manual disconnect. For work- or school-managed configurations, check with the administrator before removing anything.
Settings → General → Background App Refresh controls app background refresh, not a whitelist that keeps VPN tunnels alive. A client using Network Extension can run its network extension through the system; leaving the app doesn’t mean the tunnel has stopped. During testing, check Low Power Mode in Settings → Battery and keep it consistent across both tests. Don’t repeatedly force-quit the app to determine whether the tunnel is running.
- Connect only when needed: If the client allows it, turn off Connect On Demand, disconnect manually when finished, and check the status on the system VPN screen. This works if no apps need the tunnel to stay connected.
- Keep the VPN connected: Leave necessary On Demand rules in place. First run a standby comparison on stable Wi-Fi, then test reconnection separately when switching from Wi-Fi to cellular. If the problem occurs only during network changes, troubleshoot that transition instead of removing existing routing rules.
Verify the changes with connection status and standby logs
For each retest, record the client and core versions, network type, whether Connect On Demand is enabled, the intervals before and after the change, battery levels at the start and end of standby, and the number of disconnects. Keep the change if longer intervals reduce scheduled requests in the logs while your usual apps still connect normally. If battery life seems better but the connection becomes unavailable while the screen is locked, undo the change that caused the disconnect. If both tests show high battery drain, check system battery usage and cellular signal instead of repeatedly changing Clash settings.
To investigate further, start with common connection problems. If you’re unsure whether a setting belongs to the client or the core, check the configuration reference. When sharing logs, keep timestamps, timeout types, and network change records, but remove subscription links, node addresses, and credentials first.