I have a MacBook Pro 2017 running macOS 10.14.3.
In my home I have a WiFi router which multiple devices connect to, including my MacBook. Recently for some reason my MacBook has been having trouble connect to it. When I manually select the network in the WiFi menu, it tries to connect to it for a few seconds and then fails with the helpful error message "Unable to connect, try moving closer" (or something like that) with no additional error information about what exactly the issue is.
After numerous attempts, it eventually manages to connect to the network but running
ping 192.168.1.1 (my router's IP) or
ping google.com, most of the packets time out or take 1s to reply.
Moving closer to the router does not fix the problem.
Other devices (e.g. my iPhone) can connect and work fine.
I can connect to my iPhone via hotspot, but the network performance is more or less the same.
pings are terrible, even though browsing the web using mobile data on my iPhone works well.
I have Windows 10 installed via Boot Camp on my machine too. If I reboot into Windows, it connects fine and ping works great. So this leads me to believe that there is something wrong with macOS that is causing this issue.
I understand this is probably one of those questions that can't easily be solved since it could be any number of things that is causing the problem, but can anyone suggest things I can try to diagnose the issue? Can I "reset" the network stack somehow?