Advanced networking
While standard macvlan bridge networking provides dedicated local IP addresses for Steam Headless containers on a single home subnet, advanced deployments frequently demand custom network segmentation, integration with enterprise VLANs, secure reverse proxying, and streaming over the wider Internet (WAN).
This guide details advanced network configurations, explores the Linux kernel host-shim routing mechanism, provides reverse proxy templates, and outlines WebRTC NAT traversal via STUN and TURN relays.
Network port reference catalogue
Steam Headless runs multiple integrated streaming and discovery protocols. When configuring firewalls, port forwarding, or VLAN routing rules, refer to the following port matrix:
| Protocol | Port | Transport | Purpose | Scope |
|---|---|---|---|---|
| Web / Signalling | 8483 | TCP | HTTPS web interface, session authentication, WebSocket stream fallback, and REST APIs. | LAN / Reverse Proxy |
| WebRTC Media | 8483 | UDP | Low-latency WebRTC video (H.264) and audio (Opus) real-time streaming. | LAN / Direct WAN |
| Sunshine Web Admin | 47990 (or /sunshine) | TCP | Sunshine administrative interface (proxied via port 8483). | Internal / LAN |
| Sunshine RTSP | 48010 | TCP | RTSP session negotiation and streaming handshake for Moonlight clients. | LAN |
| Sunshine Video Stream | 47998 | UDP | RTP encrypted video packet delivery for Moonlight. | LAN |
| Sunshine Audio Stream | 48000 | UDP | RTP encrypted audio packet delivery for Moonlight. | LAN |
| Sunshine Control & Ping | 47999, 48002 | UDP | Real-time input handling (gamepad, keyboard, mouse) and connection keep-alive. | LAN |
| Sunshine Discovery | 47984, 47989 | TCP / UDP | Local LAN auto-discovery broadcasts and HTTP discovery services. | LAN Only |
| Steam Remote Play | 27031, 27036 | UDP | Valve Steam client broadcast auto-discovery on local subnets. | LAN Only |
| Steam Remote Play Data | 27036, 27037 | TCP | Steam In-Home streaming data and client pairing protocol. | LAN Only |
802.1q VLAN segmentation and custom IPAM
In enthusiast homelabs and enterprise environments, placing game streaming servers on an isolated VLAN (e.g. VLAN 20 - Gaming) prevents high-bandwidth 1080p/1440p video streams from saturating general home traffic or IoT devices.
1. Configure the 802.1q tagged interface on the host
If your switch trunk port sends tagged VLAN packets to the host physical interface (eth0), create a VLAN sub-interface on the host:
sudo ip link add link eth0 name eth0.20 type vlan id 20
sudo ip link set dev eth0.20 up
To persist this across reboots with NetworkManager:
sudo nmcli connection add type vlan con-name vlan20 dev eth0 id 20 ifname eth0.20
sudo nmcli connection up vlan20
2. Bind Docker macvlan to the tagged sub-interface
In docker-compose.yml, specify the VLAN sub-interface as the macvlan parent and configure a dedicated subnet:
services:
desktop-a:
# ... other configuration ...
networks:
gaming-vlan:
ipv4_address: 10.20.0.50
networks:
gaming-vlan:
driver: macvlan
driver_opts:
parent: eth0.20 # Attaches directly to tagged VLAN 20
macvlan_mode: bridge
ipam:
config:
- subnet: 10.20.0.0/24
gateway: 10.20.0.1
aux_addresses:
host-shim: 10.20.0.99
Macvlan modes: bridge versus private isolation
When deploying Docker macvlan networking, you can configure how virtual child interfaces attached to the same physical network card interact with one another. The Linux kernel macvlan driver provides multiple operational modes, primarily bridge and private.
Choosing between these modes involves a clear architectural trade-off between host management access and inter-container isolation.
Operational differences
- Bridge mode (
macvlan_mode: bridge): This is the Docker default. The Linux kernel acts as an internal Ethernet switch between all macvlan child interfaces attached to the same physical parent device. Packets sent between sibling containers are switched directly in kernel memory without traversing the physical network wire. - Private mode (
macvlan_mode: private): The Linux kernel enforces strict Layer 2 isolation between all macvlan child interfaces attached to the same physical parent device. Packets sent by a private macvlan interface are never delivered to sibling macvlan interfaces on the same host; unicast frames are directed exclusively to the physical wire, and sibling broadcast or multicast frames are dropped.
Trade-offs: bridge mode versus private mode
| Feature or capability | Bridge mode (macvlan_mode: bridge) | Private mode (macvlan_mode: private) |
|---|---|---|
| External LAN client access | Full access (Moonlight, browser portal, Steam Link). | Full access (Moonlight, browser portal, Steam Link). |
| Inter-container communication | Allowed: containers can ping and open connections to each other. | Blocked: containers cannot send or receive traffic between each other. |
| Steam multi-container discovery | Sibling containers discover each other; "Play" button changes to "Connect" or "Stream". | Sibling containers cannot discover each other; Steam retains independent "Play" buttons. |
| Host communication shim | Supported: the host can reach containers via sh-macvlan-shim. | Unsupported: the host shim ceases to route traffic to or from private containers. |
| Primary use case | Single-container deployments, or multi-container setups requiring host script or reverse proxy access. | Multi-container deployments where each desktop must operate as an independent gaming PC. |
The Steam multi-container discovery conflict in bridge mode
In a multi-container deployment using default macvlan bridge mode, each container has its own dedicated IP address on your home subnet, but the containers share the same underlying physical network interface and can freely communicate with one another.
Valve Steam uses local broadcast and multicast announcements (UDP ports 27031 and 27036) as well as direct TCP handshakes (ports 27036 and 27037) to discover other running Steam clients on the local subnet. When two or more Steam Headless containers run simultaneously under the same Steam user account (or with Steam Family Sharing enabled):
- Steam running in Container A detects the active Steam client in Container B across the macvlan bridge.
- If a user starts a game in Container B, Steam in Container A detects the running title on the same account.
- Instead of displaying the normal green Play button for that game, Steam in Container A changes the button to Connect or Stream, offering to stream the session remotely from Container B via Steam Remote Play.
- If a user clicks the button without noticing, Steam attempts an in-home streaming session from the sibling container rather than launching the game locally.
For home environments where multiple users or independent gaming sessions share a single host, this cross-talk can cause confusion and accidental stream hijacking.
Resolving cross-talk with private mode
Setting the macvlan network mode to private eliminates this discovery problem at the Linux kernel level:
networks:
session-lan:
driver: macvlan
driver_opts:
parent: eth0
macvlan_mode: private
ipam:
config:
- subnet: 192.168.1.0/24
gateway: 192.168.1.1
With macvlan_mode: private:
- The Linux kernel drops all Layer 2 frames sent between sibling macvlan child interfaces sharing
eth0. - Steam in Container A cannot receive broadcast or multicast announcements from Container B, and cannot initiate direct connections to Container B's IP address.
- Steam treats each container as a standalone, isolated gaming PC on the network. The Play button remains local and independent, regardless of what games are running in other containers.
- External client devices on your LAN (such as phones, tablets, laptops, and Moonlight handhelds) continue to reach each container normally at its assigned IP address.
The trade-off: impact on the host shim
While private mode cleanly resolves Steam cross-container discovery, it introduces an important trade-off: the host network shim ceases to work.
As described in The Linux host communication shim, the host operating system cannot route packets directly through the physical parent interface to its own macvlan child containers. The host shim works around this by creating a sibling macvlan interface (sh-macvlan-shim) on the host so that communication travels between macvlan siblings.
However, when containers are configured with macvlan_mode: private, the kernel enforces isolation against all macvlan child interfaces on the parent device, including the host shim:
- The host shim interface continues to exist in the operating system, but packets routed through it cannot reach private containers.
- Any return packets sent from a container configured in private mode are directed out to the physical wire rather than bridged internally to the host shim.
- Host-level health checks (
curl https://192.168.1.50:8483/api/v1/health), host backup scripts, and local host reverse proxies targeting container macvlan IPs will fail with connection timeouts.
Dual-network architecture: combining private macvlan with a management bridge
If your deployment requires both strict container isolation (to eliminate Steam cross-talk) and direct host access (for health checks, monitoring, or local reverse proxying), configure a dual-network architecture:
- Private macvlan network (
session-lan): Dedicated to LAN-facing game streaming, Moonlight, Steam Remote Play from external clients, and the browser streaming portal. Sibling isolation is enabled withmacvlan_mode: private. - Internal Docker bridge network (
host-management): An isolated internal bridge network connecting each container to the Docker host. The host can communicate with containers over their internal bridge IP addresses, completely bypassing the macvlan isolation boundary.
Here is an example docker-compose.yml implementing the dual-network pattern:
services:
desktop-a:
image: josh5/steam-headless:2
# ... additional container configuration ...
networks:
session-lan:
ipv4_address: 192.168.1.50
host-management:
ipv4_address: 172.28.0.10
desktop-b:
image: josh5/steam-headless:2
# ... additional container configuration ...
networks:
session-lan:
ipv4_address: 192.168.1.51
host-management:
ipv4_address: 172.28.0.11
networks:
session-lan:
driver: macvlan
driver_opts:
parent: eth0
macvlan_mode: private
ipam:
config:
- subnet: 192.168.1.0/24
gateway: 192.168.1.1
host-management:
driver: bridge
internal: true
ipam:
config:
- subnet: 172.28.0.0/16
gateway: 172.28.0.1
In this configuration:
- Game streaming traffic and client connections travel through the
session-lanmacvlan network. Sibling discovery between Desktop A and Desktop B is prevented bymacvlan_mode: private. - Host-level maintenance, health checks (
curl https://172.28.0.10:8483/api/v1/health), and host monitoring travel throughhost-management. - No host macvlan shim is required, keeping host network configuration simple and resilient across kernel or interface updates.
The Linux host communication shim
The host shim relies on kernel-level sibling communication and functions only when the Docker macvlan network uses macvlan_mode: bridge. If you configure macvlan_mode: private to isolate containers from one another, the host shim will not be able to communicate with the containers. See Macvlan modes: bridge versus private isolation for details and dual-network alternatives.
Why the host shim is required
A fundamental security feature of the Linux kernel macvlan driver is parent-child isolation: the host operating system cannot route packets directly to macvlan sub-interfaces attached to its own physical network card.
- Other machines on your LAN (such as client laptops, Moonlight devices, and mobile phones) can reach the container IP (
192.168.1.50) without issues. - The Docker host machine itself cannot ping or reach
192.168.1.50.
This becomes problematic if you run scripts on the host to monitor health (curl https://192.168.1.50:8483/api/v1/health), perform local backups, or automate container workflows.
Implementing the persistent host shim
To bridge this gap, create an isolated macvlan sibling interface on the host and assign narrow /31 or /32 routes targeting only the container IPs:
sudo nmcli connection add type macvlan \
con-name steam-headless-macvlan-shim \
ifname sh-macvlan-shim dev eth0 mode bridge \
ipv4.method manual ipv4.addresses 192.168.1.99/32 \
ipv4.routes '192.168.1.50/31,192.168.1.52/31' \
ipv6.method disabled connection.autoconnect yes
sudo nmcli connection up steam-headless-macvlan-shim
Verifying shim connectivity
Validate that the host kernel now routes container traffic over the shim:
# 1. Verify link status
ip -4 addr show sh-macvlan-shim
# 2. Check route resolution
ip route get 192.168.1.50
# Expected output: 192.168.1.50 dev sh-macvlan-shim src 192.168.1.99
# 3. Test ping and health endpoint from host
ping -c 2 192.168.1.50
curl --insecure https://192.168.1.50:8483/api/v1/health
Removing the host shim
If you reconfigure your network or decommission Steam Headless:
sudo nmcli connection delete steam-headless-macvlan-shim
Internet WAN streaming: STUN and TURN configuration
Connecting to Steam Headless from outside your local home network (over mobile 5G or hotel Wi-Fi) introduces Network Address Translation (NAT) and firewall traversal challenges.
Understanding WebRTC NAT traversal
WebRTC establishes peer-to-peer UDP connections using Interactive Connectivity Establishment (ICE):
Configuring STUN servers
STUN (Session Traversal Utilities for NAT) allows the browser and container to discover their public-facing IP addresses and port bindings. Public STUN servers are free, lightweight, and handle no video data.
Choose your STUN addresses with the remote browser streaming options, then add them to docker-compose.yml:
environment:
SHUI_STUN_URLS: 'stun:stun.cloudflare.com:3478,stun:stun.l.google.com:19302'
Configuring TURN relays for restrictive networks
When streaming from behind carrier-grade NAT (CGNAT) or restrictive public Wi-Fi, direct UDP may not work. A TURN (Traversal Using Relays around NAT) server provides a backup route for the encrypted WebRTC stream. TURN carries the video and audio, so choose a server with enough bandwidth and locate it reasonably close to you and your players.
Your TURN server must have a public IP address and use coturn's shared-secret authentication (use-auth-secret and static-auth-secret). Steam Headless uses that shared secret to create short-lived login details for each browser connection. The permanent secret must never be placed directly in an environment variable, Compose file, URL, screenshot, or support log.
The remote browser streaming options list the TURN settings used by the example below.
Open the TURN ports
Open or forward every port that you enable on the TURN server:
| Flow | Port | What it is for |
|---|---|---|
| Browser and Steam Headless to TURN | UDP 3478 | Preferred TURN and STUN connection. |
| Browser and Steam Headless to TURN | TCP 3478 | Optional fallback when a network blocks UDP. |
| Browser and Steam Headless to TURN | TCP 5349 | Optional encrypted turns: connection. |
| TURN server to both peers | UDP 49152-65535 | Default coturn relay range used to carry the stream. |
You can configure a smaller relay range in coturn, but the same range must be allowed through the server firewall and any router in front of it. If the TURN server is behind NAT, forward the listener ports and the complete UDP relay range, then configure coturn with its public and private addresses. For turns:, use a stable DNS name that points to the public address and install a valid TLS certificate for that name. An IP address or self-signed certificate is not suitable for browser-facing TURN over TLS.
Store the shared secret safely
Create a protected secret file next to your Compose project without printing its contents:
install -d -m 0700 secrets
install -m 0600 /dev/null secrets/shui-turn-shared-secret
openssl rand -hex 32 > secrets/shui-turn-shared-secret
Configure coturn's static-auth-secret with the exact value stored in that file. Then add the TURN addresses and the protected file mount to your Steam Headless service:
services:
steam-headless:
environment:
SHUI_STUN_URLS: 'stun:turn.example.com:3478'
SHUI_TURN_URLS: 'turn:turn.example.com:3478?transport=udp,turn:turn.example.com:3478?transport=tcp,turns:turn.example.com:5349?transport=tcp'
SHUI_TURN_CREDENTIAL_LIFETIME_MINUTES: '10'
SHUI_TURN_CLOCK_SKEW_SECONDS: '30'
SHUI_TURN_SHARED_SECRET_FILE: /run/secrets/shui-turn-shared-secret
secrets:
- source: shui-turn-shared-secret
target: /run/secrets/shui-turn-shared-secret
uid: '0'
gid: '0'
mode: 0400
secrets:
shui-turn-shared-secret:
file: ./secrets/shui-turn-shared-secret
Each address in the SHUI_TURN_URLS option must explicitly select transport=udp or transport=tcp. Do not add spaces between comma-separated addresses. Restart the Steam Headless container after changing these deployment settings. An invalid address, missing secret, or unreadable secret file stops the web interface with a clear error instead of quietly using an unsafe or incomplete setup.
The server reads the protected file and creates temporary TURN login details for each connection. The permanent shared secret is not saved in configuration settings and is never sent to the browser.
Verify that the relay is really being used
Seeing a TURN address in your configuration proves only that it was entered. To test the actual backup route, connect from outside your home network, temporarily disable the router's direct UDP 8483 forward, and start a browser desktop stream. Open Stream diagnostics with Ctrl+Alt+Shift+D. The connection description must say WebRTC via TURN and show UDP or TCP. Restore the UDP 8483 forward after the test.
If the stream fails or the diagnostics still show a direct WebRTC route, check the TURN listener ports, UDP relay range, public address, DNS name, certificate, shared secret, and both machines' clocks. A TURN URL on its own does not prove that media reached the relay.
Reverse proxy configurations
Placing a reverse proxy (such as Nginx, Traefik, or Caddy) in front of Steam Headless allows you to serve the web management interface and browser desktop over standard HTTPS port 443 with automated Let's Encrypt TLS certificates.
A reverse proxy handles HTTPS and WebSocket TCP signalling only. Real-time WebRTC media packets flow over direct UDP port 8483 (or via a TURN server). You must ensure UDP port 8483 is forwarded in your router directly to the container's macvlan IP address alongside your proxy's TCP 443 port.
Nginx reverse proxy configuration
# Map block to handle WebSocket Upgrade headers correctly
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 443 ssl http2;
server_name gaming.example.com;
# SSL certificates (managed by Certbot)
ssl_certificate /etc/letsencrypt/live/gaming.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/gaming.example.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
# Client upload limits for file transfers
client_max_body_size 500M;
location / {
# Point to Container A's dedicated macvlan IP
proxy_pass https://192.168.1.50:8483;
# Disable TLS verification if using the container's internal self-signed certificate
proxy_ssl_verify off;
# HTTP/1.1 and WebSocket upgrade headers
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
# Standard proxy headers
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Disable proxy buffering for interactive responsiveness
proxy_buffering off;
proxy_read_timeout 86400s;
proxy_send_timeout 86400s;
}
}
Caddy reverse proxy configuration
Caddy provides an exceptionally concise configuration with automatic HTTPS certificate generation:
gaming.example.com {
reverse_proxy https://192.168.1.50:8483 {
# Permit upstream self-signed TLS certificates from the container
transport http {
tls_insecure_skip_verify
}
# WebSocket support is enabled automatically in Caddy
header_up Host {host}
header_up X-Real-IP {remote_host}
}
}