Skip to main content
Network configuration controls how Sunshine communicates with Moonlight clients, including port settings, encryption, and access restrictions.

Port Configuration

port
number
default:"47989"
Base port for the Sunshine service. Other ports are automatically offset from this value.Port Range: 1029-65514Default Ports:
  • 47989 - Base port
  • 47990 - HTTPS Web UI
  • 48010 - Video/Audio streaming
port = 47989
Changing the port will offset all other Sunshine ports accordingly.

Network Interface Binding

address_family
string
default:"ipv4"
Set the address family that Sunshine will use.Options:
  • ipv4 - IPv4 only
  • both - IPv4 and IPv6
address_family = both
bind_address
string
default:"All interfaces"
Bind Sunshine to a specific IP address. Leave empty to bind to all interfaces.Useful for systems with multiple network interfaces when you want to restrict Sunshine to one.
bind_address = 192.168.1.100
The address must be valid for the system and match the configured address family.

UPnP and External Access

upnp
boolean
default:"disabled"
Automatically open ports for streaming over the internet using UPnP.
upnp = enabled
Only enable if you need remote streaming over the internet and your router supports UPnP.
external_ip
string
default:"Auto-detect"
Manually specify external IP address. Leave empty for automatic detection.
external_ip = 123.456.789.12

Web UI Access Control

origin_web_ui_allowed
string
default:"lan"
Control which devices can access the HTTPS Web UI.Options:
  • pc - Only localhost can access
  • lan - Only LAN devices can access
  • wan - Anyone can access (not recommended)
origin_web_ui_allowed = lan
Setting to wan exposes your Web UI to the internet. Ensure you have a strong password.

Encryption Settings

lan_encryption_mode
number
default:"0"
Encryption mode for streaming over local network.Options:
  • 0 - No encryption (best performance)
  • 1 - Encryption if client supports it
  • 2 - Encryption mandatory (reject unencrypted)
lan_encryption_mode = 0
Encryption can reduce streaming performance, especially on less powerful hardware.
wan_encryption_mode
number
default:"1"
Encryption mode for streaming over the internet.Options:
  • 0 - No encryption (not recommended)
  • 1 - Encryption if client supports it (recommended)
  • 2 - Encryption mandatory
wan_encryption_mode = 1
It’s recommended to use encryption for internet streaming to protect your data.

Connection Timeouts

ping_timeout
number
default:"10000"
How long to wait (in milliseconds) for data from Moonlight before shutting down the stream.
ping_timeout = 10000

Example Configurations

Local Network Only (Default)

# Ports
port = 47989

# Network
address_family = ipv4
upnp = disabled

# Access Control
origin_web_ui_allowed = lan

# Encryption
lan_encryption_mode = 0
wan_encryption_mode = 1

# Timeouts
ping_timeout = 10000

Internet Streaming with UPnP

# Ports
port = 47989

# Enable UPnP for automatic port forwarding
upnp = enabled

# Optional: Set external IP manually
# external_ip = 123.456.789.12

# Access Control
origin_web_ui_allowed = lan

# Encryption (recommended for internet)
lan_encryption_mode = 1
wan_encryption_mode = 2

# Timeouts
ping_timeout = 15000

IPv6 Dual Stack

# Ports
port = 47989

# Enable both IPv4 and IPv6
address_family = both

# Optional: Bind to specific IPv6 address
# bind_address = 2001:db8::1

# Network
upnp = disabled

# Access Control
origin_web_ui_allowed = lan

# Encryption
lan_encryption_mode = 0
wan_encryption_mode = 1

Restricted to Specific Interface

# Ports
port = 47989

# Bind to specific network interface
bind_address = 192.168.1.100
address_family = ipv4

# Network
upnp = disabled

# Access Control (localhost only)
origin_web_ui_allowed = pc

# Encryption
lan_encryption_mode = 0
wan_encryption_mode = 1

Maximum Security

# Ports
port = 47989

# Network
address_family = ipv4
upnp = disabled

# Access Control (LAN only)
origin_web_ui_allowed = lan

# Mandatory encryption everywhere
lan_encryption_mode = 2
wan_encryption_mode = 2

# Shorter timeout
ping_timeout = 8000

Firewall Configuration

If you’re having connection issues, ensure these ports are open in your firewall:
  • TCP 47984-47990 - HTTP/HTTPS and control
  • UDP 47998-48000 - Video stream
  • UDP 48010 - Audio stream
  • UDP 48100-48110 - Control and input

Router Port Forwarding

For internet streaming without UPnP, manually forward these ports in your router:
  1. Log into your router’s admin interface
  2. Find the Port Forwarding section
  3. Forward these ranges to your host PC’s local IP:
    • TCP: 47984-47990
    • UDP: 47998-48010
    • UDP: 48100-48110
Assign a static IP or DHCP reservation to your host PC to prevent port forwarding from breaking.

Troubleshooting

  • Check firewall allows Sunshine ports
  • Verify origin_web_ui_allowed is not set to pc
  • Ensure client and host are on same network
  • Try disabling encryption temporarily: lan_encryption_mode = 0
  • Enable UPnP: upnp = enabled
  • OR manually forward ports in router
  • Check external IP is correct: external_ip
  • Verify ISP doesn’t block ports
  • Enable encryption: wan_encryption_mode = 1 or 2
  • Increase ping timeout: ping_timeout = 15000
  • Check network stability
  • Reduce bitrate in audio/video settings
  • Enable FEC (forward error correction)
  • Check origin_web_ui_allowed setting
  • Verify port 47990 (or base port + 1) is not blocked
  • Try accessing via https://localhost:47990
  • Check SSL certificate is valid
  • Verify router supports UPnP and it’s enabled
  • Check router logs for UPnP requests
  • Manually forward ports as fallback
  • Some ISPs block UPnP

Network Performance Tips

Local Network

  • Use wired Ethernet for best performance
  • Disable encryption for lower latency
  • Use 5GHz WiFi if wireless is required
  • Ensure router supports QoS

Internet Streaming

  • Enable UPnP for easier setup
  • Use encryption to protect data
  • Reduce bitrate for slower connections
  • Consider VPN as alternative to port forwarding

Next Steps

Applications

Configure games and apps to stream

Audio/Video Settings

Optimize streaming quality

Build docs developers (and LLMs) love