The transition to IPv6 is inevitable. Apple no longer accepts submissions to the App Store, if their networking does not work in IPv6 networks (recommended reading). As a result, some developers may become worried. Well don't be, Photon got you covered.
We know that a full switch to IPv6 can take time.
That is why, we guarantee that it will be smooth using one of two options. Both options also require a minimal version for the Photon Client SDK used. See list of supported SDKs.
Option A: IPv6-ready clients, IPv4-only servers
In this case, clients are in a network that only uses IPv6 addresses or hostnames. Even hostnames that are only available via IPv4, are translated into IPv6 addresses for these networks (via DNS64/NAT64).
As long as you avoid using IPv4 addresses directly, servers can be reached and don't need a IPv6 address themselves. This option can be tested with the help of a Mac (see below).
Photon Server should be configured using domain names (FQDN) instead of IP addresses. See how to do this in Photon Server.
Option B: both client and server are running on IPv6
This option is for an IPv6-only network and is supported by Photon Server v4 only.
As required, server addresses will be sent to the client in a suitable form:
- IPv4 address: when both server and client use IPv4.
- IPv6 address: when both server and client use IPv6.
- DNS hostname: when client uses IPv6 and server uses IPv4.
Currently, the following Photon SDKs support IPv6:
- Photon Server SDK v4: starting from version
- Photon Server SDK v3: starting from version
- Photon Native (C++/Objective-C) Client SDKs: starting from version
- Photon .Net/Mono (C#) Client SDK: starting from version
- PUN: starting from version
- Unity supports IPv6 in versions 4.7.2, 5.1.5, 5.2.5, 5.3.4p4, 5.4.0p1 and newer (Unity blog post).
The 5.4 release has broken IPv6 support.
Testing IPv6 With DNS64/NAT64
We recommend testing on a local environment using the methods proposed by Apple.
You can easily setup a IPv6 WiFi using a Mac.
Photon Server Configuration
In Photon Server configuration, we recommend using domain names instead of hardcoded IP addresses.
For Photon server applications made from scratch or not based on LoadBalancing, please always use domain names instead of IP addresses.
Photon Server V4
For Photon LoadBalancing application, this should be done for game server in "GameServer\bin\Photon.LoadBalancing.dll.config" file by adding the following setting:
Photon Server V3
For Photon LoadBalancing application, you need to change one line of code.
RegisterGameServer.GameServerAddress to your domain name in
OutgoingMasterServerPeer.Register (in "OutgoingMasterServerPeer.cs") as follows:
- "::" is the IPv6 equivalent of "0.0.0.0" in IPv4.
- "::1" is IPv6 equivalent of "127.0.0.1" (the loopback address) in IPv4.
IPAddressIPv6="::" to each
xListener in "PhotonServer.config". Here is an example:
For Photon LoadBalancing applications, set
PublicIPAddressIPv6 to "::1" in the "GameServer\bin\Photon.LoadBalancing.dll.config" file as follows:
For Photon server applications made from scratch or not based on LoadBalancing, always use IPv6 addresses.
When connecting from a Photon client to an IPv6 Photon Server you should specify the server's address.
If you keep configuration with default ports then it should be optional to specify port number.
In any case, the IPv6 address plus port format should be:
This is the official way of separating address and port with IPv6.
Domain Name To IP Address
We recommend checking if your domain name is publicly resolvable using
nslookup command line tool as follows:
You have to replace
<YOURhost.YOURdomain.com> with your own domain name.
Make sure to check if the result includes an IPv6 address.
Checking If Your Server Is Reachable
There are multiple ways to do check if your server is reachable on the internet, you can choose one:
ping <domain name or IP address>
traceroute <domain name or IP address>or
tracert <domain name or IP address>depending on your operating system.
telnet <domain name or IP address> <port>