How to Port Forward a Valheim Server
A Valheim dedicated server talks over UDP, not TCP: the game port you pick (2456 by default) plus the next port up (2457), which clients use to query the server. To let friends outside your house connect, forward those UDP ports on your router to the server machine, and give that machine a reserved local IP so the rule never goes stale. If you’re hosting on a VPS instead of at home, you don’t port forward at all — you open the same ports in the provider’s firewall.
Why there are two ports, not one
The game port carries gameplay. Whatever you pass to -port (or leave at the default
2456) is where the actual session traffic flows. The port one above it answers
queries. That’s how the server browser and the game’s “is this server up?” check reach
you, so a server with only 2456 forwarded often connects by direct IP but never shows a
player count or appears in the browser. Valheim has historically reserved the range
2456–2458, so forwarding all three is harmless and saves you a second trip into the router
if a future build starts using the third.
They’re UDP. This is the single most common mistake. Router UI defaults are frequently TCP-only, or offer a “both” option that quietly only creates the TCP half. If your rule says TCP, it does nothing for Valheim.
Changing the game port shifts the query port with it. Run the server on -port 2466
and the query port becomes 2467. Forward the pair you actually configured, not the pair
from a guide.
Give the server machine a fixed local IP
A port-forward rule points at a specific local address like 192.168.1.42. Home routers
hand out addresses by DHCP and are free to hand out a different one after a reboot — at
which point your rule is pointing at a smart TV. Fix that first, one of two ways:
- DHCP reservation (preferred). In the router, bind the server’s MAC address to one address permanently. Everything stays automatic, and you can’t create an IP conflict.
- Static IP on the machine itself. Set it manually in the OS network settings, using an address outside the router’s DHCP pool.
Find the current address before you start. On Windows:
ipconfig
On Linux:
ip -4 addr show
Create the rule
Every router’s interface is different, but the fields are always the same. Look for Port Forwarding, Virtual Servers, or NAT under an advanced or gaming section, then add:
| Field | Value |
|---|---|
| Protocol | UDP |
| External / WAN port | 2456–2458 (or 2456 and 2457 as two rules) |
| Internal / LAN port | the same numbers |
| Internal IP | the server machine’s reserved address |
Keep the external and internal ports identical. Remapping — say, external 25456 to internal 2456 — breaks Valheim’s query behaviour, because the server advertises the port it thinks it’s on, not the one you translated it to.
Don’t forget the host firewall
Forwarding gets traffic to the machine; the machine’s own firewall decides whether to
accept it. On Windows, allow inbound UDP 2456–2458, or approve the prompt Windows shows the
first time the server binary runs. On a Linux host with ufw:
sudo ufw allow 2456:2458/udp
With firewalld:
sudo firewall-cmd --permanent --add-port=2456-2458/udp
sudo firewall-cmd --reload
If you run the server in Docker, the container also has to publish the ports — the
ports: mapping in your Compose file — and that mapping must be /udp. See
Running a Valheim Dedicated Server in Docker on Linux
for the exact block.
Test it from outside, not from your couch
Testing from inside your own network proves nothing: local traffic never touches the forward. Two reliable checks:
- Have a friend try to join by IP. In the game, Join Game → Join IP, then your public
address and the game port, e.g.
203.0.113.10:2456. This is the only test that matters. - Use a UDP port checker while the server is running. Note that most free “open port” tools only test TCP and will report a healthy Valheim server as closed. Read the tool’s description before you trust its verdict; a TCP-only result is meaningless here.
Your public IP is not the 192.168.x.x address from ipconfig — it’s the address your
router shows on its status page, or whatever an “what is my IP” lookup returns from the
server’s network.
When forwarding can’t work
Carrier-grade NAT. Many mobile and fibre ISPs put customers behind a shared public
address. You can create any rule you like; inbound connections never reach your router
because you don’t own a public address to receive them on. The tell: the WAN address on
your router’s status page is itself private (commonly in the 100.64.x.x range) and
differs from what an IP-lookup reports. Ask your ISP for a public or static IP, or host
elsewhere.
Double NAT. An ISP-supplied modem/router in front of your own router means two devices need forwarding rules, or the outer one needs to be in bridge mode. Symptom: the rule looks perfect and still nothing arrives.
A VPN on the host. If the server machine routes through a commercial VPN, inbound traffic arrives on the wrong interface. Exclude the server or drop the VPN on that box.
In all three cases the clean answer is to move the server somewhere with a real public address — see How to Host a Valheim Server on a VPS — or, for a purely private group, skip forwarding entirely and put everyone on a mesh VPN so the server only ever needs to be reachable on its LAN address.
Quick checklist when it doesn’t work
- Rule is UDP, not TCP.
- External and internal ports match.
- Internal IP still matches the machine (re-check after any reboot).
- Host firewall allows the same range.
- Server process is actually running and has finished loading the world.
- You’re testing from an outside network with the public IP.
Nine times out of ten it’s the protocol or a changed local IP. Fix the reservation once and the forward keeps working for years.