lloesche / valheim-server-docker

Valheim dedicated gameserver with automatic update, World backup, BepInEx and ValheimPlus mod support
https://hub.docker.com/r/lloesche/valheim-server
Apache License 2.0
1.92k stars 269 forks source link

Can't reach the ports even when no firewall service is activated #564

Open gridhead opened 1 year ago

gridhead commented 1 year ago

Here's the compose configuration I make use of.

---
version: "3.3"
services:
  alcpheim.net:
    image: "docker.io/lloesche/valheim-server:latest"
    network_mode: "apexnenv"
    container_name: "alcpheim.net"
    hostname: "alcpheim"
    deploy:
      resources:
        limits:
          cpus: "0.75"
          memory: "8192M"
        reservations:
          cpus: "0.50"
          memory: "4096M"
    environment:
      - "PUID=0"
      - "PGID=0"
      - "TZ=Asia/Kolkata"
      - "SERVER_NAME=Valheim Server on Apex Altruism"
      - "SERVER_PORT=2456"
      - "WORLD_NAME=Neotopia"
      - "SERVER_PASS=alcpheim"
      - "SERVER_PUBLIC=true"
    ports:
      - "2456-2457:2456-2457/udp"
      - "9001:9001/tcp"
    volumes:
      - "/home/alcphost/datadisk/servbase/alcpheim/config:/config"
      - "/home/alcphost/datadisk/servbase/alcpheim/data:/opt/valheim"
    cap_add:
      - "sys_nice"
    stop_grace_period: "2m"
    restart: "unless-stopped"

I am not able to telnet to the ports even when no firewall service is running to block the ports. Needless to say, I cannot connect to the server as well from the game.

Any help would be appreciated.

gridhead commented 1 year ago

To add context, when I say "telnet" I loosely use the word to mean check reachability to the host and its port. In this case, I used "netcat" to probe into the UDP ports but to no avail.

wcdanh2 commented 1 year ago

Can you show the nc commands that you are trying to run? Are you running them from the host machine, inside docker, another machine?

gridhead commented 1 year ago
[t0xic0der@fedorable ~]$ nc -zvu 192.168.1.1 2456
Ncat: Version 7.93 ( https://nmap.org/ncat )
Ncat: Connected to 192.168.1.1:2456.
Ncat: Connection refused.

I am running this command from another computer on the same network. This computer can ping the address but apparently cannot reach the port specified.

leptitchriss commented 1 year ago

I'd start by checking if the server is actually listening on the specified ports before testing connectivity from a remote server. What is the output of the following from the system running the docker compose?

netstat -ulpn

Additionally... it's worth double checking the IP address of the server.