I know the solution to this error is usually by going into your system32 and deleting the mojang parts in that one host file, but my host file doesn't even have those. Also joining servers on unmodded minecraft still work. I tried reparing the profile, repairing curseforge installation, and uninstalling/reinstalling with no success. I've played all the mods 7 before so this bug is stumping me. Any help is greatly appreciated.
I had the same problem and I couldn't find a solution anywhere but if your still looking I managed to solve it. What's happening is your ipv6 is blocking something I'm not sure on the exact details but the solution is to go to your network settings and disable ipv6. Hopefully this helped as it worked for me.
Made an account just to say thank you so much! Seriously I spent hours trying to fix this problem. For anyone else having this issue, the fix is to go into Windows Control Panel, Networks and Sharing Center, click on "Change adapter settings", select the adapter you have connected to the internet (in my case it was "Ethernet") and click on "properties" and then just uncheck the box labeled "Internet Protocol Version 6 (TCP/IPv6)".
That's all there is to it. That was the fix for me. Hope this helps other folks out!