Valheim

Valheim

64 ratings
Setting up the Local Dedicated Server
By Matriarch
Setting up a computer as a dedicated server for remote players (that live elsewhere) to connect and play in the same World.
   
Award
Favorite
Favorited
Unfavorite
Set Static IP Address on Win10 PC
Private IP addresses assigned to your computer are dynamic and so to keep the address of the dedicated server static, you will need make the IP address of the computer hosting the server static.

Get IP Details of the computer that will be hosting the server:
  1. On the computer that will be hosting the server, type cmd in the Search field on the Task Bar.
  2. Right-click on the Command Prompt app and select Run as administrator.
  3. Type ipconfig and press keyboard ENTER.
  4. The following values will be displayed:
    • IPv4 Address
    • Subnet Mask
    • Default Gateway
  5. On the right-hand side of the Task Bar, right-click on the Network icon and select Open Network & Internet settings.
  6. Under Advanced network settings select Change adapter options.
  7. Right-click on Ethernet Connection or Wi-fi (whichever is your primary connection method to play the game - no names are given as these connections may have been renamed and are no longer the Windows default).
  8. Select Properties > Internet Protocol Version 4 (TCP/IPv4) > Properties button > Use the following IP address radio button.
  9. Enter the following details from the Command Prompt window:
    • IP address = IPv4 Address
    • Subnet mask = Subnet Mask
    • Default gateway = Default Gateway
    • Preferred DNS server = Default Gateway
  10. Select OK > Close and close the Network Connections window and Status window.
  11. In the Command Prompt window type exit and press keyboard ENTER.
Port Forwarding
Firstly, obtain the manual for the router's make and model as each one can be different.
This section is based on the Sagemcom FAST 5364 but the details in the rules that need to be created will be common to all routers.

Please note, the Valheim Dedicated Server instructions refer to ports 2456 and 2457 only; that may be all that is necessary but I entered all ports relating to the Valheim game and it worked for me.
  1. In a browser window, log on to the Router (probably 192.168.1.1) and navigate to Port Forwarding. On my router this is See internet settings > Manage advanced settings > Access control.
  2. Add an entry for the following port numbers and port ranges:

    Protocol
    Port(s)
    TCP - UDP
    2456-2457
    TCP
    27015-27030
    TCP
    27036-27037
    UDP
    4380
    UDP
    27000-27031
    UDP
    27036

    • Custom Service Name: anything meaningful to you; has no effect on the port forward
    • Service: Other
    • Protocol: TCP or UDP or both
    • External Host: leave blank or use * to denote Any
    • External Port and Internal Port: enter the same port number/range in both
    • Internal Host: static IP address of the computer hosting the server

  3. When all ports have been entered, select Apply.
  4. There are many tools to check whether the ports have been successfully 'opened' but rather than download anything, I recommend you follow Wikihow[www.wikihow.com].
You may need to Add a rule to the Firewall to allow someone who is not on your network to be routed through to the computer that is hosting the server.
  1. Navigate to Firewall settings and select the Custom tab.
  2. Add an entry for each player outside of your network (remote computer) and for each port number or port range:
    • Custom Name: the remote player's name is helpful
    • Service Name: Other
    • Protocol: TCP OR UDP or Both
    • Local IP: the static IP address of the computer hosting the server
    • Local Port: port number/range
    • Remote IP: the Public IP address of the player's computer that needs access. Note that the Public IP address is different to a Private IP address. Ask the player to browse ip4me[ip4.me] to view it.
    • Remote Port: leave blank
    • Action: Accept Both Way communication
On the Sagemcom router I also activated DMZ (demilitarized zone) for the computer hosting the server. See Wikipedia[en.wikipedia.org] explanation of what it is.
Configuring Local Valheim Server File
  1. Launch Steam on the computer that is hosting the Valheim Dedicated Server.
  2. Ensure the server is not running.
  3. Right-click on the Valheim Dedicated Server title in the Steam Library list.
  4. Select Manage > Browse local files and File Explorer will display the location of the files.
  5. Right-click the start_headless_server file and select Edit.
  6. The very last line in the file lists the parameters for the local dedicated server, enter text values between the double quotes " "; numerical values do not need the quotes:
    • -name "A custom name for your local dedicated server"
    • -port 2456
    • -world "The name that will appear in Steam's server list and cannot be the same as -name given for the dedicated server"
    • -password "A complex password that allows access to the local dedicated server"
  7. By default, the following parameter was not present in my file so I added it to the end of the parameter line.
    • -public 1
    1 means the -world will be publicly displayed in the Valheim server list and 0 means it is hidden.
  8. Save and close the file.
  9. Copy the file and save it in another folder (e.g. Program Files (x86)\Steam\Backups) so that if the start_headless_server file is overwritten with a Valheim Dedicated Server software update, you can overwrite the default with the backed-up customised settings.
15 Comments
I got that deer in me Mar 31, 2024 @ 9:10am 
Why does this shit have to be so complicated for people who don't know computers and just like to play the games? For fuck's sake, man. Just want to be able to play with friends.
Kwarde Mar 28, 2023 @ 12:05pm 
Also as mentioned before, advice to enable DMZ is quite terrible. If regular portforwarding isn't working you're doing something wrong. Fix the issue rather than going for such a "workaround". That's not what DMZ is for..

@Quineloe
`how do I declare someone admin on a server?`
Find the 'adminlist.txt' file (should be in the same directory as worlds_local directory). There you can add Steam Client/Account IDs.

@countgreen
`How can you reset the server/`
Stop the server, remove the world file(s) and then start again. Don't know the default path in Windows (I bet somewhere in AppData). Look for {WORLD_NAME}.db and {WORLD_NAME}.fwl files.
If you wish to reset the server with the same seed, only delete the DB file since the FWL file holds the seed. If you want to reset completely (with a new seed), obviously remove both the DB and FWL file(s).
Kwarde Mar 28, 2023 @ 12:04pm 
Only ports that need to be opened and forwarded are the port in server config and that port +1 (so default, 2465 and 2457), UDP protocol.
I've two Valheim servers running (on machine w/ Debian tho):
```
root: ~ -> # netstat -tulpn | grep valheim
udp 0 0 0.0.0.0:2457 0.0.0.0:* 1643131/./valheimsrv_pc
udp 0 0 0.0.0.0:2460 0.0.0.0:* 1643574/./valheimsrv_bh
udp6 0 0 :::54755 :::* 1643131/./valheimsr_pc
udp6 0 0 :::50778 :::* 1643574/./valheimsr_bh
udp6 0 0 :::2456 :::* 1643131/./valheimsr_pc
udp6 0 0 :::2459 :::* 1643574/./valheimsr_bh
```
Only opened ports are 2456,2457 and 2459/2460 (UDP only). Works perfectly. The other ports shown here are random ports.
countgreen Aug 22, 2021 @ 10:53am 
How can you reset the server/
TechieZero May 19, 2021 @ 6:21am 
I think it needs to be made clear --- that the connection port is 2456 --- or the # you set it to. Not the "+1".
Quineloe Apr 3, 2021 @ 7:05am 
how do I declare someone admin on a server?
Lord scones Mar 14, 2021 @ 11:05am 
or just get a docker container
Roy-7 Mar 14, 2021 @ 9:28am 
Helpful tip for residential internet users:

Your public IP address is likely not static, meaning the IP address of your self-hosted server may not stay the same all the time. If your router supports Dynamic-DNS, you could use one of the services it supports. That way, you can pick a name for your server like "PaulsServer.no-ip.com" and your router will keep No-IP.com updated with whatever your public IP address is. Most have a free version of the service you can use. The one I gave an example of, No-IP.com , will let you have a DNS name for free as long as you log in once a month to confirm that you are still using it.
Roy-7 Mar 14, 2021 @ 9:27am 
**PSA**
Don't activate DMZ on your router unless you really need to. That option is a last resort if normal port forwarding does not work, and even then, try to get port forwarding to work before using DMZ. DMZ basically means the computer/server at the DMZ IP address is completely exposed to the internet, bypassing most of the router's firewall features and allowing any traffic on any port to default to that address. DMZ makes your server vulnerable.
UKNightWatch Mar 14, 2021 @ 3:05am 
Finally got server seen on steam server list and in game. Yeah! What's this? Disconnected? For goodness sake.