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.57k stars 473 forks source link

Windows client connection breaks every ten seconds because of a detected network change #2395

Closed trgaming closed 2 weeks ago

trgaming commented 1 month ago

Describe the problem

The connection from a Windows client is not working properly. The client connects and soon after looses its connection because of a detected network change.

Expected behavior

The wrong network change is not detected.

Are you using NetBird Cloud?

selfhosted

NetBird version

0.28.7

Additional context

The connections gets broken because a network change is detected. The interface "LAN-Verbindung* 3" is the Microsoft Wi-Fi Direct Virtual Adapter which is repsonsible for wifi sharing. I do not understand why Netbird detects this interface for the gateway 10.0.0.1.

I tried to uninstall this interface and then the connnection works perfectly fine but windows installs this device again at the next startup.

netbird up --network-monitor=false solves the problem as well.

route print output: Schnittstellenliste 13...30 e1 71 27 6a f2 ......Realtek PCIe FE Family Controller #2 2...2a 56 5a 44 66 1b ......Microsoft Wi-Fi Direct Virtual Adapter 4...28 56 5a 44 66 1b ......Microsoft Wi-Fi Direct Virtual Adapter #2 17...28 56 5a 44 66 1b ......Realtek RTL8723BE 802.11 bgn Wi-Fi Adapter 1...........................Software Loopback Interface 1

2024-08-05T21:52:24+02:00 DEBG [nameservers: [{100.123.250.18 udp 53}]] client/internal/dns/server.go:548: reactivate temporary disabled nameserver group 2024-08-05T21:52:24+02:00 INFO client/internal/dns/host_windows.go:111: configured 100.123.255.254:53 as main DNS forwarder for this peer 2024-08-05T21:52:24+02:00 INFO client/internal/dns/host_windows.go:149: added 1 match domains to the state. Domain list: [.intern.anon-cjTcc.domain] 2024-08-05T21:52:24+02:00 INFO client/internal/dns/host_windows.go:176: updated the search domains in the registry with 1 domains. Domain list: [intern.anon-cjTcc.domain] 2024-08-05T21:52:25+02:00 INFO client/internal/dns/upstream.go:252: upstreams [100.123.250.18:54] are responsive again. Adding them back to system 2024-08-05T21:52:25+02:00 DEBG [nameservers: [{100.123.250.18 udp 54}]] client/internal/dns/server.go:548: reactivate temporary disabled nameserver group 2024-08-05T21:52:25+02:00 INFO client/internal/dns/host_windows.go:111: configured 100.123.255.254:53 as main DNS forwarder for this peer 2024-08-05T21:52:25+02:00 INFO client/internal/dns/host_windows.go:149: added 2 match domains to the state. Domain list: [.wawi-srv.anon-LiZOa.domain .intern.anon-cjTcc.domain] 2024-08-05T21:52:25+02:00 INFO client/internal/dns/host_windows.go:176: updated the search domains in the registry with 1 domains. Domain list: [intern.anon-cjTcc.domain] 2024-08-05T21:52:30+02:00 DEBG client/internal/engine.go:1429: received management probe request, healthy: true 2024-08-05T21:52:30+02:00 DEBG client/internal/engine.go:1421: received signal probe request, healthy: true 2024-08-05T21:52:31+02:00 DEBG util/net/dialer_nonios.go:114: Dialer resolved IPs for nw.anon-cjTcc.domain:3478: [{198.51.100.3 }] 2024-08-05T21:52:31+02:00 DEBG client/internal/relay/relay.go:66: stun probe received address from stun:nw.anon-cjTcc.domain:3478: 198.51.100.4:49223 2024-08-05T21:52:31+02:00 INFO client/internal/networkmonitor/monitor_windows.go:159: network monitor: default route for 10.0.0.1 (LAN-Verbindung* 3) is gone or changed 2024-08-05T21:52:32+02:00 INFO client/internal/engine.go:1520: Network monitor detected network change, restarting engine 2024-08-05T21:52:32+02:00 INFO client/internal/engine.go:252: Network monitor: stopped

lixmal commented 1 month ago

Hi @trgaming,

thanks for the report. It seems the default route that points to the virtual interface doesn't turn up when retrieving routes via the windows API, hence a change is detected. We'll work on a fix soon.

lixmal commented 3 weeks ago

Hi @trgaming, @Takalele,

can you test the network monitor change from https://github.com/netbirdio/netbird/pull/2450?

  1. Grab the binary archive from https://github.com/netbirdio/netbird/actions/runs/10459247214/artifacts/1829061085

  2. Extract windows-packages.zip

  3. netbird service stop
    netbird service uninstall
  4. Move netbird.exe from the zip archive to %PROGRAMFILES%/Netbird

  5. netbird service install
    netbird service start
    netbird down
    netbird up --network-monitor=true
trgaming commented 3 weeks ago

Hi @lixmal ,

Thanks for your reply.

I already tried to but your link gives me a 404 status from GitHub. Please check if the link is still active.

Thanks and best regards Tim

mlsmaycon commented 3 weeks ago

Hello @trgaming you can try this new build link now: https://github.com/netbirdio/netbird/actions/runs/10475047026/artifacts/1833430698

You will need to be authenticated to Github to download it.

mlsmaycon commented 3 weeks ago

@trgaming, let us know if you have had the chance to evaluate this.

Takalele commented 3 weeks ago

@lixmal @mlsmaycon

It works, the connection is stable.

netbird up --network-monitor=true
Please do the SSO login in your browser.

Connected

netbird status
OS: windows/amd64
Daemon version: 0.28.7-SNAPSHOT-4fc79ab0
CLI version: 0.28.7-SNAPSHOT-4fc79ab0
Management: Connected
Signal: Connected
Relays: 2/2 Available
Nameservers: 1/1 Available
FQDN: voyager-1.netbird.selfhosted
NetBird IP: 100.105.102.132/16
Interface type: Userspace
Quantum resistance: false
Routes: -
Peers count: 2/2 Connected

BR Takalele

mlsmaycon commented 3 weeks ago

Great, thanks for the feedback. This fix will come in the next release. From tonight.

trgaming commented 2 weeks ago

Hi @mlsmaycon, sorry, I was not able to test because I had no access to the device (it is a pc at a warehouse).

I updated to 0.28.9 and the issue seems to be gone after setting network monitor to true again.

Thanks for the quick solution.