I just reinstalled zig after not using it a while (also on a newer pc), But when i run any zig commands my DNS seems to stop working. In the cmd i can do ping 8.8.8.8 but no internet otherwise. Ping google.com fails, browsers stop working etc. after a restart it is totally fine until i run anything zig related. I am using the latest stable version and am on win11, installed with winget.
I also remember having some kind of similar issue when I used it before but it was less common, so I never looked into it. (around v0.14.x)
zig installation must be unrelated to your problem.
In case that DNS fails (since pinging by name does not work but by ip works) try to diagnose the problem by running nslookup google.com. The answer includes the name server that responds and its answer.
You can also ask to get a result from the working 8.8.8.8 server:
❯ nslookup google.com 8.8.8.8
Server: dns.google
Address: 8.8.8.8
Non-authoritative answer:
Name: google.com
Addresses: 2a00:1450:4017:80d::200e
142.250.187.110
I tried a bit more and for now it looks like a problem with ipv6 but not sure why it is only zig seems to break it even more. bc nslookup also does not work after a restart (with 8.8.8.8 does work). This might be a problem from the router / my pc but i never get any problems with it anywhere else. But somehow if i run anything zig related my entire internet breaks, ping seems to work this time, but anything else like browsers, curl, nslookup with 8.8.8.8 all break.
It is also a bit delayed. So after (for ex: zig run …, even if it fails) i still get a bit of internet but it slows. And after a few seconds all internet is gone.
Only thing that makes remote sense is the zig code you are running, not the zig program itself. If your code does something with networking, I’d say investigate how windows and your code handles stuff, cleanup etc. If not, Focus on the OS itself, and a network stack. Disable Ipv6 if not using and other stuff
i just did zig init so it is the default code it generates. Ill try to look a bit more into what it does to check what might be crashing but idk. (i think zig init also broke my internet lol)
I disabled IPV6 on my pc and i remade the project. (so ran zig init / zig build run, etc) and now it seems to have fixed itself. I guess it is a problem with my drivers or the router but, still weird only zig triggers the problem. (i have ethernet on student housing so prob the router that is rll old and never updated).