Sarpendon / WindowsGSM.MythofEmpires

🧩 WindowsGSM plugin that provides Myth of Empires Dedicated server support!
MIT License
7 stars 3 forks source link

Problem with IPv6 #9

Open admborkbork opened 2 months ago

admborkbork commented 2 months ago

When configuring the external IP address, the construction method fails if the local machine and network and ISP all support IPv6 and IPv6 is enabled throughout.

Specifically, the line string externalIpString = new WebClient().DownloadString("http://icanhazip.com").Replace("\\r\\n", "").Replace("\\n", "").Trim(); will return an IPv6 address rather than the IPv4 address, and then when that is used later for the -OutAddress it will cause a configuration issue and not allow the server to register with Angel for the server list.

I'm not sure of a direct solution, because other sites that specify IP address aren't as easy as icanhazip -- my indirect solution was to create my own .cs with an explicit string for my public IPv4 address. string externalIpString = "123.123.123.123";

I also realize that I'm in the 0.0001% of people that have full-stack IPv6 to their home, so it's incredibly unlikely that this would actually be an issue for literally anyone else, but I can at least note it here in the hopes that Google picks it up and it helps someone maybe in the future.

Raziel7893 commented 2 months ago

No game or gameserver supports ipv6 only connections. You need to either buy one (most VPN services provide that option. A pal uses ovpn.net for his server, I know of nordvpn also providing that. Should cost around 7€)

Or you pay a bit more for your internet and take a contract with ipv4.

Or you connect your friends via VPN to your net and play via local lan then.

Many windowsgsm plugin creators recommend zerotier (should be a free VPN designated for gaming)

There are also tunneling methods, which require acces to a server with a full ipv4. Some small VPS can be obtained, not powerfull enough for the servers themself, but only for forwarding. I think there are some for under 5€)

admborkbork commented 2 months ago

No game or gameserver supports ipv6 only connections. You need to either buy one (most VPN services provide that option. A pal uses ovpn.net for his server, I know of nordvpn also providing that. Should cost around 7€)

Or you pay a bit more for your internet and take a contract with ipv4.

Or you connect your friends via VPN to your net and play via local lan then.

Many windowsgsm plugin creators recommend zerotier (should be a free VPN designated for gaming)

There are also tunneling methods, which require acces to a server with a full ipv4. Some small VPS can be obtained, not powerfull enough for the servers themself, but only for forwarding. I think there are some for under 5€)

No, it's not an issue of IPv6 only. My home network, ISP, etc., all support IPv4 without a problem. The issue is that icanhazip prefers IPv6, so when the HTTP call goes out to it, it replies with an IPv6 address, which doesn't work for the -OutAddress (obviously).

A possible script workaround could be to do a separate DNS lookup to get the explicit A record for icanhazip (instead of the IPv6 AAAA record that gets preferred) and then make the WebClient() call directly to that A record instead of domain name. I don't know enough C# to be able to suggest a PR for that, though, or if that's even feasible.

Raziel7893 commented 2 months ago

No game or gameserver supports ipv6 only connections. You need to either buy one (most VPN services provide that option. A pal uses ovpn.net for his server, I know of nordvpn also providing that. Should cost around 7€) Or you pay a bit more for your internet and take a contract with ipv4. Or you connect your friends via VPN to your net and play via local lan then. Many windowsgsm plugin creators recommend zerotier (should be a free VPN designated for gaming) There are also tunneling methods, which require acces to a server with a full ipv4. Some small VPS can be obtained, not powerfull enough for the servers themself, but only for forwarding. I think there are some for under 5€)

No, it's not an issue of IPv6 only. My home network, ISP, etc., all support IPv4 without a problem. The issue is that icanhazip prefers IPv6, so when the HTTP call goes out to it, it replies with an IPv6 address, which doesn't work for the -OutAddress (obviously).

A possible script workaround could be to do a separate DNS lookup to get the explicit A record for icanhazip (instead of the IPv6 AAAA record that gets preferred) and then make the WebClient() call directly to that A record instead of domain name. I don't know enough C# to be able to suggest a PR for that, though, or if that's even feasible.

ahh misread that. there is a posibillity to just use the fixed ipv4 version https://ipv4.icanhazip.com/

on default it relies on your DNS to link to the correct version, which is v6 if you have the full stack enabled( A windows issue, not from that site) . i myself deactivate it in windows most of the times. it can cause sooooo weird issues that are not tracable if your windows decides one moment to use v6 and the other one v4.

ill open the MR. the creator does not seem to monitor its issue page :/

ill recommend stepping by the windowsGSM discord, if the creator does not react to issues. normaly you find somebody helpfull there ... ok most times thats me :D

https://github.com/Sarpendon/WindowsGSM.MythofEmpires/pull/10