← All articles
black metal post under cloudy sky

Sunshine + Moonlight: Self-Hosted Game Streaming for Your Homelab

Gaming 2026-03-04 · 4 min read sunshine moonlight game-streaming remote-desktop homelab gpu
By HomeLab Starter Editorial TeamHome lab enthusiasts covering hardware setup, networking, and self-hosted services for home and small office environments.

GeForce Now and Xbox Cloud Gaming stream games from data centers. But if you have a gaming PC sitting at home, you can stream directly from it — to a TV in another room, a laptop, a Steam Deck, or a phone — using Sunshine and Moonlight.

Photo by Michael Förtsch on Unsplash

Sunshine is an open-source implementation of NVIDIA's GameStream protocol. You run it on your gaming PC. Moonlight is the client that connects to it. Together they give you low-latency, high-quality game streaming with no subscription fees and no cloud middleman.

Sunshine configuration dashboard showing stream settings, connected clients, and active session with performance overlay

Why Sunshine + Moonlight Instead of Parsec or Steam Link?

Solution Latency Quality Remote Access Cost Open Source
Sunshine + Moonlight Very low 4K 120fps Yes Free Yes
Steam Link Low 4K 60fps Limited Free No
Parsec Low Up to 4K Yes Free/paid No
GeForce Experience GameStream Low 4K Yes (deprecated) Free No

NVIDIA deprecated their GameStream protocol. Sunshine picked up the torch and improved it — adding support for AMD and Intel GPUs, Linux hosting, HDR, and 4K 120fps.

Hardware Requirements

Host (streaming server):

Client (where you stream to):

Installing Sunshine on Windows

Download the installer from the Sunshine releases page and run it.

After installation, Sunshine starts automatically and opens a web interface at https://localhost:47990.

First-time configuration:

  1. Set a username and password (required on first access)
  2. Configure the encoder: Go to Configuration → Encoder
    • NVIDIA: Select nvenc (hardware encoder — lowest CPU overhead)
    • AMD: Select amf
    • Intel: Select quicksync
    • Software fallback: libx264 (uses CPU — higher overhead)
  3. Set resolution and framerate: 1080p/60fps for most use cases, 4K/60fps if your GPU and network support it

Like what you're reading? Subscribe to HomeLab Starter — free weekly guides in your inbox.

Installing Sunshine on Linux

For Ubuntu/Debian:

# Download the appropriate .deb from GitHub releases
wget https://github.com/LizardByte/Sunshine/releases/latest/download/sunshine-ubuntu-22.04.deb
sudo apt install ./sunshine-ubuntu-22.04.deb

For Arch Linux:

yay -S sunshine

Sunshine on Linux requires access to the display server. For X11:

# Add udev rules for input capture
echo 'KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"' | \
  sudo tee /etc/udev/rules.d/85-sunshine.rules
sudo udevadm control --reload-rules && sudo udevadm trigger

For Wayland (experimental), some input capture features are limited.

Connecting with Moonlight

  1. Install Moonlight on your client device (available on all platforms)
  2. Launch Moonlight — it will auto-discover Sunshine hosts on the same network
  3. Click your host → you'll be shown a PIN
  4. Enter the PIN in Sunshine's web UI (Clients tab → Pair)
  5. Start streaming

For remote access (outside your home network), you'll need port forwarding or Tailscale (see below).

Adding Applications and Games

Sunshine's web UI lets you add any application as a streamable target:

  1. Go to Applications → Add New
  2. Set:
    • Application Name: What shows up in Moonlight
    • Command: The executable path (e.g., C:\Program Files\Steam\steam.exe)
    • Working Directory: Usually the same as the command path
  3. Optional: Set a cover image for the Moonlight grid

Pre-configured apps usually include Desktop (streams the full desktop) and any games Sunshine detects.

To stream Steam games, add Steam as an application and launch games through Steam's Big Picture mode, or add individual games directly.

Performance Optimization

Bit rate: The most important setting. Start at 20 Mbps for 1080p/60fps. For 4K/60fps, 50–80 Mbps. Reduce if you see packet loss.

Encoder preset: In Configuration → Encoder:

Color mode:

Audio: Sunshine supports 5.1 and 7.1 surround passthrough if your setup supports it.

Remote Access with Tailscale

To stream outside your home network without port forwarding:

  1. Install Tailscale on both the host (Sunshine) and client (Moonlight) machines
  2. Both devices will get Tailscale IPs (e.g., 100.64.x.x)
  3. In Moonlight, add the host manually using the Tailscale IP

Tailscale's WireGuard-based tunnel provides secure, low-overhead connectivity. Latency will increase for remote connections, but for typing tasks and slow-paced games it works well. Fast-paced gaming generally needs a low-latency local connection or fiber-grade internet.

Port Forwarding (Alternative to Tailscale)

If you prefer direct port forwarding:

Protocol Port Purpose
TCP 47984 Control stream
TCP 47989 HTTPS management
UDP 47998 Video stream
UDP 47999 Audio stream
UDP 48000 Video stream (alt)
UDP 48010 Video stream (alt)

Forward these ports on your router to the Sunshine host. Use a DDNS service if your public IP is dynamic.

Sunshine as a Remote Desktop

Sunshine isn't just for gaming. It works excellently as a general remote desktop:

For text-heavy remote work, any solution works. For anything graphical (video editing, design, 3D work), Sunshine + Moonlight's hardware-encoded stream is noticeably smoother than RDP.

Common Issues

Black screen on connect: Usually means Sunshine can't capture the display. Check that a monitor (real or virtual) is attached to the GPU. Use a HDMI dummy plug if the host has no monitor.

High latency: First check ethernet vs WiFi. Then reduce bitrate. Then check encoder — software encoding (libx264) is much higher latency than hardware.

Pairing fails: Ensure Windows Firewall allows Sunshine through (the installer usually handles this). On Linux, check that ports aren't blocked by UFW.

Low frame rate on client: Increase bitrate, ensure the client network is fast enough. Check host GPU usage — if it's pegged at 100%, reduce game quality settings.

Summary

Sunshine + Moonlight is the best self-hosted game streaming solution available. It delivers hardware-accelerated 4K streaming with sub-20ms latency on a local network, works with any GPU (not just NVIDIA), and streams to every major platform.

Set it up once, pair your devices, and you can play your gaming PC library from any room — or remotely with Tailscale.

Get free weekly tips in your inbox. Subscribe to HomeLab Starter