yggdrasil-network / yggdrasil-go

An experiment in scalable routing as an encrypted IPv6 overlay network

Home Page:https://yggdrasil-network.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

yggdrasil does not start on Windows 10: Failed to set up TUN address: Element not found

xaozai opened this issue · comments

Build version: 0.5.1
Your public key is 6f9e764d7d403edcc922118b6f37fdfab2f9aa9e97c0db459e38bdc4454f6c66
Your IPv6 address is 201:4186:26ca:aff:48c:db77:b9d2:4320
Your IPv6 subnet is 301:4186:26ca:aff::/64
Using existing driver 0.14
Creating adapter
Connected outbound: 200:dc8:dec1:78fa:c0e9:bf19:a988:60fe@51.89.65.73:42069, source 10.0.0.4:64440
Failed to set up TUN address: Element not found.
panic: Element not found.
commented

are you using an official build? if so this sounds like it could be an issue with the wireguard tun driver for windows (wintun, i think).

can we get a full windows version?

Yes, I use the official build downloaded from github (msi installer).
Also, I already have wireguard installed and it is running (tunnel activated) at the time of launching Yggdrasil.

Win 10 21H2 (Build 19044.1415) x64

commented

Thought: is there an instance of yggdrasil already running as a system service? If so this looks like it could be failing to set the address on the interface as it would be already set up.

The system service also does not start, the same thing is written to the log.

In general, I disable the autorun of the system service and run Yggdrasil manually from the bat script. All the same.

With 0.5.2 the same problem:

2023/11/07 12:21:41 Build name: yggdrasil
2023/11/07 12:21:41 Build version: 0.5.2
2023/11/07 12:21:41 Your public key is 6f9e764d7d403edcc922118b6f37fdfab2f9aa9e97c0db459e38bdc4454f6c66
2023/11/07 12:21:41 Your IPv6 address is 201:4186:26ca:aff:48c:db77:b9d2:4320
2023/11/07 12:21:41 Your IPv6 subnet is 301:4186:26ca:aff::/64
2023/11/07 12:21:41 Using existing driver 0.14
2023/11/07 12:21:41 Creating adapter
2023/11/07 12:21:41 Connected outbound: 200:dc8:dec1:78fa:c0e9:bf19:a988:60fe@51.89.65.73:42069, source 10.0.0.4:56108
2023/11/07 12:21:41 Failed to set up TUN address: Element not found.
panic: Element not found.

goroutine 1 [running]:
main.main()
        D:/a/yggdrasil-go/yggdrasil-go/cmd/yggdrasil/main.go:265 +0x2246

The problem has been solved. Yggdrasil is now starting.
It turned out I had ipv6 disabled in the registry: \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\DisabledComponents ff

commented

wonder if it is worth checking that registry entry on startup or not.

I think checking this value would be helpful. At the very least, it would be possible to output a more understandable error message. And as an option, you can consider automatically enabling IPv6 when starting Yggdrasil...

The details are here: https://learn.microsoft.com/en-us/troubleshoot/windows-server/networking/configure-ipv6-in-windows

I think if, at the time of launching Yggdrasil, ff value is there, then you can automatically set the value there to 16 (dec) (disabling on non-nontunnel interfaces).

commented

i am of two minds on this.

  1. a daemon should not activate ipv6 if the OS has that explicitly disabled, so this should be a runtime check to bail with an intelligent error message.
  2. windows users don't read error messages and just want it to work.

i think windows defender is already pretty offended by a golang process so touching registry on runtime could be icky.