Frosty's Valheim Windows server guide v1.4

Feb 10th, 2021 (edited)
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Valheim Windows dedicated server setup guide v1.4 by @Frosty on Valheim Discord. (Accurate as of 11 Feb 2021, Version 0.143.5)
  3. This guide is intended for people who want to play Valheim with their friends online, and who want a persistent server rather than relying on one client to host. This use case assumes you'll host and play on the same PC on a LAN behind a typical router and friends will join from the internet.
  5. There's 6 basic steps to this guide, plus an additional step for patching the server, and then a detailed FAQ at the end:
  7. STEP 1 - Installing and configuring the server
  8. STEP 2 - Adding port forwarding rules to your router, this allows friends on the internet to connect through the router to your server
  9. STEP 3 - Opening ports on the servers firewall, to allow the traffic direct access to the Valheim server application.
  10. STEP 4 - Local testing
  11. STEP 5 - Friends connecting
  12. STEP 6 - Troubleshooting remote connections
  13. STEP 7 - Upgrading the dedicated server after a patch
  14. FAQ - Other server admin and network related questions
  16. ==============================
  17. STEP 1 - Installing the server
  18. ==============================
  20. Open your steam client, select the "Library" Tab, make sure the filter at the top left is set to "GAMES AND TOOLS", then use the search bar to search for Valheim. You should see "Valheim Dedicated Server" as one of the tools, right click it and select "Install".
  22. Once installed, right click Valheim dedicated Server in your steam list, select the "Manage" menu, and under that select "Browse local files", this will open up the installation directory.
  24. Inside the installation directory there's already a template batch file for starting the server which you can configure. Right click the file "start_headless_server.bat" and select "edit" to open it in notepad.
  26. The 7th line sets the properties of the server, set you preferred values for:
  27. Name - This is the name that appears in the server browser, make this descriptive.
  28. World - This is the name of the world used, make this unique you dont want it to match anyones local world names
  29. Password - Set a strong password, this is required and must be 5 characters or longer, you also can't make this the same as the server name or the world name, otherwise the server won't start.
  31. Save the file. You may also want to take an additional step of making a backup copy of this file just in case. if you have to update/patch or repair server files for any reason and you overwrite the bat file, you'll lose your settings. Simply make a copy of the file outside of the server installation directory.
  33. ====================================
  34. STEP 2 - Port forwarding your router
  35. ====================================
  37. First you need to know the IP address of your router to connect to it, to find open the start menu, search for "CMD" and run it, you should have a black command prompt windows, type:
  39. ipconfig
  41. And hit enter. You should have a list of network adapters, you need to make a note of 2 values, the "IPv4 Address" and the "Default gateway". The default gateway is your routers address, enter this IP address into the address bar of a browser window and you'll be taken to the login page for your router. You might need a username and password, typically these come on stickers printed on the router. If you don't know it and can't get it, contact your ISPs tech support.
  43. There's thousands of different types of router each with a different user interface, so precise instructions for the next part is impossible. You're looking for port forwarding options, these might be listed under submenus like "advanced", "firewall" or "security". Just work your way through the different menus until you find an option that allows you to add port forwarding rules.
  45. The goal is to forward 3 ports, the default port of 2456 and the next 2 (2457 and 2458) so they forward to your servers IP address. If your router allows port forwarding of a range of ports then use that, otherwise you'll need to create 3 rules, one for each port number.
  47. The key values you'll need are:
  48. internal/local start port 2456
  49. internal/local end port 2458
  50. internal/local IP address (this is the IPv4 address you got from the ipconfig results)
  51. External/remote start port 2456
  52. External/remote end port 2458
  53. Protocol TCP & UDP (you want both)
  55. Sometimes routers accept a range of ports but only have 1 text box to put the value in. In this case, use a hyphen to indicate a range, for example 2456-2458. If your router doesn't allow rules with ranges at all, then create 3 separate rules, one for each individual port 2456,2457, and 2458.
  57. Lastly, if you struggle with this section, make sure to check out this website has guides for how to port forward on many of the more common routers with much more specific instructions.
  59. ===============================
  60. STEP 3 - Opening firewall ports
  61. ===============================
  63. Windows as standard comes with windows firewall enabled, which blocks all incoming traffic unless you create rules to allow it. However some security software like anti-virus protection can disable windows firewall and install their own custom one. If you have a custom firewall you'll have to translate these instructions yourself.
  65. Open start menu and type in "firewall", select Windows Defender Firewall and then click on the "advanced settings". At the top left of the window you should see "Inbound Rules", select that, and on the right side click "New Rule..."
  67. In the new Rule Wizard, select the type of rule as "Port", click next. Select "TCP" and select "Specific local ports", type in the text box 2456-2458 and click next. Select "Allow the connection", click next. Make sure Domain, Private and Public are all ticked, click next. Give it a memorable name like "Valheim server TCP". click Finish. You need to repeat the above steps again with the same details, except rather than TCP, select UDP. You should now have 2 rules for both TCP and UDP traffic.
  69. Lastly, order the windows firewall rules by name, search through the list looking for rules with the exact name "valheim_server", windows might automatically create rules for the server executable valheim_server.exe that conflict with the rules you have, right click any of these rules and select "delete".
  71. ======================
  72. STEP 4 - Local Testing
  73. ======================
  75. First we want to test locally to make sure the server is running and configured correctly, this means if you have problems with friends connecting from the internet you can rule out server config as a problem and makes troubleshooting later on much simpler.
  77. Start the server by double clicking the "start_headless_server.bat" file, this should open a black CMD window, it will take a few seconds to initialize and should eventually read out a line with "Game server connected" which indicates it's finished loading. If you've not got this far then you've probably made a mistake in STEP 1, common mistake is a password missing or too short (at least 5 chars).
  79. If the server starts OK, then connect yourself to verify it's working properly. Open Steam, click the "View" menu at the top, and select "Servers", switch to the "Favorite" tab, right click and select "Add server by IP address" and in the text box type:
  83. is a special IP address that points to your own computer, and the listening port for connections is 2457 (1 port above the default)
  85. Double click the server, enter the password you set in STEP 1. It should launch the game and take you directly to the character selection screen, once you select or create a character, click OK it will connect you to the server. If you get a "server is not responding error" you might find that server listing is buggy, this is also a known problem. If you press F5 in the server list to refresh it, and then immediately double click to join, you should connect.
  87. Do not give to your friends to connect to from the internet as it won't work, make sure to give them your external/WAN IP address detailed in the next step.
  89. If you still cannot connect at this stage because you're not connecting through the router or firewall you can rule out STEP 2 and 3. This means something is wrong with the server install/config, double check the batch file looks correct, that your password meets the length requirements, that the server is starting correctly when you run it. One other problem at this stage where you cannot even connect locally might because you closed down the server incorrectly (clicking the X on the CMD window) which causes the window to close but the server process to run in the background still. In this case close down the server, CTRL + ALT + DEL and look through the process list for valheim_server and end any processes with this name. Then start the server again. If this was your problem, in future shut down the servers by opening the CMD window for the server and press CONTRL+C. It's important you do this because this way initiates a final save of your game state.
  91. ===========================
  92. STEP 5 - Friends connecting
  93. ===========================
  95. If steps 1-4 all worked now your friends need to connect. There are known bugs with the server listing, both in game with the custom server browser and with the steam server list for Valheim games. if your server name is not appearing for friends then they can connect to your server the same way you did during testing, except they will need to use your external/WAN IP address.
  97. To find this, browse to and it will tell you your external IP at the top under "My Public IPv4 is:"
  99. Add the port to the end of this address after a colon character. The connecting port is +1 to the port specified in the server config so by default is 2457 (2456+1). So for example if your IPv4 address was listed as 111.222.333.444 then you'd give them 111.222.333.444:2457 to connect to.
  101. Connect by opening Steam, click the "View" menu at the top, and select "Servers", switch to the "Favorite" tab, right click and select "Add server by IP address" and type in address. Make sure after it has been added to refresh the saver favourites with the f5 key. Connection attempts seem more reliable if done rapidly after a refresh of the server status, I have no idea why.
  103. If they still have problems connecting then you may have made a mistake in steps 2&3. Go back and double check all of the values are exactly what they should be, and if everything looks correct, move on to STEP 6 for troubleshooting common mistakes and problems.
  105. =========================================
  106. STEP 6 - Remote testing & troubleshooting
  107. =========================================
  109. Right now servers aren't being reliably listed in the server browser, it's a known issue affecting most people. If your server does not appear it may not necessarily be because you've made a mistake. Your friends should first try connecting directly as explained in STEP 5. If your friends cannot connect directly then there's a mistake somewhere in STEP 2 & 3, in the port forwarding or firewall rules.
  111. To rule out the firewall rules as a source of the problem you can disable your firewall completely. Only do this temporarily as a diagnostic to check if your firewall rules are the problem, but NEVER leave your firewall disabled permanently. If disabling the firewall fixes the problem then you know the firewall rules are wrong, if it doesn't then you know the port forwarding rules are wrong.
  113. If the firewall rules appear to be the problem, then re-enable the firewall and double check the rules you created are correct. If you're unsure then delete the rules and re-create them as described in STEP 3. Also double check to make sure windows hasn't automatically created conflicting firewall rules, it can create rules with the name of the server executable (valheim_server) and if these appear in your firewall rules list, delete them. The only valheim rules for the server you need are the ones you create yourself in STEP 3
  115. If disabling the firewall doesn't help then the port forwarding rules will be the problem. Double check the rules look correct, if they do look accurate then try rebooting the router, this has solved connection problems for some people.
  117. If you have a server that was previously working and it has suddenly stopped and friends can no longer connect to you, but you can connect yourself locally, then it's possible your IP has changed. Some ISPs have dynamic IP addresses which automatically change from time to time, in which case visit to check the WAN IP is the same, if it has changed give the new WAN IP and give that to your friends (remember to add the game port +1 to the end). A lot of ISPs can upgrade you to a static IP address if you call their support but might charge a small fee, this would prevent this problem from happening in future.
  119. Another possibility is the LAN IP address of your server has changed, in this case follow STEP 2 again, after using CMD to run ipconfig if the local/LAN IP has changed then simply log into your router and update your existing port forwarding rules to point to the new IP address of your server. You can also prevent this from happening again in future but it's beyond the scope of this guide. If you're interested in doing this search Google for guides on how to specify DHCP IP address ranges on your router, and how to set a static IP address on your server.
  121. Lastly if you still cannot connect to your server from the internet after all this troubleshooting, it's plausible that your ISP uses a technology called CGNAT or does port blocking. If nothing else in this guide works, try contacting your ISPs tech support and ask if this is the case, if they do either of these things hosting will be impossible.
  123. ======================
  124. STEP 7 - Game patching
  125. ======================
  127. If you've just setup your server for the first time you can skip this step for now as it will be the newest version already. The game is being patched frequently as it is in early access and under constant development. As such you'll need to patch the server to keep up with the client updates.
  129. First make sure that you've either taken a backup of your start_headless_server.bat OR you've at least made a note of the exact values for -name, -world, -port, and -password. The batch file will be overwritten during the update and you'll need to replace these values after the update. If the world name doesn't match after the update then you'll end up with a different/fresh game world.
  131. Stop the server CMD window from running, make sure to do this "safely" by selecting the CMD window for the server and pressing CTRL+C, this shut down method closes the sever properly and causes it to save the current state of the world on exit. Once shut down open steam, switch the "Library" tab, make sure "GAMES AND TOOLS" is selected as the filter top left. Then search for "Valheim Dedicated Server", right click it and select "Properties". In the properties window switch to the "LOCAL FILES" menu, and click the button "Verify integrity of game files...". This will re-acquire any updated game files and replace them automatically.
  133. Once this is done, edit the start_headless_server.bat file by right clicking it and selecting "edit", and on the line that starts with valheim_server make sure to replace the parameters with the old ones from your backup, the -name -port -world and -password
  135. Start your server again and you're good to go.
  137. Note: the -public parameter has been depreciated now, this can be removed from the list of parameters
  139. ========================
  140. Other server related FAQ
  141. ========================
  143. Q - What ports are needed for a dedicated server?
  144. A - Whatever port you've configured the server to use (default is 2456) and the next 2 ports above it (default 2457 and 2458)
  146. Q - What port should people connect to?
  147. A - The port +1 from the port configured in the server, default port is 2456 so you'd connect to 2457
  149. Q - Can I remove the password?
  150. A - No, despite what the documentation says, the current version of Valheim must have a password and it must be at least 5 chars long
  152. Q - How often does the server save the state of the world?
  153. A - Every 30m or when the server is closed down properly (pressing any key in the console window)
  155. Q - Can I change the backup interval?
  156. A - No, not yet
  158. Q - How can I add admins?
  159. A - Edit this text file C:\Users\<USERNAME>\AppData\LocalLow\IronGate\Valheim\adminlist.txt where <USERNAME> is your windows username. Add the Steam64 IDs for the steam users you wish to make admins, 1 ID per line. The steam64 ID is the 17 digit long number.
  161. Q - How do I get my steam 64 id
  162. A - Open Steam, click the "steam" menu at the top left, click "settings", and under the Account menu click the "View Account Details" link at the top right. It should list your steam ID at the top. If this is not 17 digits long, then you can use to convert/lookup your ID.
  164. Q - How do I access server commands
  165. A - Connect with a client whose Steam ID is in your adminlist.txt and press F5 in game to access the console
  167. Q - Is there a list of commands I can use?
  168. A - Yes, the following commands work on a dedicated server
  170. help
  171. kick [name/ip/userID]
  172. ban [name/ip/userID]
  173. unban [name/ip/userID]
  174. banned
  175. ping
  176. lodbias [0-5]
  177. info
  179. Q - Can I use the cheat commands on a dedicated server as admin?
  180. A - No, these are disabled for dedicated servers
  182. Q - Can I connect directly to an IP in game?
  183. A - No, use the steam server browser and add specific IP:port into your favorites. This is found in the steam client by clicking "View and then selecting "servers"
  185. Q - I can only see a subset of all the servers listed publicly and/or my server isn't listed, is this normal?
  186. A - Yes, the server list both in game and in steams master list are both buggy. it's recommended you use steams server list and add specific server IPs to your favourites tab.
  188. Q - What is the recommended maximum ping for players?
  189. A - Experience so far shows that the game struggles with pings above about 100ms and you may encounter problems
  191. Q - Does the game pause when there's no players connected?
  192. A - Yes, the game logic pauses when no one is connected, to reduce demand on the CPU.
  194. Q - Where are the game worlds saved?
  195. A - C:\Users\<USERNAME>\AppData\LocalLow\IronGate\Valheim\worlds where <USERNAME> is your windows username. The files are named after the world name and you need both the .db and .fwl
  197. Q - Can I move existing worlds from singleplayer to a dedicated server?
  198. A - Yes, there's an easy guide here
  200. Q - Can I increase the server player limit?
  201. A - No
  203. Q - How can I get my external/WAN IP address?
  204. A - Browse to and copy the IPv4 address. The connection port is +1 to the port configured in the server, by default 2457
  206. Q - How do I connect to my own server?
  207. A - If you host the server and use the game client on the same PC then you can connect using the local loopback address The connection port is +1 to the port configured in the server, by default 2457
  209. Q - Can I connect or test connection to my own server with my external/WAN IP?
  210. A - No, if you're testing from the server, or any other computer on the LAN you need to use the LAN IP address
  212. Q - How do I find my local/LAN IP address, and/or my gateway/router IP address?
  213. A - Hold windows key + R to open the run menu, type "cmd" and hit enter to open a command prompt. In there type "ipconfig" without quotes, and look for "IPv4" for your local address, and "Default gateway" for your router.
  215. Q - How do I get my routers username/password
  216. A - It's normally printed on the physical router on the back or bottom. If not you should contact your ISP tech support.
  218. Q - What happens if I get the error version mismatch when trying to connect
  219. A - There has been an update to the client and the server needs the same update, check out STEP 7 in this guide on how to do that.
  221. Q - My world loads but none of the buildings or objects do, how do I fix this.
  222. A - This is probably due to the filename of your world having its name changed. The name you chose for your world is referenced both as the file name but also inside the file itself, so it's not safe to simply rename your world files and use the renamed version on the server. To fix this rename your world file back to its original name. (this might be case sensitive, unconfirmed)
  224. Take care and stay safe.
  225. -Frosty
RAW Paste Data Copied