Exposing a home gaming rig directly to the public internet is an unnecessary gamble. Sunshine requires a sprawling cluster of open ports—TCP 47984, 47989, 47990, 48010, and UDP 47998 through 48010—including an administrative web console. Opening that entire surface to port scanners and brute-force bots on Shodan just to play Cyberpunk 2077 from a hotel room is reckless. Yet the common alternative—routing your stream through a commercial exit-node VPN—destroys frame timing, bouncing 60 FPS video through congested third-party datacenters and adding 30 to 80 milliseconds of unnecessary round-trip jitter.
The right architecture is a dedicated, self-hosted WireGuard tunnel. WireGuard operates inside the OS kernel, uses high-speed ChaCha20-Poly1305 authenticated encryption, and remains completely silent: unauthorized UDP packets without a valid cryptographic handshake are silently dropped without an ICMP response.
However, many gamers who spin up a default WireGuard tunnel immediately hit a wall of micro-stutters, periodic frame drops, and bitrate collapses. This is rarely a horsepower issue. It is almost always caused by IP packet fragmentation, improper MTU sizing, and full-tunnel uplink saturation. At 365Finds, we tested and refined the exact network parameters required to deliver a pristine, tear-free 60+ FPS stream over remote WireGuard tunnels.
The Root Cause of VPN Streaming Stutter: The MTU Trap
Game streaming differs fundamentally from watching YouTube or Netflix. Video streaming platforms buffer several seconds of video in advance. Moonlight and Sunshine cannot buffer; every frame must be captured, encoded, transmitted over the wire, decoded, and presented within 16.6 milliseconds (for 60 FPS) or 8.3 milliseconds (for 120 FPS).
Sunshine slices video frames into high-throughput UDP packet bursts. Under standard Ethernet conditions, the Maximum Transmission Unit (MTU) is 1500 bytes. WireGuard wraps each original packet inside its own encrypted UDP envelope, adding encapsulation headers:
- IPv4 header: 20 bytes (or 40 bytes for IPv6)
- UDP header: 8 bytes
- WireGuard transport header: 32 bytes
- Poly1305 authentication tag: 16 bytes
This adds an absolute minimum of 60 to 80 bytes of overhead per packet.
If your WireGuard interface defaults to an MTU of 1420, but you connect your handheld client (such as a Steam Deck or ROG Ally) to a mobile 4G/5G hotspot, hotel Wi-Fi, or an ISP operating over PPPoE, the physical path MTU frequently drops to 1420, 1380, or lower. When an encapsulated WireGuard packet exceeds the underlying path MTU, intermediate routers must either fragment the packet into two separate IP packets or silently drop it.
Because UDP has no built-in acknowledgment mechanism, losing a single fragmented slice ruins the entire video frame. Moonlight's performance overlay flags this as "frame loss due to network," triggering micro-stutters and forcing the host to inject repair frames.
+--------------------------------------------------------------------------+
| Standard Frame (1500 Bytes MTU Path): |
| [ Original Video UDP Payload + WG Encapsulation ] <= Fits in one packet |
+--------------------------------------------------------------------------+
vs
+--------------------------------------------------------------------------+
| Fragmented Frame (Restrictive 1420 MTU Mobile Path): |
| [ Packet Part 1 (1360B) ] ===> Delivered |
| [ Packet Part 2 (80B) ] ===> Dropped / Delayed by carrier NAT |
| Result: Frame decoding fails -> Pipeline micro-freeze (Stutter) |
+--------------------------------------------------------------------------+
Finding Your True Path MTU
Instead of guessing, determine the maximum unfragmented payload between your remote client and your home host.
On Windows:
ping <Home-Public-IP> -f -l 1372
On Linux or macOS:
ping -M do -s 1372 <Home-Public-IP>
If the ping responds with Packet needs to be fragmented but DF set, lower the packet size by 10 or 20 bytes until the ping succeeds. Take that successful payload number and add 28 bytes (20 bytes for the IP header + 8 bytes for ICMP) to calculate your physical path MTU. Subtract at least 80 bytes for WireGuard encapsulation to find your tunnel MTU.
The Optimal MTU Settings
Through extensive cross-network testing at 365Finds, we found the following guidelines eliminate fragmentation stutters:
| Network Scenario | Physical Path MTU | WireGuard MTU= | Sunshine packet_size |
|---|---|---|---|
| Standard Fiber / Cable (Home to Home) | 1500 | 1420 | 1392 (Default) |
| PPPoE Broadband (DSL / Fiber) | 1492 | 1412 | 1384 |
| Cellular Hotspot (LTE / 5G) | 1420 - 1440 | 1360 | 1332 |
| Restrictive Carrier / International Roaming | 1380 | 1280 | 1252 |
Setting MTU = 1360 in the client's WireGuard configuration file is the universal sweet spot for mobile gaming. It cleanly accommodates LTE/5G carrier encapsulation without causing unnecessary IP fragmentation.
Split Tunneling: Protecting Home Upload Bandwidth
A common mistake is configuring the remote WireGuard profile as a full tunnel:
# INFERIOR CONFIGURATION (Full Tunnel)
AllowedIPs = 0.0.0.0/0, ::/0
When you route all client traffic through your home network, every background Windows update, Discord voice packet, cloud save sync, and browser tab on your client competes directly with the Sunshine video stream over your home internet connection's upload pipe. Most residential connections have asymmetric bandwidth (e.g., 500 Mbps download but only 25–40 Mbps upload). Saturating that upstream pipe triggers bufferbloat, spiking latency from 15 ms to over 150 ms instantly.
Instead, enforce split tunneling in your client configuration:
# OPTIMIZED CONFIGURATION (Split Tunnel)
AllowedIPs = 10.7.0.0/24, 192.168.1.0/24
This ensures only traffic destined for the WireGuard subnet (10.7.0.0/24) and your local home LAN (192.168.1.0/24) enters the encrypted tunnel. Moonlight communicates directly with Sunshine, while web browsing and handheld background downloads stay on the local hotel or mobile network.
Step-by-Step Configuration
1. The WireGuard Server Configuration (wg0.conf)
Deploy WireGuard on your home router (OpenWrt, pfSense, OPNsense) or a dedicated Linux home server (such as a Raspberry Pi or the gaming PC itself).
[Interface]
Address = 10.7.0.1/24
ListenPort = 51820
PrivateKey = <SERVER_PRIVATE_KEY>
# MSS Clamping ensures TCP handshakes respect the lower MTU
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; iptables -t mangle -D FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
# Remote Gaming Handheld / Laptop Peer
[Peer]
PublicKey = <CLIENT_PUBLIC_KEY>
AllowedIPs = 10.7.0.2/32
Note: Forward only UDP port 51820 on your home gateway to the WireGuard server IP. Do not forward any Sunshine ports.
2. The Remote Client Configuration (moonlight-remote.conf)
Import this configuration into the WireGuard app on your Steam Deck, ROG Ally, laptop, or smartphone:
[Interface]
Address = 10.7.0.2/32
PrivateKey = <CLIENT_PRIVATE_KEY>
DNS = 1.1.1.1
MTU = 1360
[Peer]
PublicKey = <SERVER_PUBLIC_KEY>
Endpoint = your-home-ddns.example.com:51820
AllowedIPs = 10.7.0.1/32, 192.168.1.0/24
PersistentKeepalive = 25
MTU = 1360: Eliminates fragmentation over cellular tethering and public networks.PersistentKeepalive = 25: Sends a tiny ping every 25 seconds to keep intermediate stateful NAT firewalls from expiring your UDP mapping while you play.
Sunshine and Moonlight Host Tuning
With the network tunnel stabilized, align Sunshine and Moonlight to match remote network realities.
Sunshine Host Adjustments
Open the Sunshine Web UI (https://localhost:47990) on your host machine:
- Configuration -> Audio/Video:
- Forward Error Correction (FEC) Percentage: Set between
15%and25%. Default values are tuned for zero-loss local LANs. Over a remote VPN tunnel, redundant parity packets allow Moonlight to reconstruct lost packets instantly without requesting a costly frame retransmission. - Packet Size: If you set your WireGuard MTU to
1360, set Sunshine'spacket_sizeto1332(or leave as auto if Sunshine automatically reads interface MTU).
- Forward Error Correction (FEC) Percentage: Set between
- Encoder Settings:
- Choose NVENC (NVIDIA), AMF (AMD), or QuickSync (Intel).
- Set the preset to P1 or P2 (fastest/performance). Encoding time must remain below 4 milliseconds to leave sufficient headroom for network transit.
Moonlight Client Adjustments
Open Moonlight on your remote device:
- Video Codec: Select HEVC (H.265) or AV1 instead of H.264. At equivalent bitrates, HEVC delivers significantly sharper visual fidelity and cleaner text.
- Target Bitrate: Cap the bitrate conservatively. For 1080p 60 FPS, set between 15 Mbps and 25 Mbps. Pushing 50+ Mbps over remote mobile networks provides marginal visual returns while dramatically increasing packet loss and bufferbloat risks.
- Frame Pacing: Select Balanced with lowest latency or Smooth video.
Pairing and Troubleshooting
Because WireGuard operates across subnets (e.g., client at 10.7.0.2, host at 192.168.1.100), Sunshine's automatic mDNS/UPnP discovery broadcast will not traverse the tunnel.
- Enable your WireGuard tunnel on the client.
- Open Moonlight and click the Add Host Manually (+) button.
- Enter your host gaming PC's internal IP address (e.g.,
192.168.1.100or its WireGuard IP10.7.0.1). - Moonlight will display a 4-digit PIN.
- In Sunshine's Web UI on your host PC, navigate to the PIN tab and authorize the pairing.
Real-Time In-Game Diagnostics
During streaming, press Ctrl + Alt + Shift + S (on PC/Mac) or hold L1 + R1 + Left + X (on gamepads) to display Moonlight's performance statistics.
- Network latency > 60 ms with stable frames: Physical distance to your home; unavoidable without changing locations.
- Network latency spikes + "Frame drops due to network": Classic MTU fragmentation or cellular signal fluctuation. Lower WireGuard MTU to
1280and drop Moonlight bitrate by 5 Mbps. - Host processing / decode latency spikes: Local hardware decoding bottleneck on your client handheld or slow GPU encoding on the host PC.
365Finds Verification Checklist
Before heading out with your remote gaming handheld, verify these four conditions:
- Sunshine web UI (
47990) is unreachable from the outside world without an active WireGuard handshake. - The WireGuard client profile uses split tunneling (
AllowedIPslimited to internal subnets). - The WireGuard client
MTUis configured to1360(or1280for restrictive mobile operators). - Moonlight streams at a capped 20 Mbps HEVC bitrate with zero network frame drops recorded in the performance overlay.