netbirdio / netbird

Connect your devices into a secure WireGuard®-based overlay network with SSO, MFA and granular access controls.
https://netbird.io
BSD 3-Clause "New" or "Revised" License
10.52k stars 472 forks source link

High battery usage #1354

Open Pounii25 opened 9 months ago

Pounii25 commented 9 months ago

I tryed every type of battery profile I have on my Android 13 device but the consumption is very high despite the real usage is close to nothing (under 40 Mb data in the entire month, can't get the day but sure less)

My set up is simple: A peer (as root peer) on my HomeLab, another peer which is my Android phone. I also have custom dns pointing on the route peer but just for my internal domain (seems working fine)

I let the peer connected all the day, at the the end of it the consumption just for the app is more than 30%

My device:

Asus Zenfone 9 Android 13

Screenshot_20231204-202943_Settings.jpg

Screenshot_20231204-203000_Settings.jpg

Ginner commented 9 months ago

Might be related to my issue here: #1140. Do you know if you're changing networks?

Pounii25 commented 9 months ago

Might be related to my issue here: #1140. Do you know if you're changing networks?

Do you mean If I change the provider 5g antenna during the day?

pappz commented 9 months ago

Hi @Pounii25! Could you take a test without DNS settings? I would like to localize the root cause of the issue.

Pounii25 commented 9 months ago

Sure! ok now I have disable the DNS forward to my rooting peer. I let the routes enabled, so you can test it separately. I will report here the consumption.

Pounii25 commented 9 months ago

ok after more than 2 hours I can tell you that without DNS forward there is no battery drain at all.

Ginner commented 9 months ago

Might be related to my issue here: #1140. Do you know if you're changing networks?

Do you mean If I change the provider 5g antenna during the day?

I get a similar issue (battery drain and phone getting hot) when changing from WiFi to 4g and vice versa, from there on the battery drain will continue until I either logout/login or restart the app. So I meant switching network 'type'.

pappz commented 9 months ago

@Pounii25 Thank you for the tests. You said created a DNS setting "just for my internal domain". Could you give me more details about this setting? I would like to setup something similar.

Pounii25 commented 9 months ago

Might be related to my issue here: #1140. Do you know if you're changing networks?

Do you mean If I change the provider 5g antenna during the day?

I get a similar issue (battery drain and phone getting hot) when changing from WiFi to 4g and vice versa, from there on the battery drain will continue until I either logout/login or restart the app. So I meant switching network 'type'.

I didn't note that just because i had battery drain all the time, so i can't tell if also swap network can cause it. But I can tell that I note ( but i'm not sure) when you swap from 4g to wifi not all time the vpn still up and working property, maybe is related to what you're talking.

Pounii25 commented 9 months ago

@Pounii25 Thank you for the tests. You said created a DNS setting "just for my internal domain". Could you give me more details about this setting? I would like to setup something similar.

Sure! So, i set the peer in my homelab as routing peer with a specific network range "192.168.8.0/24", then i test with my phone if any call to my internal service ( example 192.168.8.3) was working and it was fine. Then, in my local pi-hole I set some static DNS name for my service (they all point to a reverse proxy for local certificates), in this way i dont have to remember and write every time IP for my service. Last step I set in netbird manager a specific DNS server in my lab, for example 192.168.8.10 and limited it only for a specifi domain, like "private.local". And that is all I've done.

Pounii25 commented 8 months ago

an update: I made some change in my host VM where is running my DNS service. Seems like I was creating a loop (even the dns resolution was effectively working fine). I will monitor for a couple of days, just to be sure.

update: ok I think I got the real problem, a brief introduction to my environment: I have like more or less 10 apps selfhosted behind a proxy (caddy). One of them (Home Assistant) is implemented but turned off because non in usage yet ( my desire to do things right led me to implement it completely before I needed it). Here the point: I have the app on the phone, configured to point on my environment. I note thousands of queries for that in 1 day!! I find it interesting that if I don't have Netbird turned on, I don't suffer from battery drain. It makes me think that if there wasn't a proxy involved, there wouldn't be this problem. Interesting as a dynamic, because it is a fairly common pattern in homelabs.

Update: the issue persist.

j007bond007 commented 7 months ago

It seems like this could be related to a few things. I've experienced this as well and I have a few suspected causes: