IPv6
Concept
The transition to IPv6 is inevitable and already frequently used in mobile networks. For this reason, Apple for example no longer accepts submissions to the App Store if IPv6 is not supported.
All recent Photon SDKs support IPv6 networks as long as a DNS64/NAT64 service is available (which is what Apple requires).
Option A: IPv6-ready clients, IPv4-only servers
In this case, clients are in a network that only uses IPv6 addresses or hostnames. 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 and up.
Non-breaking strategy
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.
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.
Hostnames
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:
XML
<Photon.LoadBalancing.GameServer.GameServerSettings>
<!-- other settings -->
<setting name="PublicHostName" serializeAs="String">
<value>YOURhost.YOURdomain.com</value>
</setting>
<!-- other settings -->
</Photon.LoadBalancing.GameServer.GameServerSettings>
Photon Server v3
For Photon LoadBalancing application, you need to change one line of code.
Set RegisterGameServer.GameServerAddress
to your domain name in OutgoingMasterServerPeer.Register
(in "OutgoingMasterServerPeer.cs") as follows:
C#
protected virtual void Register()
{
var contract = new RegisterGameServer
{
//GameServerAddress = GameApplication.Instance.PublicIpAddress.ToString(),
GameServerAddress = "YOURhost.YOURdomain.com",
//...
IPv6-ready
- "::" 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.
Add IPAddressIPv6="::"
to each xListener
in "PhotonServer.config". Here is an example:
XML
<TCPListener
IPAddress="0.0.0.0"
IPAddressIPv6="::"
Port="4531">
</TCPListener>
For Photon LoadBalancing applications, set PublicIPAddressIPv6
to "::1" in the "GameServer\bin\Photon.LoadBalancing.dll.config" file as follows:
XML
<Photon.LoadBalancing.GameServer.GameServerSettings>
<!-- other settings -->
<setting name="PublicIPAddressIPv6" serializeAs="String">
<value>::1</value>
</setting>
<!-- other settings -->
</Photon.LoadBalancing.GameServer.GameServerSettings>
For Photon server applications made from scratch or not based on LoadBalancing, always use IPv6 addresses.
Address Format
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: [address]:port
e.g. [2001:db8:85a3:8d3:1319:8a2e:370:7348]:5055
This is the official way of separating address and port with IPv6.
Troubleshooting
Domain name to IP address
We recommend checking if your domain name is publicly resolvable using nslookup
command line tool as follows:
nslookup <YOURhost.YOURdomain.com>
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>
ortracert <domain name or IP address>
depending on your operating system.telnet <domain name or IP address> <port>