GithubHelp home page GithubHelp logo

Can't connect to the server about csgo HOT 19 CLOSED

cm2walki avatar cm2walki commented on September 7, 2024 1
Can't connect to the server

from csgo.

Comments (19)

Gryfenfer97 avatar Gryfenfer97 commented on September 7, 2024

I just tested the official nginx docker image and it worked perfectly. I was able to connect to the server, so I think the problem doesn't come from my docker install.

from csgo.

Gryfenfer97 avatar Gryfenfer97 commented on September 7, 2024

The server appears correctly in the list of community servers (LAN tab) but I still can't connect to it: connection failed after 30 retries.

from csgo.

CM2Walki avatar CM2Walki commented on September 7, 2024

The server appears correctly in the list of community servers (LAN tab) but I still can't connect to it: connection failed after 30 retries.

How are you trying to connect? Via console?

from csgo.

Gryfenfer97 avatar Gryfenfer97 commented on September 7, 2024

I tested the both way, the console and the gui.
I have the same error in both cases

from csgo.

CM2Walki avatar CM2Walki commented on September 7, 2024

Are you behind a NAT? Also did you use your private or public IP to connect via the console?

I haven't operated a csgo server in a local network, yet. But I have developed games with Steamworks before. The connection via the GUI will likely fail because Steam will publish your public IP (there is no way to overwrite this behavior) and without port forwarding on the router, you will fail to connect.

Connection via console should work if you utilize your PC's private IP.

from csgo.

Gryfenfer97 avatar Gryfenfer97 commented on September 7, 2024

As the docker is on the same machine as csgo, I use connect 127.0.0.1 to connect to the server

from csgo.

CM2Walki avatar CM2Walki commented on September 7, 2024

Could try your local IP? It could be that this:
https://github.com/CM2Walki/CSGO/blob/master/etc/entry.sh#L70-L71
Only listens to your private IP and not your loopback interface. Technically it should listen to both, but you never know 🤷.

from csgo.

Gryfenfer97 avatar Gryfenfer97 commented on September 7, 2024

I've set my local ip (192.xx.xx.xx) for the variables SRCDS_NET_PUBLIC_ADDRESS and SRCDS_IP and it didn't change anything.

from csgo.

Gryfenfer97 avatar Gryfenfer97 commented on September 7, 2024

I actually managed to successfully connect to the server. The main point of the solution is to edit the value of sv_lan in the csgo/cfg/server.cfg file from 0 to 1.
Note that adding +sv_lan 1 as argument doesn't work.

Here is the full line I used to launch the server: docker run -d --net=host -v $(pwd)/csgo-data:/home/steam/csgo-dedicated/ -e SRCDS_PORT=27016 -e SRCDS_IP="0.0.0.0" -e SRCDS_PW="" --name=csgo-dedicated cm2network/csgo

Then to connect you must use the local address of your machine (not 127.0.0.1).

Last point for those who are using the same PC for the server and the game: the port 27015 seems to be already used (but I am not 100% sure about that ) so I used the port 27016.

from csgo.

CM2Walki avatar CM2Walki commented on September 7, 2024

See cb5a890, I removed sv_lan 0 from the config and added it to the environment variables instead. This should make it overwritable. Can you try again @Gryfenfer97?

from csgo.

Gryfenfer97 avatar Gryfenfer97 commented on September 7, 2024

I don't really understand why but it doesn't change anything when it should work.
The +sv_lan should overwrite the one in the config so I'm surprised that it doesn't work.

Changing it directly in the config still work however.

Edit: This is the command I used to start the container:

docker run -d --net=host \
        -v $(pwd)/${volume_name}:/home/steam/csgo-dedicated/ \
        -e SRCDS_PORT="$port" \
	-e SRCDS_TV_PORT="$tvport" \
        -e SRCDS_IP="$ip" \
        -e SRCDS_PW=""  \
        -e SRCDS_LAN=1 \
	--name=$1 \
        cm2network/csgo:sourcemod   

from csgo.

CM2Walki avatar CM2Walki commented on September 7, 2024

So just to clarify. You did remove it from your server.cfg and pulled the latest version of the image that passes it as a command line variable?

Unfortunately, I don't have a system where I can test local network things like this. So sorry for asking such trivial things.

from csgo.

Dezainer avatar Dezainer commented on September 7, 2024

Hey, i'm also trying to get a local server up and can't seem to be able to connect to it even tho they are on the same machine.
I'm using WSL on windows btw, don't know if that may have something to do with it, but other images are working fine, as @Gryfenfer97 also said.

I'm using a compose file to structure the setup:

version: '3'
services:
  csgo:
    image: cm2network/csgo
    container_name: csgo
    environment:
      - SRCDS_LAN="1"
      - SRDCS_IP="0.0.0.0"
      - SRCDS_PORT=27016
      - SRCDS_PW=""
    network_mode: host

Also, I've just tried deleting and pulling the lastet version of the image, and the SV_LAN option did not work as @CM2Walki said it should on the last pull request, I had to manually change it on the server.cfg file, but still couldn't connect.

from csgo.

Gryfenfer97 avatar Gryfenfer97 commented on September 7, 2024

So just to clarify. You did remove it from your server.cfg and pulled the latest version of the image that passes it as a command line variable?

Unfortunately, I don't have a system where I can test local network things like this. So sorry for asking such trivial things.

No I didn't delete it from the server.cfg because the +sv_lan 1 should overwrite the variable in the server.cfg file. I just edited the variable in the server.cfg to make it work.
However I will test this soon.

from csgo.

michihupf avatar michihupf commented on September 7, 2024

I actually managed to successfully connect to the server. The main point of the solution is to edit the value of sv_lan in the csgo/cfg/server.cfg file from 0 to 1.

This did not work for me. Had the issue that I could not connect to the server as:
Server only accepting connections from game lobby was returned.

Already tried restarting the server and my game multiple times. I had used port 27015. Using another port doesn't seem to even give me any response from the server.

EDIT: (i got it to work through the server browser)
I just used the server browser and although this was the command to start the server:
podman run -d --net=host -v (pwd)/server:/home/steam/csgo-dedicated/ --name=csgo-ds3 -e SRCDS_RCONPW="testing" -e SRCDS_LAN="1" -e SRCDS_PORT=27016 -e SRCDS_IP="0.0.0.0" -e SRCDS_PW="" 689e0a485abc
the server uses port 27017. This seems really weird.

from csgo.

Gryfenfer97 avatar Gryfenfer97 commented on September 7, 2024

@michihupf check that you don't have another container running at the same time that is using the port ( docker container ls)
If you try to start a server on the port n while another one is running on that same port, the server will start on the port n+1

from csgo.

teotwaki avatar teotwaki commented on September 7, 2024

A few notes:

  • I had to manually edit server.cfg to set sv_lan to 1. Without this, the error "only accepting connections from game lobby" kept popping up.
  • It appears that maybe the EXPOSE lines in the Dockerfile conflict with docker-compose? I saw weird behaviour with additional ports being forwarded even when I didn't include them in my ports configuration. I built a local version of the image without the EXPOSE statements, which appears to work fine.
  • I'm not sure it makes sense to use EXPOSE (which is supposed to be for documentation purposes only), considering that the actual ports in use depend on environment variables.
  • Host networking is not required for this to work.
  • I'm still trying to figure out which ports are required to forward so that the server shows up in the server browser. Not entirely sure this is possible as the process can't bind to a LAN address when running with container networking, and thus probably wouldn't know what IP to provide to the server browser.

from csgo.

michihupf avatar michihupf commented on September 7, 2024

@michihupf check that you don't have another container running at the same time that is using the port ( docker container ls) If you try to start a server on the port n while another one is running on that same port, the server will start on the port n+1

I do not even have another container stopped which is the weird part. The only running container is this csgo container.

I had to manually edit server.cfg to set sv_lan to 1. Without this, the error "only accepting connections from game lobby" kept popping up.

I had the same issue this fixed it for me as well.

Edit:
Some additional info with a really weird behaviour:
So basically I had the game open and connected to the server (it had used 27017 instead of 27016 - maybe the game used it or something?). After that I forgot about the server and went into a Dangerzone match with a friend. I got kicked because my files were not matching the game files of the Dangerzone server. I then closed my game but to my surprise Steam thought that I had the game running still until I shut down my local server container and restarted Steam.

This was actually caused by some launch paramenters that I had set on CS:GO. This was not an issue with this repository.

from csgo.

kamild1996 avatar kamild1996 commented on September 7, 2024

Can confirm this is still an issue as of the writing of this comment. Despite SRCDS_LAN set to 1, I have to manually set sv_lan to 1 in server.cfg to connect.

from csgo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.