This document is about: SERVER 5
SWITCH TO

This page is a work in progress and could be pending updates.

IPv6

Concept

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.

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.

Supported SDKs

Currently, the following Photon SDKs support IPv6:

  • Photon Server SDK v4: starting from version 4.0.28.x.
  • Photon Server SDK v3: starting from version 3.4.31.10808.
  • Photon Native (C++/Objective-C) Client SDKs: starting from version 4.1.x.x.
  • Photon .Net/Mono (C#) Client SDK: starting from version 4.1.x.x.
  • PUN: starting from version 1.73.
  • 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.

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

You need the latest Photon Server v3 release available from our website here.

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> or tracert <domain name or IP address> depending on your operating system.
  • telnet <domain name or IP address> <port>
Back to top