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
11.25k stars 517 forks source link

Infinite connect on Mac M3 | error creating tun device: Interface name must be utun[0-9]* #2741

Open DyllasDek opened 1 month ago

DyllasDek commented 1 month ago

Describe the problem

Trying to connect to vpn from Mac M3 but encounter error: /var/log/netbird/client.log

2024-10-15T14:17:34+03:00 ERRO client/internal/connect.go:277: error while starting Netbird Connection Engine: create wg interface: error creating tun device: Interface name must be utun[0-9]*

To Reproduce

Steps to reproduce the behavior:

  1. Install pkg from dashboard
  2. Click on connect
  3. Log in with Oauth, see Login Successful
  4. See infinite connection in application, see error in logs

Expected behavior

Connection established

Are you using NetBird Cloud?

Self hosted Netbird

NetBird version

0.30.1 both on client and server side

Screenshots

image

Additional context

I know that for now Netbird doesn't support M3, but hope this issue will help to determine issue and add support for M3.

DyllasDek commented 1 month ago

I see how to resolve this. The problem in automatic interface name generation If you run app - it generates interface name with my MacBook name, but it should be utun[0-9]*

Changing name of the interface solves the issue, but I think that should be fixed in app to not encounter such problem in future.

image
alex-ritter commented 1 month ago

I have the same issue,

changing the name of the interface does not fix the issue for me.

mlsmaycon commented 1 month ago

Hello @alex-ritter and @DyllasDek by default the macOS client uses the correct interface name prefix. Can you clarify if you are getting the wrong name after just installing the client?

alex-ritter commented 1 month ago

Hi @mlsmaycon

Netbird I believe is selecting the right interface name (utun5) and used to work on my Mac. After updating to the new relay system all agents other then my mac fails to connect to netbird.

Netbird fails on my mac because it says that the interface is currently in use (utun5). Changing the name of the interface doesn't fix the issue. I'm tempted just to reinstall macos but this seems like a netbird issue.

alex-ritter commented 1 month ago

So I just reinstalled Mac OS. Confirmed that the default interface name is utun100 on a fresh install. Although it does work when utun is set to 100, and now I'm not getting the other issue where it says that the interface is in use.

image

Another thing that netbird needs improving on Mac OS is if there's a slightest issue with the VPN configuration within the system it is extremely hard to debug anything. Log files are extremely inaccurate and most of the time logs are not even generated. I think the Mac OS port of netbird needs another look before it can be used reliably in production cases. We can't be reinstalling Mac OS to fix issues with netbird.

I have not had any issues with netbird on Linux or Windows, I've only had issues with netbird on Mac OS after deleting the log files or modifying network settings within Mac OS for other interfaces. This could have been a issue with having multiple VPN's installed as well, I had Unifi's wifiman teleport installed to configure netbird's virtual machine on my proxmox instance to get netbird setup, and I had proton and nord vpn installed as well. But of corse I had none of these running at the same time with netbird.

I'll keep on using netbird for the next few weeks on this new install, if I find any issues I'll report back. I'm willing to contribute to netbird to help fix these issues if needed as well :)

DyllasDek commented 1 month ago

Hello @alex-ritter and @DyllasDek by default the macOS client uses the correct interface name prefix. Can you clarify if you are getting the wrong name after just installing the client?

HI! I get wrong name on fresh install. I can't reproduce error because now it stores cache. From logs I found my init interface name: failed creating tunnel interface Danila-Mac

DyllasDek commented 1 month ago

I found that it turns out that during the initial setup, I accidentally changed the name of the interface. This is my mistake, however, it seems to me that then there should be validation in the application for the interface name.

alex-ritter commented 1 month ago

Yeah Danila-Mac seems like it's a custom interface name... That should give an error 'Interface name must be utun[0-9]*'.

Seems like utun100 works for me after a fresh install of Mac OS and Netbird. Netbird on my last install started being unstable after removing the log file and config files to try to reinstall netbird during a different issue.

When I removed the log file and config files before, logs stop generating, it somehow still used the old configuration, and Netbird became extremely unstable afterwords with reinstalls not fixing either of those issues. This time i'm not touching those files because I don't want any issues lol

mlsmaycon commented 2 weeks ago

To confirm, was the change done by updating the config.json file or by the GUI advanced settings?

There is a validation when entering the name using the up command. See the example below:

maycon@Maycons-MacBook-Pro-2 [23:38:15] [~]
-> % netbird up --interface-name test11
Error: invalid interface name test11. Please use the prefix utun followed by a number on MacOS. e.g., utun1 or utun199
DyllasDek commented 2 days ago

To confirm, was the change done by updating the config.json file or by the GUI advanced settings?

There is a validation when entering the name using the up command. See the example below:

maycon@Maycons-MacBook-Pro-2 [23:38:15] [~]
-> % netbird up --interface-name test11
Error: invalid interface name test11. Please use the prefix utun followed by a number on MacOS. e.g., utun1 or utun199

The change was done by updating in the GUI advanced settings