Moonlight Port Forwarding

Moonlight Port Forwarding: Stream Remotely With Sunshine

5 Mins Read

PureVPNPort ForwardingMoonlight Port Forwarding: Stream Remotely With Sunshine

Moonlight can connect to a Sunshine host over the same local network without router port forwarding. Remote streaming is a different ballgame, though. Once the Moonlight device is outside that network, the PC running Sunshine needs to be reachable on the ports Sunshine uses for the connection.

Moonlight port forwarding can be handled either through your router or by opening the required ports using PureVPN’s Port Forwarding add-on. In this guide, we will cover which ports Sunshine uses, how to configure both approaches, and what to check if Moonlight still cannot connect remotely.  

Do You Need Port Forwarding for Moonlight?

For local streaming, the connection stays within your network, so Sunshine does not need to accept traffic from the wider internet. Moonlight can reach the host directly over the LAN, which means router port forwarding is not normally part of the process.

Port forwarding becomes relevant when you want to stream from another network. The PC running Sunshine needs to be reachable on the ports Sunshine uses, which means those inbound connections need a path back to the host.

While most people refer to this as Moonlight port forwarding, the rules actually apply to the Sunshine host. Moonlight is the client connecting to it remotely. Sunshine can also attempt to open the required ports automatically through UPnP when the option is enabled.

Which Ports Does Sunshine Use With Moonlight?

By default, Sunshine uses the following TCP and UDP ports for Moonlight connections:

PortProtocolUsed for
47984TCPHTTPS
47989TCPHTTP
48010TCPRTSP
47998UDPVideo
47999UDPControl
48000UDPAudio

If you have changed Sunshine’s default port configuration, use the corresponding ports from your Sunshine settings instead. Changing Sunshine’s main port also shifts the related port numbers.

How to Set Up Moonlight Port Forwarding for Sunshine

There are two main options for opening the required Sunshine ports:

Option 1: Forward Sunshine Ports Through Your Router

Step #1: Find the local IP address of the Sunshine PC

Check the network settings on the PC running Sunshine and note its local IPv4 address. Your router will use this address to send incoming connections to the right device. To keep that address from changing, you can either create a DHCP reservation on the router or assign the Sunshine PC a static local IP.

Step #2: Open your router’s port forwarding settings

Sign in to your router’s administration page and look for its port forwarding controls. Depending on the router, the section may be labelled Port Forwarding, NAT, Virtual Server, or something similar. The exact menus vary between routers, but you are looking for the option that lets you create rules for incoming TCP and UDP connections.

Step #3: Add the Sunshine port forwarding rules

Create forwarding rules for the Sunshine ports listed in the previous section and select the correct TCP or UDP protocol for each one. For every rule, set the destination or internal IP address to the local IP of the PC running Sunshine. If your router asks for separate internal and external port values, use the same port number for both. Save or apply the rules.

Step #4: Check the firewall on the Sunshine host

Port forwarding gets the connection to the host PC, but the operating system firewall can still block Sunshine from receiving it. Check that Sunshine is allowed through the firewall and that the relevant inbound traffic is not being denied. Find out how to open ports through Windows Firewall. 

Step #5: Test the connection from Moonlight

Move the Moonlight device onto a different network, such as another Wi-Fi connection or mobile data, and make sure Sunshine is running on the host PC. If the host does not already appear in Moonlight, add it using the host network’s public IPv4 address or a hostname that points to it. Then start a stream to confirm that the remote connection is working properly.

Option 2: Use PureVPN Port Forwarding to Open Sunshine Ports 

Step #1: Get PureVPN with Port Forwarding

You will need a PureVPN subscription with the Port Forwarding add-on included. If you already have a PureVPN account, you can add Port Forwarding from the Subscriptions section of your Member Area. 

Step #2: Open the required Sunshine ports

Log in to the PureVPN Member Area, open the Port Forwarding settings, and select Enable specific ports. Add the Sunshine port numbers listed earlier in this article, then apply the settings. PureVPN allows multiple specific ports to be opened while the remaining ports stay blocked. 

Step #3: Connect PureVPN on the Sunshine host

Open the PureVPN app on the PC running Sunshine and connect to a location that supports Port Forwarding. PureVPN marks supported locations in the app, and the Port Forwarding rules only apply when you are connected to one of them. If the VPN was already connected when you changed the port settings, reconnect so the new rules can take effect. 

Step #4: Check Sunshine and the host firewall

Make sure Sunshine is running and allowed through the operating system firewall. The ports may be open on the VPN connection, but Sunshine still needs to be able to receive the incoming traffic on the host PC.

Step #5: Test the connection from Moonlight

Move the Moonlight device onto another network and add the host using the IP address assigned to the PureVPN connection. Start a stream to confirm that Moonlight can reach Sunshine through the forwarded ports.

Moonlight Port Forwarding Not Working? Reasons and Fixes

If Moonlight still cannot connect remotely, check the following:

  • Wrong local IP: Make sure the forwarding rule still points to the Sunshine PC. A DHCP reservation or static local IP can help keep the address from changing.
  • Missing Sunshine ports: Check that all required Sunshine ports have been opened. Missing even one can affect the remote connection.
  • Wrong protocol: Make sure each port uses the correct TCP or UDP rule. Using the wrong protocol can stop that traffic from reaching Sunshine.
  • Host firewall: Check that Sunshine is allowed through the operating system firewall and that the required inbound traffic is permitted.
  • Double NAT: If two routers or gateways are performing NAT, forwarding ports on only one device may not create a complete inbound path.
  • CGNAT: Carrier-Grade NAT can block router port forwarding. Using PureVPN’s Port Forwarding add-on, you can open supported ports through the VPN instead.
  • UPnP failed: If Sunshine cannot create the required mappings automatically, switch to manual port forwarding or another suitable method.

Related Read: How to Check If Your ISP Performs CGNAT

Frequently Asked Questions

Do I port forward Moonlight or Sunshine?

You forward the required ports to the PC running Sunshine. Moonlight is the client that connects to the Sunshine host remotely, even though the process is commonly called Moonlight port forwarding.

Can I use Moonlight without port forwarding my router?

Yes. Sunshine can attempt to create the required mappings automatically through UPnP when the option is enabled and the router supports it. You can also handle the ports through PureVPN instead of configuring them on your router.

Is it safe to open Sunshine ports for Moonlight?

Opening ports creates an inbound path to the Sunshine host, so only open the ports Sunshine requires and keep the host firewall in place. 

Why does Moonlight work on my home network but not remotely?

Local streaming stays inside your network, while remote streaming needs a working inbound path to the Sunshine host. Incorrect port rules, a host firewall, double NAT, or CGNAT can all prevent that remote connection from working.

Does CGNAT affect Moonlight port forwarding?

Yes. CGNAT adds an ISP-controlled NAT layer that can prevent conventional router port forwarding from working. In that case, PureVPN Port Forwarding gives you another way to make the required ports reachable remotely.

Can Sunshine automatically open the required ports?

Yes. Sunshine has a UPnP option that attempts to open the ports needed for internet streaming automatically. It is disabled by default, so you need to enable it, and the network must support UPnP for the mapping to work.

Have Your Say!!