Skip to main content

Configure a macvlan network

Docker macvlan networking assigns each Steam Headless container its own unique virtual MAC address and dedicated local IP address (for example, 192.168.1.50 for Desktop A and 192.168.1.51 for Desktop B).

To your home router, switches, and client devices, each container looks like an independent physical computer connected to your local network.

Check Your Host and Network First

Macvlan is available only when Docker runs on a Linux host in normal rootful mode. It is not available with Docker Desktop or rootless Docker. Your router and network switch must also allow more than one MAC address on the server's Ethernet port. Managed switches may call this setting port security or a MAC address limit. If you cannot change that limit, use host networking for a single container. The Docker macvlan guide explains these host and network requirements in more detail.


Why each container needs its own address​

When running two or more gaming desktops on a single server, a dedicated-address network such as macvlan avoids port clashes and keeps each desktop easy to find:

  • Zero port conflicts: Each container has its own full port range. Multiple containers can each run Sunshine and SHUI without port collision.
  • Native client discovery: Moonlight clients on your LAN automatically discover each gaming rig by its distinct IP and broadcast address.
  • Clean network isolation: Traffic between gaming sessions and other server workloads remains neatly segregated.
Wired Ethernet Required

Macvlan networking requires a physical wired Ethernet interface (eth0, eno1, enp3s0). Wi-Fi normally allows only one MAC address for the connection, so macvlan containers cannot communicate reliably through it. If your host is on Wi-Fi, use host networking instead. Unraid users should follow the Unraid networking guidance to select macvlan and enable host access to custom networks through the current WebGUI.


Pre-flight network discovery​

Discover your host network parameters before configuring Docker:

1. Discover your default network interface and gateway​

Run:

Terminal
ip -4 route show default

Example output:

default via 192.168.1.1 dev eth0 proto dhcp src 192.168.1.10 metric 100

Note:

  • Parent physical interface: eth0
  • Gateway IP address: 192.168.1.1

2. Discover your subnet mask​

Run:

Terminal
ip -4 addr show eth0

Example output:

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
inet 192.168.1.10/24 brd 192.168.1.255 scope global dynamic eth0

The /24 suffix indicates your subnet range is 192.168.1.0/24.

3. Reserve static IP addresses outside your DHCP pool​

Log in to your router's admin panel and check your DHCP range (for example, 192.168.1.100 to 192.168.1.254). Choose static IPs outside that pool:

  • Desktop A: 192.168.1.50
  • Desktop B: 192.168.1.51
  • Host Shim (Optional): 192.168.1.99

Configuring Macvlan​

In your docker-compose.yml, define the session-lan network under the top-level networks: block and assign static IPs to each service:

docker-compose.yml
services:
desktop-a:
# ... container configuration ...
networks:
session-lan:
ipv4_address: 192.168.1.50

desktop-b:
# ... container configuration ...
networks:
session-lan:
ipv4_address: 192.168.1.51

networks:
session-lan:
driver: macvlan
driver_opts:
parent: eth0 # Replace with your host physical interface
macvlan_mode: bridge
ipam:
config:
- subnet: 192.168.1.0/24 # Your local subnet
gateway: 192.168.1.1 # Your local router gateway
aux_addresses:
host-shim: 192.168.1.99 # Reserving this IP prevents Docker assigning it

Do I Need Host Firewall Rules for Macvlan?​

No. Under Linux macvlan networking, incoming Ethernet frames destined for a container's virtual MAC address are switched directly by the kernel's macvlan driver into the container's virtual network interface.

Because this traffic enters directly from the physical wire into the container, it completely bypasses the host's iptables and nftables filter rules. Other PCs, laptops, Steam Decks, and phones on your LAN can reach the container directly without you having to open ports in host firewalld or ufw.


Multi-container isolation and Steam Remote Play

By default, macvlan bridge mode allows containers on the same host to communicate with each other. If you run multiple gaming desktops with the same Steam account and want to prevent Steam from detecting sibling instances or offering Remote Play "Connect" buttons, see Macvlan modes: bridge versus private isolation in the advanced networking guide.


The Macvlan Host Shim (Optional)​

When is the host shim needed?​

A fundamental security design in the Linux kernel prevents a physical network interface (the macvlan parent) from communicating directly with its own virtual child interfaces (the containers).

  • External clients (your laptop, desktop, TV, phone, or Steam Deck) connect directly to 192.168.1.50 without any issue.
  • The host server itself, however, cannot reach 192.168.1.50 by default.

For most dedicated server deployments, you do not need the host shim. The host server simply runs the containers while you play from other devices.

However, if you wish to connect to the gaming container from a browser running on the same physical host machine, or run host-side automation scripts against the container's API, you can set up a Host Shim.


Setting up the Host Shim​

Terminal
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' ipv6.method disabled connection.autoconnect yes

sudo nmcli connection up steam-headless-macvlan-shim

Method B: Unraid OS​

In Unraid, follow the Unraid networking guidance: stop the array, set Enable bridging to No under Settings > Network Settings, then set Docker custom network type to macvlan and Host access to custom networks to Enabled under Settings > Docker. Unraid then provisions and manages the host shim.


→ Next step: Configure Steam Headless.