Sunshine and Moonlight Setup Guide: The Ultimate Low-Latency Configuration
1. The Death of GameStream & The Rise of Open Source
When NVIDIA officially deprecated GameStream, the self-hosted gaming community needed a robust replacement[cite: 1]. Almost overnight, Sunshine and Moonlight rapidly emerged as the gold standard for creating a private cloud gaming server[cite: 1]. Free from corporate ecosystem lock-ins, this open-source combination offers unmatched flexibility and latency performance that often rivals native hardware.
The architecture operates on a simple but highly efficient Host/Client model[cite: 1]:
- The Host (Sunshine): Installed on your powerful gaming PC. It captures your PC’s video output and encodes it in real-time[cite: 1].
- The Client (Moonlight): Installed on your receiving device (laptop, tablet, phone, or TV). It receives the stream and decodes the video while sending your controller or mouse inputs back to the host[cite: 1].
Lab Note: If you are new to the concept of streaming games from a remote server, we recommend reviewing our foundational guide on Cloud Gaming[cite: 1, 4]. Understanding the basics of network transport will make advanced troubleshooting much easier.
2. Host Setup: Installing and Configuring Sunshine
The host is the engine of your self-hosted setup. To get started, you must download the latest Sunshine release directly from the official GitHub repository[cite: 1]. Relying on the official source ensures you have the most up-to-date performance patches and security updates.
Critical Step: Administrator Privileges
During installation and subsequent operation, you must run the installer and the Sunshine service as an Administrator[cite: 1]. This is not optional for a high-performance setup. Administrator access is required to ensure Sunshine can properly capture the screen at the system level and inject raw controller inputs directly into the OS kernel, bypassing standard software delays[cite: 1].
Game Management and UI Integration
Through the Sunshine Web UI, you can easily add specific games or entire launchers like Steam Big Picture and Playnite for a seamless console-like experience[cite: 1]. Adding these launchers ensures that when you connect from your living room TV, you are greeted with a controller-friendly interface rather than a standard Windows desktop.
The Core Requirement: Hardware Encoding
This is the most critical step for reducing latency[cite: 1]. Software encoding (using your CPU to process the video stream) introduces massive processing delays and frame pacing issues. You must force Sunshine to use hardware encoding rather than relying on your CPU[cite: 1]. Depending on your GPU, select the appropriate encoder in the Sunshine configuration[cite: 1]:
- NVIDIA GPUs: Select NVENC[cite: 1]. This remains the lab standard for the lowest possible encoding latency.
- AMD GPUs: Select AMF[cite: 1].
- Intel GPUs: Select QSV[cite: 1].
3. Client Setup: Optimizing Moonlight for Low Latency
With your host actively listening, install Moonlight on your receiving device[cite: 1]. To pair the devices locally, Moonlight will provide a PIN code that you must enter into the Sunshine Web UI on your Host PC[cite: 1]. Once paired, the devices establish a trusted connection.
The Decoding Bottleneck
The most common mistake new users make is maxing out the bitrate slider. Bandwidth allocation is heavily dependent on your target resolution and framerate[cite: 1]. If you send a 150 Mbps 4K stream to an older Smart TV or a low-end laptop, the device’s internal processor will choke trying to decode the massive data packets, resulting in severe “decoding lag” and stuttering audio.
Based on our internal lab testing, we recommend the following parameters to balance visual fidelity and decoding speed[cite: 1]:
| Resolution | FPS | Minimum Network Bandwidth | Recommended Bitrate |
|---|---|---|---|
| 1080p | 60 | 30 Mbps[cite: 1] | 10 – 20 Mbps[cite: 1] |
| 1440p | 60 | 50 Mbps[cite: 1] | 30 – 40 Mbps[cite: 1] |
| 4K | 60 | 100 Mbps[cite: 1] | 50 – 80 Mbps[cite: 1] |
| 4K | 120 | 150 Mbps[cite: 1] | 80 – 100+ Mbps[cite: 1] |
4. Secure Remote Access: Gaming Outside the LAN
Playing on your local network (LAN) is straightforward because your router inherently trusts the devices connected to it. However, accessing your Host PC from an external network requires routing[cite: 1].
We strongly advise against traditional Port Forwarding via your router due to the severe security risks[cite: 1]. Opening ports like 47984-48010 directly to the web exposes your gaming rig to automated port scanners, brute-force attacks, and potential DDoS threats.
The Zero-Trust Mesh VPN Solution
The optimal solution for secure remote access is deploying a Mesh VPN like Tailscale or ZeroTier[cite: 1]. These services create a secure, encrypted peer-to-peer virtual network that completely bypasses the need for manual port forwarding.
- Deployment: Install Tailscale on your Host PC and your Moonlight Client device (phone, laptop, etc.)[cite: 1].
- Connection: Once both devices are authenticated on your Tailscale network, simply copy the Host PC’s Tailscale IP address and enter it manually into the Moonlight client[cite: 1]. Moonlight will treat this connection exactly like a local LAN, maintaining ultra-low latency while wrapping the traffic in strict WireGuard encryption.
5. Network Lab: Optimizing Jitter and Frame Pacing
Hardware encoding and secure VPN tunnels can only do so much; ultimately, the physical transport layer dictates your final experience[cite: 1]. A perfectly encoded 4K stream will still stutter violently if the underlying network is unstable.
The Wi-Fi vs. Ethernet Rule
Using an Ethernet connection for your Host PC is strictly mandatory[cite: 1]. Relying on Wi-Fi for the host introduces immediate packet loss and severe jitter spikes[cite: 1]. Because video streaming relies on UDP protocols, dropped packets are not resent; they simply manifest as visual artifacts, macro-blocking, or sudden input delays. For hard data on this phenomenon, read our lab report: Ethernet vs Wi-Fi for Cloud Gaming[cite: 1].
V-Sync and Frame Pacing
Frame pacing issues occur when the host renders frames out of sync with the client’s refresh rate. To ensure smooth frame pacing without adding input delay, disable V-Sync inside the game settings on your Host PC[cite: 1]. Instead, enable V-Sync exclusively within the Moonlight client settings[cite: 1]. This forces the client device to dictate the display timing, resulting in a much smoother visual feed.
Diagnostics and Readiness
Before troubleshooting stream stutters, verify your baseline network stability[cite: 1]. Run a diagnostic using the 9GG CLOUD Readiness Tools to check your Ping and Jitter capacity[cite: 1, 4]. A high jitter (variance in ping over time) is the number one cause of poor cloud gaming experiences.




