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.91k stars 494 forks source link

Possible Network Routes Conflict #1427

Open werlitong opened 9 months ago

werlitong commented 9 months ago

Describe the problem Seems to be a routing conflict that cause network issues. I was testing netbird and saw that after add a route to 192.168.1.0/24 i've lost access to all my internal network, only gateway (my ubiquiti's router) is accessible. So, i changed from my WiFi to 5G/4G and i surprisingly recover the access. The problem wont occour if i change the route to target a specific resource in my network or if i just disable the route in netbird dashboard.

To Reproduce Steps to reproduce the behavior:

  1. Create a network route for all of your internal network subnet (masquerade enable and metric set to 9999)
  2. Try to access any resource excluding the gateway.

Expected behavior I think that the expected behavior should be routes beeing created following a priority distance. I'm not sure.

Screenshots Screenshots of command netstat -rn Route to 192.168.1.0/24:

image

Route to 192.168.1.240/32:

image
mlsmaycon commented 9 months ago

Hello @werlitong, can you confirm that your computer's local network is 192.168.1.0/24? I am not seeing the local reference for it pointing to your local network interface:

e.g., at my place, the network is 192.168.178.0/24:

image

The NetBird agent looks for this network when adding the configured route in your system's routing table. So if it is missing, that check won't find it and will think it is ok to add the incoming route.

werlitong commented 9 months ago

Yes, subnet its correct. Maybe that's the point, check the first screenshot (first post), seems like netbird replace de route from my system if there is a route to the hole subnet /24. In other words if i put my home subnet in netbird and try to access a resource with netbird up and running using my local wifi it will cause the issue.

1.Running the command with netbird disabled: image

image

2.Running the command with netbird route to a specific host in the network: image

image

3.Running the command with netbird route to the hole subnet /24:

image image
mlsmaycon commented 9 months ago

Thanks, @werlitong. We will investigate more as I cannot reproduce the case locally.

werlitong commented 9 months ago

Sure thing! If there's any other test, i'll be happy to help! Thanks!!

mlsmaycon commented 9 months ago

Actually, it would be great if you could create a route like this:

sudo route add 8.8.0.0/16 192.168.1.1

And then do the same checks again you did with your local net.

werlitong commented 9 months ago

Here it is:

image image image
werlitong commented 9 months ago

@mlsmaycon just test the new version 0.25.4 and problem seems to be fixed. Thank you!

werlitong commented 8 months ago

i've just saw that problem still occur, i thought that was solved but recently experienced the issue again.

fti7 commented 7 months ago

I have the same issue on a Windows Client. Netbird 0.26.2. Windows 10

On a freshly booted System (Route disabled in Netbird) i have an local route to my local Subnet.

When i enable the Route in Netbird. Nothing changes (Good, because local route already exists)

When i disable it again. Netbird delete the complete local route (Is there a Check Missing to only remove Routes with a Netbird GW?) When i enable it again. It adds a new Route with a Netbird Peer -> All Hosts in my Subnet are unreachable

guiguan commented 6 months ago

same here. Netbird will remove the local route with matching CIDR, and re-add Netbird one when reconnecting. This makes the local route unusable. Please only remove the route with Netbird gateway

fti7 commented 5 months ago

@mlsmaycon any update on this? can you reproduce this now? thanks

mlsmaycon commented 5 months ago

Hello, folks; we will work on this in the coming weeks. It should be in 0.28.0

fti7 commented 3 months ago

Hello, folks; we will work on this in the coming weeks. It should be in 0.28.0

any update on this? is it already fixed?

captainnx commented 2 weeks ago

it not fix now