I am running a Valheim server and I can connect from my local network but can’t get players outside to join. I am also running the instance inside a docker container. I read that it could be a lot of different issues but its most likely port forwarding. I’ve tried many different configurations but here are my current port forwarding settings.
@CubeCoders-Bot could you take a look at this please? They can connect from inside their local network but not externally. Check their port forwarding rules, check for CGNAT and other blockers, etc.
First up, let’s talk ports. Since you’ve already run some checks, let’s make sure those port forwarding rules are correctly set. Here’s a quick checklist for you:
Port Forwarding Rules:
Forward UDP ports 2456 and 2457 to the IP address of your Docker container.
Inbound Firewall Rules:
Ensure that UFW (Uncomplicated Firewall) is allowing those ports (you said these are configured, so you’re good here).
Outbound Firewall Rules:
Less commonly an issue, but double-check that there’s no restrictive outbound rule blocking the responses.
Check for CGNAT:
If you are behind Carrier-Grade NAT (CGNAT), it might block incoming connections. You might need to contact your ISP to get a public IP address.
Since you’re running AMP in a Docker container, make sure your Docker network settings are also correctly mapping the ports from your host to your container and that the AMP instance itself is aware of those ports.
Let me know if you need more specific instructions or if you want to double-check anything else!
This post was produced by an AI controlled by CubeCoders Limited - Feedback
@CubeCoders-Bot I am behind a CGNAT but I turned on DMZ forwarding to the secondary router and turned the firewall of the CGNAT off. I’m not sure how to check the port mapping of the docker containers though. I ran:
docker network inspect
on all my networks but it didn’t seem to give me the info I needed.
To check the port mappings of your running Docker containers, you can use the docker ps command. It’ll show the port mappings in the PORTS column. Here’s the exact command to run:
docker ps
Look for your Valheim container in the list and check the PORTS column to see which ports are mapped. You should see something like 0.0.0.0:2456->2456/udp and 0.0.0.0:2457->2457/udp.
If the ports aren’t mapped correctly, you might need to update your Docker container settings. If you’re using docker run to start your container, it should look something like this:
docker run -d --name valheim_server -p 2456:2456/udp -p 2457:2457/udp your_docker_image
Check this and let me know what you find!
This post was produced by an AI controlled by CubeCoders Limited - Feedback
@CubeCoders-Bot the ports are managed by AMP, the user shouldn’t be touching docker directly. You still use ampinstmgr ports even for instances inside a container.
Alright then, let’s stick with what AMP gives us. Since you’ve already run ampinstmgr ports and confirmed that the instance is running and listening on UDP/2456 and UDP/2457, let’s move to the next step.
Just to be thorough, let’s confirm a couple more things:
AMP Port Configuration: Make sure AMP’s configuration for your Valheim instance is set to use the ports 2456 and 2457.
Docker Container Network Settings: Even if AMP is managing the ports, ensure that the Docker container’s network is set to host mode. This removes any port mapping confusion.
For AMP configuration, use the web interface:
Go to your Valheim instance in AMP.
Check the settings to confirm the ports.
To ensure Docker is in host mode, your Docker run command should include --network host. Alternatively, check the container’s network settings via:
docker inspect your_container_name
Look for the "NetworkMode": "host" in the output.
Check these settings and get back to me with what you find!
This post was produced by an AI controlled by CubeCoders Limited - Feedback