Unable to connect to IPV6 only network

Hi,

Our tests with android SDK also shows that we are unable to connect to photon cloud on a IPV6 only network.

iOS integrations keep getting rejected by apple because of failure to connect with IPV6 network.

Followed photon documentation : https://doc.photonengine.com/zh-cn/realtime/current/reference/ipv6
SDK downloaded from: https://www.photonengine.com/en/Realtime/Download

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Abhinav,

    I'm not sure about Android but a lot of iOS apps powered by Photon made it to the store with difficulties sometimes. See here.

    Could you please give us the logs or the error/exception you have when trying to connect to know more about why this is happening for you.
  • Kaiserludi
    Kaiserludi admin
    edited February 2020
    Hi @Abhinav.

    iOS:
    Photon works fine on IPv6 only networks (note that IPv6 is only supported with 4.1 and newer releases of the Client SDK. 4.0 and older releases are IPv4 only).
    Note that when Apple rejects you app because it can not connect in their IPv6 testing network, the possible cause for their problems may also lay within another 3rd party lib that is used by your app and that is connecting to the internet, like for example and advertising framework. Also it does not mean that your app would work fine for them in an IPv4 network. The cause for their problems might not be IPv6 related.

    Please test your app on in the test setup that is recommend by Apple (https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandingandPreparingfortheIPv6Transition/UnderstandingandPreparingfortheIPv6Transition.html#//apple_ref/doc/uid/TP40010220-CH213-SW16) and also on a true IPv6 only network (see https://go6lab.si/current-ipv6-tests/nat64dns64-public-test/) and if it works for you, then just resubmit it and mention to Apple that you can't reproduce their issues neither with their recommended test setup nor with a true IPv6 only network and ask them for what is different in their own setup than in the test setup that they recommend themselves.
    After doing this and eventually resubmitting a couple more times your unchanged app should suddenly get accepted.

    I am sorry for this frustrating experience, but we still could not figure out, why Apple is often rejecting apps that apparently behave totally fine, stating, they would not work on IPv6, only to then accept them without any changes after a couple of resubmits.



    Android:
    Although our IPv6 support should theoretically also work on most other platforms than iOS, including Android, Windows, OS X and Linux, we have only thoroughly tested it on iOS (tests on other platforms have been limited to the extent of making sure that we did not break existing IPv4 support and that the clients are happily working on networks that support both, IPv4 and IPv6, but on such networks they will just use the IPv4 address). We have focused on iOS as it is currently the only platform on which IPv6 support is actually required.

    Also the IPv6 support in Android itself is rather new. Android versions older than 5.0 don't support it at all. Some Samsung devices seem to have some problems even with Android 5 and Android 6 caused by the hardware letting them drop IPv6 connections under certain circumstances (but this should not prevent them from connecting to an IPv6 address in the first place), but those devices that support Android 7 should work fine even with Android 5 and 6 (as Android 7 makes proper IPv6 support by the device mandatory).

    Furthermore the Android IPv6 support is somewhat limited in the way that it does not support DHCPv6 and Google is not planning to do so anytime soon (https://code.google.com/p/android/issues/detail?id=32621).

    How did you test connecting to a IPv6 only network on Android?
  • Testing IPv6 on Android:
    We need two things before we test Photon connection(with IPv6 only network) on android.
    1. A device that supports IPv6 network. We used Xiaomi Redmi 3s Prime running Android 6.0.1
    2. Cellular data that supports both IPv4 and IPv6.

    with cellular data enabled, we ran tests at http://test-ipv6.com/ to confirm we have both IPv4 and IPv6 network access.

    Then, we created a new APN on the device that supports only IPv6 network by following the link below
    http://www.pocketables.com/2013/06/how-to-enable-ipv6-connectivity-on-the-t-mobile-nexus-4.html

    then we ran tests at
    http://test-ipv6.com
    to confirm that we have only IPv6 network access.

    after that we tried connecting to Photon in our game and it failed to connect.
  • Hi @Abhinav.

    Sorry for the delay in responding.

    I did test IPv6 on Android now and the Photon Android NDK Client SDK does work with IPv6. I have tested with 4.1.6.0, but it should also work with every other release since 4.1.0.0.

    However there is a caveat:
    The Photon Cloud name server 'ns.exitgames.com' is IPv4-only. It can't be reached from IPv6 only clients without a translation between IPv6 and IPv4 in place in between.
    Supporting IPv6 on that server unfortunately is not possible yet. This isn't really a problem though as lots of websites out there are IPv4 only, so that IPv6 only networks should have translation between IPv6 and IPv4 in place (usually dns64+nat64).

    I have tested from Germany and apparently the only mobile APN that offers IPv6 here is Telekom, the others are all still IPv4 only. However Telekom offers IPv6 as IPv4/IPv6 dual stack, not as IPv6 only, which means, the client can still use IPv4, so it will simply use that to reach IPv4-only servers and no translation happens and it might not even be any in place in the APN. Setting the APN protocol to IPv6-only results in nothing in the test device being able to connect at all, not just Photon - I can't even reach google.com, so I guess this is simply not setup to work by the provider.
    When the APN is set to IPv4/IPv6, then the client simply uses IPv4 and happily connects to the name server that way.

    However when I try to connect an Android device to a local IPv6 test setup like described on https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandingandPreparingfortheIPv6Transition/UnderstandingandPreparingfortheIPv6Transition.html#//apple_ref/doc/uid/TP40010220-CH213-SW16, the client does not get any IPv4 addresses at all, the network will bridge every IPv4 address to IPv6 to simulate an IPv6 -only network for the client. This is the official test-setup recommendation by Apple to check if an iOS app is IPv6 compatible.
    Not only our iOS Client SDK, but also our Android NDK Client SDK happily resolves ns.exitgames.com to an IPv6 address, connects through IPv6 to the name server in that setup, gets URLs returned for the region master server addresses instead of the IPv4 addresses that it would get if it had connected through IPv4 (as the name server detects that itself sees the connection as IPv4and the client sees it as IPv6, so it concludes that dns64+nat64 took place in between), selects on of those regions, resolves the url to an IPv6 address and happily connect. When creating a room afterwards, it again gets a URL for the game server address and happily resolves that to IPv6 and connects.
    You can easily observe this with the default output of demo_loadBalancing.


    So please test with Apples test device. If that does work for you then I guess something must be broken with bridging between IPv6 and IPv4 in your IPv6 only APN.
  • Kaiserludi
    Kaiserludi admin
    edited February 2020
    @Abhinav:

    One further question:
    Are you able to connect to photon cloud on a IPV6 only network on iOS, yourself?

    Also, technically the following should work:
    Setup a webserver that accepts HTTP requests and let your app send a HTTP request to that webserver to ask it which protocol it should use and then you use the protocol that that webserver specifies in its response with Photon.
    You the setup the webserver to always respond with "TCP" for a certain version for your app (obviously you need to include your app version in the HTTP request), while that version of your app is in the review process as apparently Apple has not rejected a game that uses TCP yet (this might just be a coincidence, but maybe there is something wrong with their review teams network setup that only affects UDP).
    After your update got accepted, just change the setting in your webserver to make UDP available to that particular version of your app.

    However you should check Apples terms and conditions.
    One Photon user reported that they got accepted with this TCP for review trick and that the only one having problems with UDP connections on an IPv6 network has been Apples review teams, while it works fine for all of their end users, but I have no idea if Apple is fine with deactivating certain features of your app for the review process while activating them for end users this way, but from my understanding deliberately doing this behind Apples back might risk your Apple developer status, so better clarify this first.
    Another option might be, to just try to connect with UDP and in case of a connection error on the initial connect just retry with TCP, no matter if in app store or not. Advantage: this would be the case for app reviewers and end users, so you would not treat the review team special in any way and you would not need to run a web server that you might not need otherwise.
    You could then even gather statistics (well, then you would need to run a server again to which the client could send those statistics) to track how often it is actually the case for end users that they can't connect through UDP, but can connect through TCP right after, if this only happens on IPv6-only networks and for which client IPs this happens (which may help track down network providers).