arkmanager / ark-server-tools

Set of server tools used to manage ARK: Survival Evolved servers on Linux
MIT License
678 stars 143 forks source link

How to force server to use internal IP instead of external IP (using Docker) #1213

Closed HenryRocha closed 2 years ago

HenryRocha commented 2 years ago

Hello, first things first. I am using a Docker image to run the server, to make life easier with installation and such. To be more specific I'm using this project's image: Hermsi1337/docker-ark-server.

The server resides in a server in my house, and I plan to join it using the IP from my local network, since I don't want to expose the server to the internet.

I am able to spin up the server and it all seems to work fine (since I can see the server both in the Steam server browser and the in game browser, in the favorites list), however I am not able to join the server, it gives me the Connection Failure: Invalid authentication token error. I did some googling and it seems this error has to do with the IP address used to join the server being different to the one used by the server.

This is the output from arkmanager status:

Running command 'status' for instance 'main'
 Server running:   Yes
 Server PID:   55
 Server listening:   Yes
Server Name: Ark dos Cleitin - (v342.2)
Steam Players: 0 / 70
Active Steam Players: 0
 Server online:   Yes
 ARKServers link:   http://arkservers.net/server/MY_EXTERNAL_IP:27015
 Steam connect link:   steam://connect/MY_EXTERNAL_IP:27015
 Server build ID:   7970694
 Server version:   342.2

From this output I assume the server only expects connections from the external IP address, and when I try joining using the internal IP it throws that error.

Does anyone know how to fix this? I though about trying to force the server to accept connections from other IPs using ark_MultiHome but then the server doesn't even go up. Maybe I am approaching this the wrong way.

klightspeed commented 2 years ago

Does it work if you change the query port and/or the game port? It's possible that the server and client are fighting over the port mappings.

filipdadgar commented 2 years ago

I seem to experience same problem (though I host Hermsi1337/docker-ark-server in K8). Server goes up fine and is visible. But I cannot connect to it neither externally nor from internal lb address:

Running command 'status' for instance 'main' Server running: Yes Server PID: 134 Server listening: Yes Server Name: my-server - (v342.22) Steam Players: 0 / 20 Active Steam Players: 0 Server online: Yes ARKServers link: http://arkservers.net/server/195.x.x.x:27015 Steam connect link: steam://connect/195.x.x.x:27015 Server build ID: 8111435 Server version: 342.22

Ports are mapped according to readme:

apiVersion: v1 kind: Service metadata: namespace: ark name: ark-service annotations: metallb.universe.tf/allow-shared-ip: ark spec: selector: app: ark-server ports:


apiVersion: v1 kind: Service metadata: namespace: ark name: ark-service-udp annotations: metallb.universe.tf/allow-shared-ip: ark spec: selector: app: ark-server ports:

And deployment:

   - name: ENABLE_CROSSPLAY
      value: "true"
    - name: DISABLE_BATTLEYE
      value: "true"
    - name: MaxPlayers
      value: "5"
    - name: GAME_CLIENT_PORT
      value: "7777"
    - name: UDP_SOCKET_PORT
      value: "7778"
    - name: SERVER_LIST_PORT
      value: "27015"       
    image: hermsi/ark-server:latest
    imagePullPolicy: Always
    name: ark-server
    ports:
    - containerPort: 7777
      protocol: UDP
      name: udp-7777     
    - containerPort: 27020
      protocol: TCP
      name: tcp-27020
    - containerPort: 7778
      protocol: UDP
      name: udp-7778
    - containerPort: 27015
      protocol: UDP
      name: udp-27015       
    resources: {}
    stdin: true
    tty: true
    volumeMounts:
    - mountPath: /app
      name: ark-data
  restartPolicy: Always
  volumes:
  - name: ark-data
    hostPath: 
      path: /media/download/kubeconfig/ark-herm/

Service is mapped correctly: NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE ark-service LoadBalancer 10.109.176.172 192.168.1.40 27020:32282/TCP 3h2m ark-service-udp LoadBalancer 10.104.73.177 192.168.1.40 7777:32248/UDP,7778:31986/UDP,27015:30856/UDP 179m

klightspeed commented 2 years ago

Service is mapped correctly: NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE ark-service LoadBalancer 10.109.176.172 192.168.1.40 27020:32282/TCP 3h2m ark-service-udp LoadBalancer 10.104.73.177 192.168.1.40 7777:32248/UDP,7778:31986/UDP,27015:30856/UDP 179m

Are those port pairs the internal / external port mappings? I think the ARK server assumes you are performing identity mapping between internal and external ports.

filipdadgar commented 2 years ago

Thanks for swift response. Yes, from the "applications" point of view, these ports are mapped correctly. The 30000+ ports are NodePorts and are valid if you on same network as in east-west traffic.

I cannot see my server listed, except on the arkservers website. But from (epic version) Ark, I cannot see my server. Even trying to connect locally with open 192.168.1.40(then 7777 or 7778) will just throw connection timeout. (I start local game and try to join.

filipdadgar commented 2 years ago

Small update on this. I managed to get it working by enabling TCP as well for port 7777-8. Portforwarding rules that is.

klightspeed commented 2 years ago

I have now updated the readme and example config to clarify the protocol of the ports the server listens on / binds to. The game port and RCON port are TCP ports. The query port is a UDP port.