kaimallea / csgo

A containerized dedicated server for Counter-Strike: Global Offensive
The Unlicense
242 stars 58 forks source link

How to open it to the public? #31

Closed Zloka closed 4 years ago

Zloka commented 4 years ago

Seems to work just fine locally, but how do I host it online? I tried assigning it my IP, but then the logs just output the following, while restarting every 10 seconds: WARNING: NET_OpenSocket: bind: Cannot assign requested address Couldn't allocate any server IP port, tried 1 addresses <IP REDACTED>Tue Apr 7 19:39:11 UTC 2020: Server restart in 10 seconds

0BuRner commented 4 years ago

I guess you have to use IP address of the host you are running the server on in the command line. Then, in your router admin panel, you have to forward external port to internal IP/PORT to pass through NAT (https://www.howtogeek.com/66214/how-to-forward-ports-on-your-router/)

christiansenandi commented 4 years ago

As 0BuRner stated you need to point your server to your local ip(hosts ip).

Running this as Kaimallea already have in his readme:

docker run \
  --rm \
  --interactive \
  --tty \
  --detach \
  --mount source=csgo-data,target=/home/steam/csgo \
  --network=host \
  **--publish 27015:27015/tcp \  #Insert any port number here** 
  --env "SERVER_HOSTNAME=hostname" \
  --env "SERVER_PASSWORD=password" \
  --env "RCON_PASSWORD=rconpassword" \
  --env "STEAM_ACCOUNT=gamelogintoken" \
  --env "AUTHKEY=webapikey" \
  --env "SOURCEMOD_ADMINS=STEAM_ID" \
  kmallea/csgo

When you have added the --publish and a port you can then portforward in your router at home so that connections to that port will be forwarded to your servers ip and port.

Remember to remove the stars, it was only there to highlight what to insert :)

kaimallea commented 4 years ago

@Zloka hi, are you still having issues? The error you shared usually means something is already running on the IP and port combo. Make sure there isn't another instance already running.

Zloka commented 4 years ago

Hey, thanks for your suggestions.

I tried most of what you suggested:

  1. Using --network=host \
  2. Explicitly specifying IP and publishing ports.

Still, I couldn't get it to work. I suspect it's not impossible that I may have had another project running. I'm going to try it on another PC, as that is what I'll be using for hosting anyways. I'll re-open if the problem still occurs on it :)