moonlight-stream / moonlight-common-android

Android common library - now embedded in Moonlight Android
GNU General Public License v3.0
115 stars 31 forks source link

IPv6 support #22

Closed reinaldorauch closed 5 years ago

reinaldorauch commented 6 years ago

does moonlight supports the ipv6 addresses? How hard is the implementation of that?

cgutman commented 6 years ago

Moonlight is fully IPv6 ready after Apple's statement that IPv6 readiness would be a requirement going forward (which they later retracted). It works correctly when streaming from a machine behind a NAT64 gateway like the one Apple provides for testing on macOS.

GeForce Experience doesn't listen on IPv6, so that's the main issue. If another machine does the v4<->v6 translation (like the NAT64 gateway), it should work.

reinaldorauch commented 6 years ago

I think that with the netsh cli tool on windows you can add a forwading from the local ipv6 to the local ipv4 address. Maybe this can help setup internet streaming bypassing port forwading on lan routers.

cgutman commented 6 years ago

It's trickier than just that, because you also need an outbound UDP rule to forward traffic back to the streaming client. That rule would need to be dynamically generated because the client will bind an ephemeral port and you won't be able to tell which one it will choose ahead of time.

reinaldorauch commented 6 years ago

Oh, I see. Damn, I don't get what is the problem with the companies in supporting ipv6. It's almost transparent to them, I think.

cgutman commented 6 years ago

Despite not being easily supported using in-box Windows tools, I suspect it'd be an easy job to write a little tool that would handle the IPv4<->IPv6 stuff on the local machine.

cgutman commented 6 years ago

@reinaldorauch I wrote a little tool to do the IPv4<->IPv6 relaying for GameStream. Let me know if it works for you. https://github.com/moonlight-stream/GS-IPv6-Forwarder

reinaldorauch commented 6 years ago

I will test it sometime, tnks

d-karl commented 5 years ago

I hope it's okay for me to revive this thread. I am currently trying to make Moonlight streaming over ipv6 over internet work. To this end, I have installed GS-IPv6-Forwarder, and it is running on my system. Currently working:

Not working:

Some noteworthy stuff:

Is there any log from the Forwarder or anything I can inspect in hopes of finding the problem? I would like to eliminate the forwarder service as a potential problem in the chain.

cgutman commented 5 years ago

There's no log from the service itself, but you can run the executable in standalone mode from the command line like gsv6fwd.exe exe and it will output to the cmd window. You will have to manually stop the service first though.

You mention port forwarding, which is not commonly used on IPv6. Are you sure you're referring to IPv6 configuration and not IPv4?

On your host PC can you reach these?

http://127.0.0.1:47989/serverinfo http://[::1]:47989/serverinfo

d-karl commented 5 years ago

Definite yes on the ipv6, I think I may have translated the options wrong. My AP calls it "shares", and it is very similar to ipv4 port forwards interface-wise, although in reality it is just exceptions for the AP's firewall I think. I have temporarily set my host pc as an "exposed host" in the AP. It is my understanding that this stops all ipv6 firewall protection for my host PC.

Both loopback serverinfo sites work on the host PC, thanks for pointing me to these. Both of these also work on the client Chrome OS device (tried with both the android and chrome os Moonlight app). Moonlight refuses to connect, just says "failed to connect %ipv6%, Ensure GameStream is running in GF experience (not an issue, works fine over ipv4 inside my network). Currently, the client device is on the same network as the host, but the whole reason for trying this is to access the host remotely in the future.

Interesting: link-local ipv6 address to :47989/serverinfo (fe80::) does not work on the client PC, while global 2a02:: works as expected. Curious. Using the global address, where the serverinfo is reachable in the browser, inside the moonlight app does not work.

Still unsure whether this is a software issue or my network setup unfortunately, leaning towards network. Output from the IPv6 forwarder is minimal and looks fine.

Redacted output of IPv6 forwarder just in case: https://pastebin.com/3sDMmDQQ

cgutman commented 5 years ago

Does the global IPv6 address work if you run Moonlight on the host itself and try to connect via that IPv6 address?

One thing that sticks out to me is that the PCP mapping lifetimes look very small. We request 7200 seconds IIRC so seeing values under 100 seconds is strange. Perhaps your router is artificially constraining the lifetimes of the the mappings?

I also recall some issues with IPv6 on the Chrome client, though it wasn't clear if there was actually a bug in NaCl that was causing it. Can you try a native Android or iOS device or the native PC client on a different computer?

d-karl commented 5 years ago

It would appear I have no way of configuring anything to do with PCP on my AP, besides turning it on in the first place. I have consulted the documentation and everything appears to be set up as instructed 🤷‍♂️.

I can confirm the host PC can reach itself using the global address, and Moonlight connects just fine using the Windows Moonlight client. It appears the Chrome app is unavailable on Windows, so I can't confirm whether this might be the problem.

I have two potential client's available as of right now: the mentioned chrome book, which is really the intended client, and an Android phone. The Android phone is also unable to connect to the host PC (Moonlight client no, serverinfo yes). I have also attempted to skip the wireless part of the network and connect the chrome os client with the host pc with a single switchbetween them, which did not change the outcome. Considering there is now only a single switch between the devices and no more firewall, I can ping and access the serverinfo, but am not able to connect the Moonlight client I am kind of stumped.

I know Chrome OS can be fickle or entirely uncooperative when attempting to act as a host with any kind of software.. I could go and resurrect an ancient linux notebook if you think it'll help?

Edit: I have set the windows firewall to log all connections and attempted to connect the Android moonlight client. I have made the output more readable and pasted it here: https://pastebin.com/Fk8tnxjP From what I can tell, the ipv6 to ipv4 forwarding appears to work, which leads me to believe I have a network problem, not a Software problem.