Hi
I always got the "Failed to connect to server ..." error when trying to join any game in the multiplayer lobby. I know how frustrating it is and I've seen quite a few players having the same problem. There are a few forum posts etc. about this error but none of the suggested solutions worked for me.
I managed to solve the issue and for me the problem was something I've never seen mentioned anywhere else. I'm making this post to help other players who might have the same issue as me.
At first check if your firewall or antivirus is blocking 0ad, try port forwarding 20595 and so on ( like mentioned in other posts). But as I said, for me that didn't help.
For me the problem was that my ISP was using CGNAT. CGNAT basically means that your router does not have an individual public IP address. It shares a public IP with other devices on the internet.
This is how to check if your ISP uses cgnat:
https://www.purevpn.com/blog/how-to-check-whether-or-not-your-isp-performs-cgnat/
If your ISP uses cgnat than thats probably what's causing the issue. Just call your the customer support of your ISP and ask them to give your router a public IP address that's not behind cgnat. In my case that solved the problem and it took like 5 minutes.
(Also don't explain the problem to them it will just overcomplicate everything).
To check if your ISP has given you a public IP that's not behind cgnat just follow the steps in the link above to check.
If the issue remains with a public IP address not behind cgnat, call them again and explain your problem in details this time.
If the customer support tells you they can't give you a public IP that's not behind cgnat or you need to pay extra just call a few times. sometimes it depends on who picks up wether they want to do this for you. If they really can't and you've tried everything else and the issue remains then the only option I see is to change ISP.
I don't how common cgnat is the reason causing this error...but maybe cgnat should be mentioned somewhere in the error message to make it more clear.
Also, please note that I'm not a networking pro so feel free to correct me.