Photon server and IPv6

2»

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @no1no,

    I apologize about the delay! Sometimes forum discussions fall off the radar.

    I think there could be a misconfiguration or a misunderstanding.

    It looks like the the DNS resolve failed. Which means there is something wrong with the domain name you used. Since you mentioned that you tested this locally how did you set up the domain name? using "/etc/hosts" or a more advanced way (e.g. "bind")?

    Did you run the tests checklists from our doc?
  • no1no
    no1no
    edited July 2016
    Thanks for your reply @JohnTube

    I also think there is a misunderstanding from me, I just don't know where. I followed the document from top to bottom. Here is what I did:
    - I'm using Option A: IPv6-ready clients, IPv4-only servers.
    - My server is on the internet having it own IP address
    - My domain point to the IPv4 address of my server
    - I'm using domain name as server address in PhotonServerSettings
    - I'm using Photon Server latest version: v4.0.29.11263 and PUN+ 1.70
    - From my network (IPv4):
    + I nslookup my domain name and got the IPv4 address
    + I can ping my domain name
    + I can tracert my domain name
    + I haven't telnet yet since windows cmd don't understand that command
    - How I tested IPv6: I setup the IPv6 network exactly like Apple instruction in this doc I build the app in Mac, connect my Ipad to the new wifi, ran the app and trying to connect to the server. It's not working.
    It looks like the the DNS resolve failed. Which means there is something wrong with the domain name you used. Since you mentioned that you tested this locally how did you set up the domain name? using "/etc/hosts" or a more advanced way (e.g. "bind")?
    You mean the test has to be in local? Meaning I have to setup a server in my network and I can't test it with a server on internet?

  • JohnTube
    JohnTube ✭✭✭✭✭
    I see. Maybe we need to clarify things more.

    The secret is in "NAT64/DNS64". Your domain name should return 2 IP addresses one IPv4 and one IPv6!

    For development: Apple does this for you locally but you still need to configure a domain name for the machine (Mac) that has the Photon server. So when IPv6 clients tries to connect they will get an IPv6 address and IPv4 clients get IPv4 address.

    For production: you need a DNS64/NAT64 environment somehow.
  • no1no
    no1no
    edited July 2016
    OK, it seems I really misunderstand Option A: IPv6-ready clients, IPv4-only servers. I thought we don't need IPv6 at all (if it has both IPv6 and IPv4 address then it's not really IPv4 only, right?) and domain name is only what we need. I did a search about NAT64/DNS64 before and all information I got is kinda confusing and there is no good tutorial to do it.

    Thanks, the problem is not solved but at least I know where should I head to do it.
  • no1no
    no1no
    edited July 2016
    I think I figured out the true reason why the app cannot connected and give out the exception. It seems the problem is the Unity method System.Net.Dns.GetHostEntry. It cannot resolved the server name to return a synthesized IPv6 address. I have to use a plugin to use iOS getaddrinfo instead. The address is resolved and I got the IP 64:ff9b::xxxx:xxxx.
    Still I got an error "Error parsing address 64:ff9b::xxxx:xxxx:5055". If I put the IP in brackets (it becomes [64:ff9b::xxxx:xxxx]:5055) I got a new error "An address incompatible with the requested protocol".
    Any idea on how to fix this? What is the proper format of IPv6 that Photon understand?
  • The proper format is the one with brackets. We decided to make them mandatory for all our address-needs (to better differentiate them from ipv4).

    I don't see what your requested protocol is. The port 5055 suggests it should be UDP but then you should not get this error.

    You need to update PUN. In best case to v1.73, which is out today (some more fixes in there).
    Otherwise IPv6 won't work according to Apple's requirements, sorry.
  • no1no
    no1no
    edited July 2016
    @Tobias I did update PUN+ to 1.70 back when I started this thread. Today I updated it to 1.73 and nothing really change, I still need to use a plugin to use iOS getaddressinfo to get synthesized IPv6 address because System.Net.Dns.GetHostEntry still give me "No such host is known" error. And while running the app in local DNS64/NAT64 network I still get this error
    Receive issue. State: Connected. Server: '[64:ff9b::7646:78fe]' Exception: System.Net.Sockets.SocketException: An address incompatible with the requested protocol was used
    at System.Net.Sockets.Socket.Receive (System.Byte[] buffer) [0x00000] in :0
    at ExitGames.Client.Photon.SocketUdp.ReceiveLoop () [0x00000] in :0
    ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
    ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
    PhotonHandler:Update()
    I've tried to google a bit and I think the first result is the correct way to fix it: http://stackoverflow.com/questions/2370388/socketexception-address-incompatible-with-requested-protocol
    However I'm unable to touch the Photon socket code since it's hidden behind the library Photon3Unity3D.dll, if it's possible could you (or anyone responsible for the code) look into this?

    Edit: Yes, I'm using UDP protocol.
  • "An address incompatible with the requested protocol was used"
    This is very likely due to using not the latest Unity. Not all supported IPv6 in C# out of the box. For example, out of the 5.x versions, 5.3.4p4 was the first with all necessary fixes.
  • no1no
    no1no
    edited July 2016
    YES, YES, YES, it's finally working. After updating Unity to 5.3.5 it's working.

    I haven't think about it I mean my version is 5.3.4f1, not the latest version but it's still quite new. I didn't think Unity only support IPv6 recently. I still need to do some configuration on server but at least the hardest part is passed. Thank you everyone for your help.
  • I am using Photon-OnPremise-Server-SDK_v4-0-29-11263 and I followed the instructions for IPv6 but the master server still will not return the hostname to the client. So I ended up forcing the use of the hostnames by modifying this line in the MasterClientPeer:
    public bool UseHostnames
            {
                get
                {
                    return true;
                    //return this.IsIPv6ToIPv4Bridged;
                }  
            }
    Hope this helps someone.
  • Nice hack.
    Which package (name and version) do you use on the client side? Maybe it's related.
    Also, IsIPv6ToIPv4Bridged is probably only set when the client is in a pure IPv6 network via DNS64.
  • The client is Photon Unity Networking v1.75
  • HI,I use Photon Server 4-0-29-11263,According to the IPV6 configuration,I set:

    IPAddress="0.0.0.0"
    IPAddressIPv6="::"
    Port="5055"

    But when i change network to ipv6, i cannot connect the server. If I miss other configuration?
    Is there any settings on client sdk? i use the Photon3Unity3D.dll in "Photon-OnPremise-Server-SDK_v4-0-29-11263\lib"
  • to what server can not you connect?
  • Jen
    Jen
    edited October 2016
    The server is writen by myself base on phooton server sdk. client is unity. it run right on ipv4.But "ExceptionOnConnect" when connect server On ipv6.
  • and i use domain name to connect. As photon photonPeer.Connect("xxx.com:5055", "ApplicationName");
  • Tobias
    Tobias admin
    edited October 2017
    I think you need to tell us more about your setup.
    You run your own Photon Server. On some rented machine? Does that machine for the server have a public IPv6? And did you do a IPv6 DNS entry for this? Else, connecting to a hostname won't work.
    Are you aware of this?

    Also, from a client side, are you sure you can connect to a IPv6 server at all? It's not a given with current networks and configurations, that you can without issues.

    And lastly: Do you even need this? If you want to support IPv6 networks for iOS, then, by Apple's definition, the clients will have a DNS64 and NAT64 service and won't even notice that your server is actually running IPv4 only. Provided you have a host name (which points to a IPv4)...

    http://doc.photonengine.com/en-us/onpremise/current/reference/ipv6