Forums Archived

This forum has been archived. No new posts can be made and no new users can sign up. It remains here for reference only.

Find the new forums here

Valheim Server not listening

  • Last Post 16 November 2021
EvoSlice posted this 16 February 2021

OS Name/Version: Ubuntu 20.04.2 LTS

Product Name/Version: Amp Instance Manager v2.1.0.8

Problem Description: Valheim Server is running but not listening on any ports. I can connect to the server from another computer on the network using the local address of the server running AMP and the port Valheim is using (5679 in this case)

Steps to reproduce:

  1. Create new Amp Instance with Valheim module
  2. Port forward the 3 bound ports (5678-5680) for TCP/UDP
  3. Attempt and fail to find server in Valheim list
  4. Attempt and fail to add server to favorites in Steam by external IP address
  5. Successfully add server to Steam favorites by internal IP address

Actions taken to resolve so far:

I've looked at ports associated with the Valheim process and I see this:

valheim_s 17204             amp    3u  IPv4 160582      0t0  TCP> (CLOSE_WAIT)
valheim_s 17204             amp    5u  IPv4 160584      0t0  TCP> (CLOSE_WAIT)
valheim_s 17204             amp    6u  IPv4 160583      0t0  TCP> (CLOSE_WAIT)
valheim_s 17204             amp   10u  IPv4 160585      0t0  TCP> (CLOSE_WAIT)
valheim_s 17204             amp   26u  IPv4 163425      0t0  UDP *:5679 
valheim_s 17204             amp   28u  IPv4 163428      0t0  TCP> (ESTABLISHED)

The same output for another instance working properly (7DaysToDie Module):

7DaysToDi 36529             amp   20u  IPv4 317899      0t0  TCP *:27016 (LISTEN)
7DaysToDi 36529             amp   25u  IPv4 308985      0t0  TCP> (ESTABLISHED)
7DaysToDi 36529             amp   26u  IPv4 324706      0t0  TCP> (ESTABLISHED)
7DaysToDi 36529             amp   27u  IPv4 321758      0t0  UDP *:26902 
7DaysToDi 36529             amp   28u  IPv6 321759      0t0  UDP *:26902 
7DaysToDi 36529             amp  138u  IPv4 325945      0t0  UDP *:26900 
7DaysToDi 36529             amp  140u  IPv4 325946      0t0  TCP> (ESTABLISHED)
7DaysToDi 36529             amp  146u  IPv4 330939      0t0  TCP *:26900 (LISTEN)

It seems odd to me that Valheim isn't listening on any ports, but I can't say for sure that it should be.

Thanks in advance for any assistance.

Order By: Standard | Newest | Votes
Mike posted this 16 February 2021

Use ampinstmgr ports as the AMP user to check the network status for those instances instead of netstat.

Also try moving Valheim to its default port range of 2456 thru 2458

EvoSlice posted this 16 February 2021

Hi Mike,

I updated the ports to 2456-2458 along with my port forwarding.

This is the output of the ports command

[Info] AMP Instance Manager v2.1.0.8 built 16/02/2021 12:05
[Info] Release spec: Release - built by CUBECODERS/buildbot on CCL-DEV
[Info] Port usage for Valheim01 (ValheimServer)
[Info] Instance is currently running.
[Info] LISTENING        8085    TCP     (Core.Webserver.Port)
[Info] LISTENING        2228    TCP     (FileManagerPlugin.SFTP.SFTPPortNumber)
[Info] CLOSED           2456    Both    (GenericModule.App.ApplicationPort1)
[Info] LISTENING        2457    Both    (GenericModule.App.ApplicationPort2)
[Info] CLOSED           2458    Both    (GenericModule.App.ApplicationPort3)

So that indicates that it's listening on 2457, but I still cannot connect with the external IP address. Using a port forwarding checker tool gives me connection refused for the 2457, but works for other instances. Is this likely a Valheim/Steam issue or are there other troubleshooting steps I can take?

Mike posted this 16 February 2021

That looks correct now. Valheim has somewhat flaky networking right now. Use the connect link on AMPs status page (it should be using port 2457) which will open the game. You may need to do so repeatedly to get the game to connect.

EvoSlice posted this 16 February 2021

I have been able to join with that method, but unfortunately that doesn't help other players, unless I'm already on the server.

Mike posted this 16 February 2021

The same method will work for them but it may take multiple attempts. This is normal right now and not an AMP issue.

  • Liked by
  • EvoSlice
EvoSlice posted this 18 February 2021

I just confirmed that my external IP address issue persists when running a Valheim server outside of AMP, so no action needed here. Every other server I run works fine, so this is extremely puzzling.

Mike posted this 18 February 2021

Valheim has just some straight up reliability issues with regards to networking.

  • Liked by
  • EvoSlice
TimeHunter posted this 04 March 2021

Evo have you opened the ports in Ubuntu's firewall?

sudo ufw allow 2456/tcp sudo ufw allow 2456/udp

As this is what I forget to do my server the first time, I had all the port forwards setup on the router but forgot to open the ports on the server.

Rulenine posted this 16 November 2021

I know it has been a while, but anyone find any solutions?

I have a valheim server running on Debian 11 now, local connections work fine using local IP and 5678 as port, multiple local connections work. No external connections via public IP work. All ports have been port forwarded (5678-5680 and 2456-2458) correctly and I've run sudo ufw allow PORT for all those ports as the root user on the server.

Surely there is a way to get people to connect via public IP, as there must be other people running linux servers with external public players?

Mike posted this 16 November 2021

If you're hosting at home - try wiping out your routers uPnP table (if it has a facility to do this)

If other systems on the same network can connect, then you've ruled out whether or not the game is listening or the local firewall - which places the blame squarely on the router.

Rulenine posted this 16 November 2021

uPnP is disabled.

I agree it seems to be a router issue, but as all port forwards are set up manually and other game servers working, it seems to be a mystery to me how to solve it.

AMP defaulted to putting Valheim on 5678/5679 port. I can rebind it to 2456/2457 and see if that does anything. If anyone has managed to get public connections while hosting valheim on debian, a screenshot of your Debian ufw port settings and/or AMP settings would be helpful! I'll circle back here if I manage to find out what fixes this or what is wrong.

EDIT: Just to clarify, port forwarding has been set up for Valheim for ports 5678-5680 and 2456 -2458, identically to how minecraft port forwarding has been set up, which actively runs. Same for firewall rules using sudo ufw allow PORT, and port check tools show ports to be open properly for the minecraft servers. Valheim ports not pinging as open despite showing open on ufw firewall and router.

SECOND EDIT: For anyone who is having issues, solution is simple. AMP sets it up under port 5678/5679. These will NOT work. You need to edit the ports to 2456 and 2457 and reload server. Note that for whatever reason, even when server running, port checks will NOT show the ports as open. So if you are on debian, use ufw allow PORT to open it, verify it is open on the server itself, but just know that unlike other game servers, it doesn't seem to stay "Listening" and so shows port as closed. I have now successfully had 5 people, 3 from different external IP locations, all log on without issue.