Back to articles
Technology Insight

Building Your Ultimate Private Cloud Gaming Infrastructure: A Comprehensive Guide to Sunshine and Moonlight

May 27, 2026

Introduction: The Evolution of Gaming Infrastructure

Cloud gaming has transformed from an ambitious concept into a viable paradigm shift for modern enthusiasts. While commercial platforms offer convenience, they inherently tether users to subscription models, restricted game libraries, and geographic latency limits. For enterprise professionals, power users, and core gamers, the ultimate solution lies in self-hosting: creating a private cloud gaming infrastructure.

By leveraging your own workstation hardware, you can transcend these commercial limitations. This guide explores the orchestration of Sunshine, an open-source, ultra-low latency game stream host, paired with Moonlight, the cutting-edge client implementation of NVIDIA's legacy GameStream protocol. Together, they enable a highly customized, secure, and performant personal gaming cloud capable of streaming high-fidelity titles to virtually any endpoint device.

1. Architectural Overview: Why Sunshine and Moonlight?

To appreciate the efficacy of this setup, one must understand the underlying technical architecture. Originally, NVIDIA developed GameStream to stream games from PCs equipped with GeForce GPUs to Shield devices. When NVIDIA deprecated this service, the open-source community stepped in to sustain and expand this ecosystem.

What is Sunshine?

Sunshine is a self-hosted game stream host that acts as a modern, hardware-agnostic replacement for NVIDIA GameStream. Built with performance and cross-platform compatibility in mind, Sunshine supports:

  • Hardware Acceleration: Native integration with AMD (AMF), Intel (VAAPI/QSV), and NVIDIA (NVENC) encoding pipelines.
  • Low Latency Capture: Advanced desktop and audio capture methods that minimize pipeline overhead before encoding.
  • Extensibility: A robust Web UI for configuration, allowing custom application triggering, environmental variables, and automation scripts.

What is Moonlight?

Moonlight is the client-side counterpart that connects to your Sunshine host. Available on iOS, Android, macOS, Linux, Windows, ChromeOS, and even embedded systems like Raspberry Pi or smart TVs, Moonlight provides pixel-perfect decoding with negligible input lag. It handles complex gamepad mapping, mouse acceleration overrides, and dynamic bitrate adjustments natively.

2. System Prerequisites and Hardware Requirements

Deploying a self-hosted cloud gaming server requires a stable foundational layer. Below are the recommended specifications for an optimal hosting environment:

Component Minimum Requirement Recommended Specification
Processor (CPU) Intel Core i5 / AMD Ryzen 5 (4 Cores) Intel Core i7 / AMD Ryzen 7+ (8 Cores)
Graphics (GPU) NVIDIA GTX 1060 / AMD RX 580 NVIDIA RTX 3060 / AMD RX 6700 XT or higher
Memory (RAM) 16 GB DDR4 32 GB DDR4/DDR5
Network Gigabit Ethernet (Host) Gigabit Ethernet / Wi-Fi 6E/7 (5GHz/6GHz Client)

Note: While Wi-Fi can function for client devices, the host server must be connected via a physical Ethernet cable to the primary router to eliminate jitter and packet drop.

3. Step-by-Step Installation and Host Configuration

Follow these precise steps to set up the Sunshine host application on your primary gaming workstation.

Step 3.1: Installing Sunshine

  1. Navigate to the official Sunshine GitHub repository and download the latest stable release executable for your operating system (e.g., Windows Installer, Debian package).
  2. Execute the installer. On Windows, ensure you grant administrative permissions and allow the installer to configure firewall exceptions automatically.
  3. Once installed, Sunshine runs as a background service. Open your web browser and navigate to https://localhost:47990 to access the management interface.

Step 3.2: Securing the Web UI

Upon your first login, Sunshine will prompt you to create a secure username and password. Do not skip this step. Because Sunshine exposes system-level control, safeguarding this endpoint is paramount, especially if you plan to access your server over the open internet.

Step 3.3: Configuring Video Encoders

In the Sunshine Web UI, navigate to the Configuration tab, then select Audio/Video. Here, you should define your preferred encoder priority. For NVIDIA cards, prioritize nvenc; for AMD, select amf. Enabling HEVC (H.255) or AV1 (if supported by both host and client hardware) is highly recommended, as these codecs provide significantly superior visual fidelity at identical bitrates compared to standard H.264.

4. Client Deployment and Pairing Sequence

With the host server initialized, you can now link your client device via Moonlight.

The Pairing Process:

  1. Download and install Moonlight on your target client device (e.g., your laptop, tablet, or smartphone).
  2. Ensure the client device is connected to the same local area network (LAN) as your Sunshine host.
  3. Launch Moonlight. The client should automatically scan the subnet and display your host machine icon. Click on it.
  4. A unique 4-digit PIN will appear on your client screen.
  5. Switch back to your Sunshine Web UI, navigate to the PIN tab, enter the 4-digit code, and click Send.

Your connection is now cryptographically paired and secured. Moonlight will display available applications or your default desktop environment, ready for immediate streaming.

5. Advanced Optimization for Remote Network Traversals

While local streaming yields flawless results with minimal effort, streaming over WAN (outside your home network) requires advanced engineering considerations. To achieve an optimal off-site experience, implement the following networking topologies:

Option A: Implementing a Virtual Private Network (VPN)

Exposing raw ports directly to the internet via port forwarding presents severe security vulnerabilities. Instead, establish a secure overlay network using modern mesh VPN protocols like Tailscale or WireGuard.

"By installing Tailscale on both your Sunshine host and client devices, you establish an encrypted peer-to-peer tunnel. This allows Moonlight to communicate with your host as if it were on the exact same local network, completely bypassing strict NAT configurations without sacrificing security."

Option B: Manual Port Forwarding (Advanced/Optional)

If you choose not to use a VPN and require absolute maximum throughput with minimal overhead, you must open specific ports on your edge router directing to your host's static local IP. The critical ports include:

  • TCP: 47984, 47989, 48010
  • UDP: 47998, 47999, 48000, 48002, 48010

6. Fine-Tuning the Streaming Experience

To eliminate micro-stutters and input lag, fine-tuning configurations on both ends of the architecture is imperative.

Bitrate Allocation Guidelines

Bitrate selection must be relative to your target resolution and network bandwidth capacity:

  • 1080p at 60 FPS: Allocate 15 Mbps to 25 Mbps for crystal-clear fidelity.
  • 1440p at 60 FPS: Allocate 30 Mbps to 45 Mbps.
  • 4K at 60/120 FPS: Allocate 50 Mbps to 80 Mbps (Requires robust local infrastructure or high-speed fiber WAN).

Handling Resolution and Aspect Ratio Discrepancies

Streaming a 16:9 desktop to a 16:10 tablet results in distracting black bars. To solve this, utilize toolkits such as IddSampleDriver (Virtual Display Driver) on your host Windows machine. This creates a virtual secondary monitor that matches your mobile client's exact aspect ratio and refresh rate, preventing unnecessary scaling overhead on the GPU.

Conclusion: The Ultimate Private Cloud Sovereignty

By migrating from restrictive commercial services to a self-managed Sunshine and Moonlight ecosystem, you unlock unmatched sovereignty over your gaming experiences. You are no longer restricted by platform ecosystems, unoptimized servers, or subscription inflation. With your personal cloud gaming server configured correctly, your entire premium PC game library is accessible globally, running exactly as intended on a system you own, maintain, and control.

Building Your Ultimate Private Cloud Gaming Infrastructure: A Comprehensive Guide to Sunshine and Moonlight | DPTCloud