Cloud gaming services like GeForce NOW and Xbox Cloud Gaming are convenient, but they come with subscription fees, game library limitations, and dependency on external servers. What if you could stream your own PC games to any device — phone, tablet, TV, or laptop — using your own hardware?

💡 This article contains affiliate links. If you buy through them, we earn a small commission at no extra cost to you. Learn more.

Enter Sunshine and Moonlight: an open-source, self-hosted game streaming solution that gives you complete control. Sunshine is a game streaming host that runs on your gaming PC or server, while Moonlight is the client app available on nearly every platform. Together, they deliver low-latency, high-quality game streaming over your local network or the internet.

This guide will walk you through everything you need to know: installing Sunshine on your host PC, setting up Moonlight clients, optimizing performance, and even streaming remotely via Tailscale.

What Are Sunshine and Moonlight?

Sunshine is an open-source implementation of NVIDIA’s GameStream protocol. It captures your PC’s screen and audio, encodes it in real-time using hardware acceleration (NVENC, AMF, or QuickSync), and streams it over the network.

Moonlight is the client application that receives the stream. Originally created to work with NVIDIA’s now-discontinued GameStream, it now works perfectly with Sunshine and supports:

  • Windows, macOS, Linux
  • Android and iOS
  • Raspberry Pi
  • Apple TV, Amazon Fire TV
  • Even web browsers via Moonlight Embedded

Why Choose Sunshine + Moonlight Over Commercial Solutions?

  1. Zero subscription fees — your hardware, your rules
  2. Full game library — stream any game you own, not just what’s in a service’s catalog
  3. Low latency — especially on local networks
  4. Privacy — no telemetry, no data collection
  5. Flexibility — stream entire desktop sessions, not just games
  6. Cross-platform — works on virtually any device

Prerequisites

Before you begin, you’ll need:

Host PC (Streaming Server)

  • Operating System: Windows 10/11, Linux, or macOS
  • GPU with hardware encoding:
    • NVIDIA (GTX 900 series or newer) — NVENC
    • AMD (RX 400 series or newer) — AMF
    • Intel (6th gen or newer) — QuickSync
  • Network: Wired Ethernet connection recommended
  • Open ports (if streaming remotely): 47984-47990 TCP/UDP

Client Device

  • Any device capable of running Moonlight
  • Stable network connection (Wi-Fi 5 or better recommended)
  • For best experience: Bluetooth or USB game controller

For a dedicated streaming server, consider a compact setup:

Step 1: Install Sunshine on Your Host PC

Windows Installation

  1. Download Sunshine

Visit the Sunshine GitHub releases page and download the latest Windows installer (sunshine-windows-installer.exe).

  1. Run the Installer

Double-click the installer and follow the prompts. Sunshine will install as a Windows service and start automatically.

  1. Access the Web UI

Open your browser and navigate to:

https://localhost:47990

You’ll see a certificate warning (self-signed certificate) — this is normal. Accept and proceed.

  1. Create Admin Account

On first launch, create a username and password for the Sunshine web interface.

Linux Installation (Ubuntu/Debian)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Add Sunshine repository
sudo add-apt-repository ppa:lizardbyte/sunshine
sudo apt update

# Install Sunshine
sudo apt install sunshine

# Enable and start the service
sudo systemctl enable sunshine
sudo systemctl start sunshine

For other distributions, check the official documentation.

Docker Installation (Advanced)

If you prefer containerization:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
version: '3.8'
services:
  sunshine:
    image: lizardbyte/sunshine:latest
    container_name: sunshine
    network_mode: host
    devices:
      - /dev/dri:/dev/dri  # For hardware encoding
    volumes:
      - ./sunshine/config:/config
      - /run/udev:/run/udev:ro
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Berlin
    restart: unless-stopped

Note: Host network mode is required for game streaming protocols to work properly.

Step 2: Configure Sunshine

Access the Sunshine web UI at https://localhost:47990.

Audio Configuration

  1. Navigate to ConfigurationAudio/Video
  2. Set Audio Sink to your primary audio device
  3. Enable Virtual Audio Device if you want to stream audio without it playing on the host PC

Video Encoding Settings

  1. Encoder: Select based on your GPU

    • NVIDIA: nvenc_h264 or nvenc_hevc (HEVC offers better quality at same bitrate)
    • AMD: amf_h264 or amf_hevc
    • Intel: qsv_h264 or qsv_hevc
  2. Resolution: Match your monitor or set maximum client resolution (1080p or 4K)

  3. Framerate: 60 FPS for smooth gaming (120 FPS if your client supports it)

  4. Bitrate:

    • Local network (1080p60): 20-30 Mbps
    • Local network (4K60): 80-100 Mbps
    • Remote streaming: 10-15 Mbps

Adding Applications

Sunshine can auto-detect installed games, but you can also add custom applications:

  1. Go to Applications tab
  2. Click Add New
  3. Fill in:
    • Application Name: Display name in Moonlight
    • Command: Full path to executable
    • Working Directory: Game installation folder
    • Image: Optional cover art

Example for Steam:

Application Name: Steam Big Picture
Command: "C:\Program Files (x86)\Steam\steam.exe" -bigpicture
Working Directory: C:\Program Files (x86)\Steam\

Network Configuration

  1. UPnP: Enable if your router supports it (automatic port forwarding)
  2. External Port: Default 47989 — change if needed
  3. LAN IP: Sunshine auto-detects this — verify it’s correct

Step 3: Install Moonlight Client

Download Moonlight for your target device:

Pairing Process

  1. Open Moonlight on your client device
  2. Sunshine host should appear automatically if on the same network
  3. Click the host name
  4. Enter the PIN displayed in Moonlight into the Sunshine web UI (Configuration → PIN)
  5. Click Pair

The pairing generates certificates for secure communication.

Step 4: Optimize Streaming Performance

Network Optimization

For Local Streaming:

  1. Use Ethernet: Both host and client if possible
  2. Disable Wi-Fi power saving on client devices
  3. QoS settings: Prioritize game streaming traffic on your router
  4. 5 GHz Wi-Fi: If wireless is required, use 5 GHz or Wi-Fi 6

For Remote Streaming:

  1. Static IP or DDNS: Set up dynamic DNS if your ISP doesn’t provide static IP
  2. Port forwarding: Forward 47984-47990 TCP/UDP to your Sunshine host
  3. Upload speed: Minimum 15 Mbps upload for 1080p60 streaming

Sunshine Performance Tweaks

  1. Enable Hardware Scheduling (Windows + NVIDIA):

    • Settings → Display → Graphics → Hardware-accelerated GPU scheduling
  2. Set Process Priority:

    • Sunshine web UI → Configuration → Advanced
    • Set min_threads to number of CPU cores
    • Increase encoder priority to “High”
  3. Disable Desktop Capture Optimizations:

    • For best quality, disable Windows Game Bar and other capture tools
  4. AMD Users: Install latest Adrenalin drivers for best AMF encoding

Moonlight Client Settings

  1. Resolution/FPS: Match what Sunshine is configured for
  2. Bitrate:
    • Local: 30-50 Mbps for 1080p60
    • Remote: 10-15 Mbps (adaptive)
  3. Video decoder: Use hardware decoding (automatic on most devices)
  4. Audio: Enable surround sound if your setup supports it
  5. Input latency: Disable V-Sync for lower latency

Step 5: Remote Streaming with Tailscale

For secure remote access without port forwarding, use Tailscale:

Install Tailscale

On Host PC:

1
2
3
# Download and install from tailscale.com
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up

On Client Device: Install Tailscale app from official website or app store.

Configure Moonlight for Tailscale

  1. Get your Sunshine host’s Tailscale IP:

    1
    
    tailscale ip -4
    
  2. In Moonlight, add a host manually using the Tailscale IP

  3. Pair as normal

Now you can stream from anywhere with Tailscale installed, securely and without opening ports.

Troubleshooting Common Issues

Black Screen on Client

Cause: Display capture permissions or encoding issues

Fix:

  1. Check Sunshine logs: Web UI → Troubleshooting → Logs
  2. Try different encoder (e.g., switch from HEVC to H.264)
  3. Update GPU drivers
  4. Windows: Grant display capture permissions to Sunshine service

High Latency / Stuttering

Causes: Network congestion, insufficient bitrate, encoding overhead

Fixes:

  1. Lower resolution or framerate
  2. Reduce bitrate by 25%
  3. Check network stability (ping your Sunshine host)
  4. Close background applications on host
  5. Use wired Ethernet connection

Audio Crackling

Cause: Buffer underruns or incorrect audio device

Fix:

  1. Increase audio buffer size in Sunshine settings
  2. Change audio sink to a different device
  3. Disable audio enhancements in Windows sound settings

Controller Not Working

Cause: Controller not properly mapped

Fix:

  1. Pair controller directly with client device (Bluetooth or USB)
  2. Moonlight will forward inputs to host automatically
  3. Check controller mappings in Moonlight settings

Can’t Find Host on Network

Causes: Firewall, mDNS issues, or network isolation

Fixes:

  1. Add host manually using IP address in Moonlight
  2. Windows: Allow Sunshine through Windows Firewall
  3. Check Windows Firewall → Allow an app → Sunshine
  4. Verify both devices are on same subnet (not guest network)

Advanced: Stream Desktop Without Monitor (Headless)

To stream your gaming PC without a monitor attached:

Virtual Display Adapter

Use a dummy HDMI plug:

Software Virtual Display

Windows: Use Virtual Display Driver

Linux: Configure a virtual display in X11/Wayland config

Performance Comparison: Sunshine vs GeForce NOW

FeatureSunshine (Self-Hosted)GeForce NOW
CostFree (hardware cost only)$9.99-$19.99/month
Latency (local)5-15msN/A
Latency (remote)20-50ms30-80ms
Game libraryUnlimited (your games)Limited catalog
Session lengthUnlimited1-6 hours
PrivacyCompleteData collected
Quality controlFull controlLimited presets

Security Best Practices

  1. Use Tailscale instead of port forwarding when possible
  2. Strong passwords on Sunshine web UI
  3. Keep Sunshine updated — check for releases monthly
  4. Certificate pinning: Moonlight remembers host certificates
  5. Firewall rules: Only allow necessary ports
  6. Disable UPnP if not needed to prevent automatic port exposure

Alternative Use Cases

Beyond gaming, Sunshine + Moonlight can:

  1. Remote desktop access: Stream your entire desktop
  2. Video editing workstation: Access GPU-accelerated apps from laptop
  3. Home media server UI: Stream Plex/Jellyfin interface to TV
  4. CAD/3D rendering: Remote access to workstation-class hardware

Conclusion

Sunshine and Moonlight provide a powerful, flexible, and completely free alternative to commercial game streaming services. With proper setup and network optimization, you can achieve near-native gaming performance on any device, anywhere.

The initial setup takes 30-60 minutes, but once configured, you’ll have a personal cloud gaming service that puts you in complete control — no subscriptions, no limitations, just your games, your way.

Start with local streaming to dial in your settings, then expand to remote access via Tailscale when you’re ready. The combination of modern GPU encoding and efficient network protocols makes self-hosted game streaming better than ever in 2026.

Next steps:

  • Experiment with different bitrates and encoders to find your sweet spot
  • Set up automatic game detection for Steam, Epic, and GOG libraries
  • Configure wake-on-LAN to start your gaming PC remotely
  • Join the Sunshine Discord for community support and advanced tips

Happy streaming!