Valheim Dedicated Server Guide: Setup, UDP Ports, Crossplay, Mods

Run Valheim on a server that never sleeps, never wipes your world, and doesn’t choke in the middle of a boss fight. This guide gives you copy-paste setup for Windows, Linux, and Docker, plus ports, crossplay, backups, and fixes that actually work.
Valheim Dedicated Server Guide

Summarize this blog on:

Hosting your own Valheim dedicated server keeps your world online 24/7 and under your control. 

This guide provides a fast and clean setup for Windows, Linux, and Docker, featuring copy-ready commands and fixes that actually work. Use the Steam backend?

Forward UDP 2456–2457. Want crossplay? Add crossplay and share a Join Code, no port forwarding needed. Expect 10 players by default; raise the cap with mods only if you accept the trade-offs. 

Run the server on SSD/NVMe over a wired link to avoid stutter. Protect progress with -savedir outside the game install, and rotate saves with -saveinterval and -backups. 

You’ll learn how the server model works, how to avoid CGNAT traps, and how to recover fast from common errors. Start here, get a stable world today, and keep it stable as your group grows.

Key takeaways

  • You’ll run a Valheim dedicated server with clear steps for Windows, Linux, or Docker.
  • Steam backend: forward UDP 2456–2457 (2458 recommended to open as well).
  • Crossplay: add -crossplay, use the Join Code, no port-forwarding, keep servers vanilla.
  • Capacity: 10 players by default; higher caps need mods and bring trade-offs.
  • Hardware: fast single-core CPU (4–6 cores), 4–8 GB RAM vanilla, SSD/NVMe, wired Ethernet.
  • Saves: set -savedir outside the game folder, add -saveinterval and -backups, push nightly copies with rclone.
  • Networking: watch for CGNAT/IPv6; fix with a public IPv4, a VPS, or crossplay.
  • Edge rules: for the Steam backend, open UDP 2456–2458 in AWS/Azure/GCP and on your router; reserve a DHCP lease.
  • Control and stability: use adminlist.txt/bannedlist.txt, match Steam mods across clients, restart on a schedule, trim base clutter.

How a Valheim Dedicated Server Works

Before you install anything, understand the model. The server runs headless, keeps the world online, and saves progress on a schedule. Clients still simulate the area they stand in, while the server coordinates players, resolves conflicts, and writes the save files.

What the server handles:

  • World persistence (.db and .fwl files), autosaves, and backups you configure.
  • Player access control (admin, banned, permitted lists).
  • Session listing and connections (Steam or crossplay).

What the client handles:

  • Local zone simulation and many physics decisions.
  • Asset rendering and user input.

Why this matters: you gain uptime, a stable Valheim multiplayer server, and clear admin control. You also know where to fix issues, ports and routing live on the server; frame rate and visuals live on the client. Next, choose where to host so the setup matches your time, skills, and budget.

 

Pick Your Hosting Path

Choose the route that fits how much control you want and how much time you can invest.

Hosting option What you get What you manage Best for
Home PC / Mini-PC Full control with no monthly fee Port-forwarding, updates, and backups Small groups that play on a schedule
VPS / Cloud VM Static IP, snapshots, and remote shell access OS hardening and resource usage 5–10 players and weekend raids
Managed Host (Game Panel) One-click start, DDoS protection, panel backups Fewer low-level tweaks; plan limits/features Players who want to play more than manage
Bare-Metal Highest performance on dedicated hardware Longer setup, higher cost, full tuning Big builds or heavy Valheim server mods

Valheim Server Requirements

You picked a hosting path. Now size the box so it runs smoothly and stays that way.

Resource Recommended spec Practical notes
CPU Strong single-core; 4–6 modern cores Keep average CPU usage under ~70% during busy hours to avoid spikes and rubberbanding.
RAM 4–8 GB for vanilla;
8–16 GB for heavy mods
Aim to keep at least 2 GB free at all times to prevent save stutter and hitching.
Storage SSD or NVMe for saves and autosaves Store saves in a separate folder (not inside the game install). Watch disk queue; spikes during autosave = upgrade I/O.
Network Wired Ethernet, stable upstream Avoid Wi-Fi. Focus on stable latency and avoiding bufferbloat over chasing max Mbps.
OS Windows 10/11, or Linux with GLIBC ≥ 2.29 On older Linux distros, run the server in Docker to bypass outdated GLIBC.

Networking & Ports (Steam vs Crossplay)

Pick the backend first. Then open the right path for traffic.

Backend / Scenario Required actions Extra tips
Steam backend (direct UDP) Forward UDP 2456–2457 from router → server LAN IP; add inbound UDP rule on OS firewall Many admins also open 2458 UDP; reserve a DHCP lease so the server IP stays fixed; most port checkers probe TCP, use a real outside client to test
Crossplay (-crossplay) No port-forwarding; players connect with Join Code LAN IP joins often fail by design, use the code even on the same network; keep servers vanilla so Xbox/Microsoft Store clients can join
Multiple servers on one machine Give each server a unique base -port pair (e.g., 2456/2457, 2460/2461); separate -savedir paths For crossplay, add a unique -instanceid per server to avoid collisions

Featured Snippet Target,  Valheim Server Ports (UDP only)

  • 2456 = game/server
  • 2457 = query/Steam matchmaking
  • 2458 = optional third service port (open with 2456–2457 as a safe default)

Ports are set. Next, you’ll install on Windows, Linux, or Docker and bring the world online.

CGNAT & IPv6 Check (When Port-Forwarding Fails)

You opened the ports. Friends still can’t join. Check your upstream.

Spot CGNAT or double NAT

  • Log in to your router and note the WAN IP.
  • Compare it with a public IP check on your phone (mobile data).
  • If they don’t match, or the router shows 10.x.x.x, 192.168.x.x, or 100.64.0.0/10, you’re behind CGNAT or a second router.
  • If your ISP runs IPv6-only / DS-Lite, IPv4 port-forwarding won’t work.

Fixes that work

  • Ask the ISP for a public IPv4 or static IP.
  • Put the ISP modem in bridge mode, or place your router in the modem’s DMZ to kill double NAT.
  • Move the server to a VPS with a public IPv4.
  • Or switch to -crossplay and share the Join Code (no forwarding).

Test the right way

  • Start the server and try joining from a different network (friend’s house or phone hotspot).
  • Many “port checkers” probe TCP, not UDP. A real client join is the only test that matters.

Cloud Firewalls: AWS, Azure, GCP

Cloud networks block inbound traffic by default. Open UDP at the provider edge, then confirm the OS firewall.

Provider Where to configure Inbound rule (UDP) Apply to Keep outbound? Verify
AWS (EC2) Security Group on the instance 2456–2458 from 0.0.0.0/0 (or your player CIDRs) The instance’s Security Group Yes (server needs listings/updates) Connect from an external network; listings should appear
Azure (VM) Network Security Group (NSG) 2456–2458 to the VM Attach NSG to the NIC (or the subnet) Yes Check Effective Security Rules; test external join
GCP (Compute Engine) VPC firewall rule 2456–2458 allow Target by network tag; add tag to VM Yes Confirm rule hit counters; test from outside network

Finish on the OS

  • Windows: add an inbound UDP rule for 2456–2458.
  • Linux: ufw allow 2456:2458/udp.
  • Test with a real client from outside the network.

Router Mini-Guides (Quick Examples)

You opened cloud firewalls. Now forward UDP on the home or office router. Reserve a static LAN IP for the server first.

UniFi (Network/Application UI)

  • Settings → Firewall & SecurityPort ForwardingCreate New.
  • From: WAN. Protocol: UDP. Port: 2456–2458.
  • Forward IP: your server’s static LAN IP. Forward Port: 2456–2458.
  • Save. UniFi adds the WAN rule for you. Keep UPnP off for this host.

TP-Link (Archer series)

  • Advanced → NAT ForwardingVirtual ServersAdd.
  • Service Type: UDP. External Port: 2456–2458.
  • Internal IP: server’s DHCP reservation. Internal Port: 2456–2458.
  • Save, then restart the router if it asks.

ASUS (Merlin/stock)

  • WANVirtual Server/Port ForwardingAdd.
  • Port Range: 2456-2458. Local IP: server’s static LAN IP.
  • Local Port: 2456-2458. Protocol: UDP.
  • Apply. Prefer manual forwarding over UPnP.

Once the router sends UDP to the right box, move to setup. Start on Windows for the fastest path, then Linux and Docker if you need headless or portable.

Valheim Server Setup (Windows)

You can be online in minutes with the Steam tool.

Install and configure

  • Steam → Library → Tools → install Valheim Dedicated Server.
  • Manage → Browse local files. Copy start_headless_server.bat to start_my_server.bat.
  • Edit and set:
    • -name “YourServer”
    • -world “YourWorld” (matches your save name)
    • -port 2456
    • -password “ChangeMe!” (5+ chars)
    • -public 1 (or 0 for private)
    • -savedir “D:\ValheimSaves”
    • -saveinterval 900 -backups 4
    • Optional: -crossplay for Join Code access
  • Run the batch file. Allow the Windows Firewall prompt.
  • Wait for “Game server connected” in the console.

Test from a friend’s network (or a phone hotspot). Steam backend joins by IP: your.public.ip:2456. Crossplay joins with the Join Code.

Run as a Service (Survive Logouts)

Task Scheduler

  • Create Task → Run whether user is logged on or not; Highest privileges.
  • Trigger: At startup.
  • Action: Start a program → your start_my_server.bat.
  • Start in: the server folder path.
  • Conditions: uncheck sleep/battery limits. Test with Run.

NSSM (Windows service wrapper)

  • Install NSSM.
  • nssm install ValheimServer → point Application to your batch or valheim_server.exe.
  • Set Startup directory to the server folder.
  • In Details, set Restart on exit.
  • Start the service and confirm it survives logoff and reboots.

Your Windows host is live and resilient. Next steps in the full guide cover Linux with systemd for headless uptime, and Docker for easy updates and clean volumes.

Valheim Server Setup (Linux SteamCMD + systemd)

You want headless uptime and clean control. Linux gives you both.

Install and lay out directories

  • apt update && apt install -y steamcmd libatomic1 libpulse0
  • Create a user and paths:
    useradd -r -m -d /opt/valheim -s /bin/bash valheim
    mkdir -p /opt/valheim/{server,saves} && chown -R valheim:valheim /opt/valheim

Download or update the server

  • As valheim:
    /usr/games/steamcmd +login anonymous +force_install_dir /opt/valheim/server +app_update 896660 validate +quit

Create a systemd unit

  • /etc/systemd/system/valheim.service

[Unit]

Description=Valheim Server

After=network.target

[Service]

User=valheim

WorkingDirectory=/opt/valheim/server

ExecStartPre=/usr/games/steamcmd +login anonymous +force_install_dir /opt/valheim/server +app_update 896660 +quit

ExecStart=/opt/valheim/server/valheim_server.x86_64 \

 -name “YourServer” -world “YourWorld” -port 2456 -password “ChangeMe!” \

 -public 1 -savedir /opt/valheim/saves -saveinterval 900 -backups 4

Restart=on-failure

Environment=LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH

LimitNOFILE=100000

[Install]

WantedBy=multi-user.target

  • Enable and start:
    systemctl daemon-reload && systemctl enable –now valheim

Open the firewall

  • ufw allow 2456:2458/udp

You now have a stable, auto-updating service. Next, harden it so crashes and probes don’t take it down.

Hardening (Safe Defaults)

  • Run as the valheim user only (already set).
  • Add defense-in-depth in the unit:
    NoNewPrivileges=yes
    ProtectHome=yes
    PrivateTmp=yes
  • Keep logs tidy and visible:
    journalctl -u valheim -f for live view.
    Add logrotate only if you write to a file with -logFile.

This host is ready for production play. If you prefer portable updates and clean volumes, use Docker next and keep data in mounted paths.

Valheim Server Setup (Docker)

Docker keeps updates simple and saves portable. It also sidesteps old GLIBC on legacy distros.

Official helper script

  • In the server install folder, run:
    ./docker_start_server.sh start_server.sh
  • This wraps the stock server in a container and mounts the needed paths.

Community image with auto-updates and backups (lloesche)

  • Create persistent folders:
    mkdir -p $HOME/valheim-server/{config,data}
  • Run the container:

docker run -d –name valheim \

  –cap-add=sys_nice –stop-timeout 120 \

  -p 2456-2457:2456-2457/udp \

  -v $HOME/valheim-server/config:/config \

  -v $HOME/valheim-server/data:/opt/valheim \

  -e SERVER_NAME=”YourServer” \

  -e WORLD_NAME=”YourWorld” \

  -e SERVER_PASS=”ChangeMe!” \

  -e SERVER_PUBLIC=true \

  ghcr.io/lloesche/valheim-server:latest

Minimal Compose file

services:

  valheim:

    image: ghcr.io/lloesche/valheim-server:latest

    restart: unless-stopped

    ports:

      – “2456-2457:2456-2457/udp”

    volumes:

      – ./config:/config

      – ./data:/opt/valheim

    environment:

      SERVER_NAME: “YourServer”

      WORLD_NAME: “YourWorld”

      SERVER_PASS: “ChangeMe!”

      SERVER_PUBLIC: “true”

Expose UDP 2456–2457 on the host. Keep worlds in ./data so you can back them up or migrate fast. 

Saves, Backups, and Restores

You brought the server online. Now protect the world files so a crash never costs progress.

Default save paths

  • Windows: %USERPROFILE%\AppData\LocalLow\IronGate\Valheim
  • Linux: ~/.config/unity3d/IronGate/Valheim

Best practice

  • Set -savedir to a folder outside the game install (e.g., D:\ValheimSaves or /opt/valheim/saves).
  • Stop the server before copying saves to avoid a half-written .db.

Rotate saves automatically

  • Add -saveinterval 900 (every 15 min) and -backups 4 to keep rolling snapshots.
  • Keep off-box copies as well. Local backups don’t help after disk failure.

Restore safely

  1. Stop the server.
  2. Replace the target world’s .db and .fwl with your backup pair.
  3. Start the server and join to verify the date and progress.

Cloud Backups with rclone

Ship a nightly copy to cloud storage and verify integrity.

Cron job (Linux)

# Run at 02:15 daily

15 2 * * * rclone sync /opt/valheim/saves remote:valheim-saves –fast-list –transfers=8 –checkers=8 –backup-dir remote:valheim-saves/_archive/$(date +\%F)

Integrity check

# Generate and compare hashes at source and destination

find /opt/valheim/saves -type f \( -name “*.db” -o -name “*.fwl” \) -print0 | xargs -0 sha256sum > /tmp/local.sha256

rclone hashsum SHA-256 remote:valheim-saves > /tmp/remote.sha256

# Optional: also store /tmp/local.sha256 with the backup for auditing

Keep at least one weekly snapshot for a month. Test a restore to a staging server before you delete older sets.

Admin, Permissions, and Commands

Lock the server down and give trusted players the keys.

Access files (same dir as saves or your -savedir)

  • adminlist.txt ,  one ID per line gains admin rights.
  • bannedlist.txt ,  blocks listed IDs.
  • permittedlist.txt ,  if present, only listed IDs can join.

Find your ID

  • Join the server and press F2 to view your platform ID.
  • Or check the server console/logs for recent connections.

Core console (F5, admins only)

  • save ,  force a world save.
  • kick <player> ,  remove a player without banning.
  • ban <name|ip|id> ,  block a player.
  • unban <ip|id> ,  remove a block.
  • banned ,  list current bans.

Good hygiene

  • Keep adminlist.txt tight. Remove ex-admins.
  • Rotate the server password after a public event.
  • Back up the three control files with your world saves.

You now control access and recovery. 

Crossplay Guide (Steam, Microsoft Store, Xbox)

You want friends on Xbox and PC in the same world. Use crossplay. Start the server with -crossplay. The game will show a Join Code in the pause menu. Share that code. Players on Steam, Microsoft Store, and Xbox can join it. Xbox can join a crossplay server. Xbox consoles cannot run the dedicated server app; run it on PC or hosting hardware. 

Keep the server vanilla so Xbox clients can connect. Joining by LAN IP often fails in crossplay mode. Use the Join Code even on the same network.

Featured Snippet Target,  Enable Crossplay

  1. Add -crossplay to your launch flags.
  2. Start the server and note the Join Code.
  3. Share the code with your group.
  4. Players open Add Server → enter the code and connect.

Crossplay is set. If you plan to add mods, read the rules below so joins don’t break.

Mods and Compatibility

Mods can improve play, but they change the join rules. Install BepInEx on the server and on every Steam client. Match versions and configs across all players. Mismatches cause failed joins. 

ValheimPlus can raise player caps and add QoL. Test stability with a small set before you scale. Crossplay servers stay vanilla because Xbox and Microsoft Store clients can’t load gameplay mods.

Mods Compatibility Grid

Mod / Feature Server (Steam) Steam Client Xbox Client Crossplay Support
BepInEx (framework) Required for mods Required Not supported No (Steam-only)
ValheimPlus Yes Yes (same version/config) Not supported No
Common QoL mods (map, UI, slots) Yes Yes (match versions/configs) Not supported No
Vanilla only Yes Yes Yes Yes (use -crossplay)

Keep a single source of truth for mod versions and config files. Share them in a zip or use a mod manager profile. When in doubt, remove all mods, confirm vanilla joins, then add mods back one at a time.

World Modifiers and Presets

You don’t need mods to tune difficulty. Use presets and modifiers at launch. This keeps joins simple and repeatable across hosts.

Common flags

Setting Flag Example Effect
Preset -preset -preset casual Easier raids and deaths
Raids -modifier raids -modifier raids none Disables base raids
Death penalty -modifier deathpenalty -modifier deathpenalty hardcore Harsher item loss on death
Resources -modifier resources -modifier resources muchmore Higher resource yield
Portals -modifier portals -modifier portals casual Looser portal limits

Apply one preset, then add a few modifiers. Keep a copy of the launch line in version control so you can revert fast.

Multiple Servers on One Host

You can host several worlds on one machine. Keep ports, IDs, and saves separate.

  • Give each instance a unique -world name.
  • Assign a unique base port per instance:
    • Server A: -port 2456 (uses 2456 and 2457)
    • Server B: -port 2460 (uses 2460 and 2461)
  • For crossplay, add a unique -instanceid to each instance.
  • Point each server to its own -savedir. Back up each folder on its own schedule.
  • Windows: one batch file per server.
  • Linux: one systemd unit per server.

With instances isolated, focus on smooth play. Trim stutter and desync with the steps below.

Performance Tuning and Lag Fix

Small changes remove most pain. Start with storage and network, then trim in-game load.

  • Use NVMe or SSD for saves. HDDs stutter on autosave.
  • Keep CPU headroom. Aim for <70% during peak play.
  • Wire the host. Wired Ethernet beats Wi-Fi every time.
  • Reduce clutter near bases. Fewer lights, spawners, and loose items = fewer spikes.
  • Schedule restarts during low traffic. Force save first.
  • Watch autosave timing. If saves hit mid-combat, raise -saveinterval to a calmer window.

You now have a stable loop. If players see “Incompatible Version,” fix versions before chasing ports.

Version Sync Matrix

Keep server and clients on the same build. Match mods on Steam clients or joins will fail.

Fast checks

Symptom Server Build Client Build What to Do
“Incompatible Version” Older Newer Stop server → update via Steam/SteamCMD → start
“Incompatible Version” Newer Older Have players restart the platform to pull the patch
Stuck on “Connecting” Same Same Check mods; remove mismatched mods and retry
Join fails after patch Unknown Unknown Verify integrity on server files; clear cached mods on clients

Mod parity (Steam only)

  • Server uses BepInEx → every Steam client uses the same BepInEx version.
  • Server loads ValheimPlus → every Steam client loads the same ValheimPlus version and config.
  • Crossplay with Xbox stays vanilla.

Versions clean and aligned? Move on to the troubleshooting hub and hosting choices, or jump back to the install steps if you plan a fresh world.

Troubleshooting Hub

When players can’t join, move fast and test one change at a time.

Server not in the Community list

  • Forward UDP 2456–2458 to the server’s LAN IP.
  • Add an inbound UDP rule on the OS firewall.
  • Wait 3–10 minutes; refresh the list.
  • Join by direct IP as a quicker test.

Crossplay join fails on the same LAN

  • Use the Join Code. LAN IP joins often fail in crossplay mode.
  • Restart the server to issue a fresh code if needed.

“Incompatible Version”

  • Stop the server → update via Steam/SteamCMD → start.
  • Have players fully restart their platform clients.
  • If modded, match BepInEx/ValheimPlus versions and configs on all Steam clients.

GLIBC errors on Linux

  • Upgrade the distro to GLIBC ≥ 2.29 or run the server in Docker.

Ports show “closed” on web tests

  • Many tools probe TCP only. Your server uses UDP.
  • The real test is a join from a different network or a phone hotspot.

Server starts, then exits

  • Check password length (min 5 chars).
  • Verify -world name matches the save.
  • Read the last 20 lines of the log for hints.

Random disconnects or lag spikes

  • Wire the host. Avoid Wi-Fi.
  • Move saves to NVMe/SSD.
  • Cut clutter near bases; schedule restarts during off hours.

Forwarding worked, then broke

  • Reserve a DHCP lease so the server’s LAN IP never changes.
  • Watch for double NAT after ISP modem swaps or mesh installs.

If these don’t fix it, re-run the Networking & Ports checks, then the CGNAT section. Most cases fall into those buckets.

Best Valheim Server Hosting (How to Pick)

If you prefer to skip home networking, Valheim server hosting from a game provider works well. Pick on facts, not banners.

Non-negotiables

  • Region latency: pick the site closest to most players.
  • Storage: NVMe over HDD; faster autosaves, fewer stutters.
  • Backups: daily snapshots with one-click restore.
  • IPv4: public address included; no CGNAT.
  • Support hours: real humans during your play window.

Panel and access

  • SFTP or file manager for saves and configs.
  • One-click update and restart.
  • Clear logs and a live console.
  • Crossplay toggle and Join Code visibility.

Resources

  • Fair CPU share with a strong single-core.
  • RAM tiers that match your plan (8–16 GB for heavy builds or mods).

Policies

  • Transparent pricing after promos.
  • DDoS protection included.

Reality check

  • Ignore “unlimited slots” claims; the game defaults to 10.
  • For Valheim server mods on Steam, confirm full file access and community guides.
  • For a crossplay world, stay vanilla so Xbox and Microsoft Store clients can join.

Once you pick a host, you’ll use the same port and save practices from this guide. 

Why RedSwitches Dedicated Servers Are Built for Valheim

If you want to skip home networking and shared game hosting, RedSwitches dedicated servers give you the control Valheim needs.

  • Fast hardware: Modern CPUs with strong single-core performance and NVMe storage to keep autosaves and world loads smooth.
  • Unmetered bandwidth: Unmetered bandwidth on most plans, ideal for always-on Valheim worlds and busy evenings.
  • DDoS protection by default: Malicious traffic gets filtered before it hits your world, so public servers stay playable.
  • Full access: Root and IPMI access let you tune the OS, install mods, and run multiple Valheim instances on one box.
  • Global locations: Pick data centers close to your players to cut ping and desync.
  • Simple scaling: Start with a smaller machine, then move to higher-core or higher-RAM configs as your world and player count grow.

Combine this with the port, save, and backup practices from this guide and you get a Valheim server that feels stable, fast, and ready for long-term worlds.

FAQ

Q. How do dedicated servers work in Valheim?

A headless server runs 24/7, saves the world on a schedule, and coordinates players. Clients simulate the areas they stand in. Steam backend uses UDP 2456–2457; crossplay uses a Join Code.

Q. Is hosting a Valheim server safe?

Yes, if you harden it.

  • Strong password (5+ chars) and a non-admin OS user.
  • Open UDP 2456–2458 only; block everything else inbound.
  • Keep the OS and server updated; take off-box backups.
  • For public servers, use a host with DDoS protection.
  • At home, use -crossplay to avoid exposing ports.

Q. Can I turn a Valheim world into a server?

Yes. Copy the world’s .db and .fwl to your server -savedir, stop the server, set -world “ExactName”, then start it. Join and verify progress before inviting others.

Q. Does Valheim dedicated server need GPU?

No. It runs headless with -nographics. Prioritize CPU single-core speed, SSD/NVMe, and wired Ethernet.

Q. Do you need port-forwarding with crossplay?

No. Start with -crossplay and share the Join Code. Use the code even on the same LAN.

Q. How many players by default?

  1. 10. You can raise the cap with Steam-side mods, but expect trade-offs in stability and compatibility.

Fatima

As an experienced technical writer specializing in the tech and hosting industry. I transform complex concepts into clear, engaging content, bridging the gap between technology and its users. My passion is making tech accessible to everyone.