Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting servers to show up in the "LAN" tab of Steam's server browser #1770

Closed
gingerbreadassassin opened this issue Jan 11, 2018 · 32 comments · Fixed by #3015
Closed

Getting servers to show up in the "LAN" tab of Steam's server browser #1770

gingerbreadassassin opened this issue Jan 11, 2018 · 32 comments · Fixed by #3015
Assignees
Labels
type: bug Something isn't working
Milestone

Comments

@gingerbreadassassin
Copy link

I'm just posting this here in case anyone else runs into the same problems.

I'm hosting a LAN party this weekend, and want to simplify setup for everyone. While you can set source dedicated servers (in my case, CSGO servers) to any port, most of them will require adding the server to your favorites in the steam browser or connecting directly through the console. With 10-20 people, it gets tedious helping everyone get set up. To avoid this, I wanted to have the servers show up in the LAN tab.

It turns out that, by default, Steam's server browser only queries specific ports for LAN servers. Those ports are as follows:

  • 4242
  • 26900-26905
  • 27015-27020
  • 27215

A few notes: srcds_linux uses udp ports beginning at 26901, incrementing for each instance of srcds. I haven't tried binding any servers to ports 26901-26905, I don't know what srcds uses those ports for (they seem to be outbound only), and I don't know how to assign those ports, so use those at your own risk. Ignoring those, this allows 9 ports for srcds to bind to and be visible to the Steam LAN server browser. Also, I don't know if you can tell Steam's server browser to check other ports. I went through all this so that I wouldn't have to configure every guest's computer, so I didn't look into it.

Here's the results of my packet capture, showing which ports the server browser queries:

image

And here's the output of ss (netstat) -atunp | grep srcds_linux:

image

Of course, all this could be avoided by using VM's or perhaps docker, but I didn't want to spin up a VM for each server and I haven't had time to learn how to use docker.

@UltimateByte
Copy link
Contributor

UltimateByte commented Jan 11, 2018

Interesting sharing, i reopen this to be added un the wiki. Thanks for tatking the time to share.
Another solution would be to set up multiple LAN IPs for the machine, linux support that easily, and bind all these servers within standard ports.

@gingerbreadassassin
Copy link
Author

I was just adding notes to my original post when you commented.

It seems that binding to an IP hides the server from the LAN browser. I had to completely remove the -ip ${ip} from the command line parameters in the common.cfg for the servers to be visible in the LAN browser. Maybe adding +sv_lan 1 would fix that, but I haven't tried.

Also, 27020 is the starting port for HLTV, which I disabled by adding -nohltv to the parameters, as I did not wish to host.

@gingerbreadassassin
Copy link
Author

Just tried it, and sv_lan 1 makes no difference. Binding to an IP requires that the server be added to favorites or directly connecting via console for LAN.

@gingerbreadassassin
Copy link
Author

OK so those ports that srcds opens automatically 26901-26905 are used to connect to the steam master servers. This can be assigned by adding "-steamport ${steamport}" to the start parameters. Manually specifying these allows to assign other srcds instances to those ports, thus you can have 14 servers show up in the LAN browser.

Perhaps this should be implemented in the install scripts?

@991jo
Copy link

991jo commented Jan 18, 2018

What do you mean by steams server browser? Do you mean the LAN-tab of the games server browser?

You might take a look at this issue, it is

I was just adding notes to my original post when you commented.

It seems that binding to an IP hides the server from the LAN browser. I had to completely remove the > -ip ${ip} from the command line parameters in the common.cfg for the servers to be visible in the LAN browser. Maybe adding +sv_lan 1 would fix that, but I haven't tried.
Also, 27020 is the starting port for HLTV, which I disabled by adding -nohltv to the parameters, as I did not wish to host.

Take a look at this issue, this is related to your sv_lan and binding to an IP problem: #1741

@gingerbreadassassin
Copy link
Author

gingerbreadassassin commented Jan 18, 2018

Yes, the LAN tab of the steam server browser.

if you add a -ip setting that is not 0.0.0.0 the server only binds to that ip and does not listen to broadcast traffic anymore, therefore it is not found by the LAN server browser anymore. (sv_lan 1 is required for this to work)

That would explain why the servers stopped appearing in the LAN tab when an IP is specified. However, at least with the CSGO flavor of SRCDS, even specifying +sv_lan 1 does not fix this.

@chandywerks
Copy link

Can confirm I ran in to this bug as well. Removing -ip ${ip} from lgsm/config-default/config-lgsm/csgoserver/_default.cfg fixed the issue.

@UltimateByte
Copy link
Contributor

_default.cfg is the default config and will be overwritten every time. You must not edit your config this way.
https://github.com/GameServerManagers/LinuxGSM/wiki/LinuxGSM-Config

@tango-kilo
Copy link

Related to the issue above, if you force the IP to be 0.0.0.0 as specified above it does allow the games to show in the LAN tab provided within the expected port ranges.

However there is a nasty side effect, rcon no longer works.
(netstat) -atunp | grep srcds_linux showed the specified TCP ports bound to 127.0.0.1. The UDP were bound to 0.0.0.0 as expected.

The only way I could get rcon to work was to leave the -ip ${ip} bit alone but then the game wasn't visible on the LAN tab. sv_lan 1 makes no difference.

Any guidance here? I don't need an internet visible game. My use is purely for LAN parties.
Thanks in advance.

@Narehood
Copy link

@tango-kilo here is my config for a working LAN only server I use for gaming events. (this particular one is Counter Strike.)

fn_parms(){
parms="-game cstrike +sv_lan 1 -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +sv_setsteamaccount ${gslt} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
}

The only server that I used that this hasn't worked for is CS:GO.

@tango-kilo
Copy link

Failed on csgo, tf2 and fof for me

@Narehood
Copy link

TF2

fn_parms(){
parms="-game tf +sv_lan 1 -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +sv_setsteamaccount ${gslt} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
}

FOF

fn_parms(){
parms="-game fof +sv_lan 1 -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers}"
}

If those don't work are you still able to connect to the server by adding it to favorites?

Also, give ./servername debug a try. It was pretty helpful when trying to figure out the LAN only setting myself.

@tango-kilo
Copy link

Yes direct connect works but is more of a hassle than many attendees can/will deal with at an event. Also leads to fragmentation of attendee player base as they will start private games instead of joining whats provided.

@Narehood
Copy link

Narehood commented Mar 11, 2018

Yeah I agree. I just wanted to make sure something didn't get broken while changing the config. Any luck with the debug?

Also, are you on the latest versions of the servers?

@UltimateByte UltimateByte added type: bug Something isn't working under development labels Mar 14, 2018
UltimateByte added a commit that referenced this issue Mar 14, 2018
@UltimateByte UltimateByte added cannot reproduce Unable to reproduce the issue and removed type: bug Something isn't working under development labels Mar 14, 2018
@UltimateByte
Copy link
Contributor

Unfortunately, I wasn't able to reproduce your fix.

Maybe it's something with my test setup (a Linux VM on my Windows PC) but I don't think so, since I can easilly connect with commands connect 192.168.1.x, ping the server, view it with the "add to favorites" option, etc.

I tried csgo and gmodserver, both with default ports, and with 27015 27016 27017 ports with no luck.
I also tried listening to 0.0.0.0 and to the LAN IP, as well as with +sv_lan 1 , and also tried minimal start parameters, with and without the scrit IP bind, with no luck.

Can people who were able to get it working provide their hastebin links from postdetails command?

@UltimateByte
Copy link
Contributor

Wrote this mini guide, hopefully summing up the situation correctly: https://github.com/GameServerManagers/LinuxGSM/wiki/LAN-Discovery

Closing this issue for now. Feel free to bump it if you got interesting information to share.

@marlonrichert
Copy link

marlonrichert commented Sep 19, 2018

@UltimateByte @gingerbreadassassin @tango-kilo

What fixed it for me (running tf2server on Ubuntu) was to simply

  • replace -ip ${ip} with -ip 0.0.0.0 in the fn_parms section
  • (and leave ip="0.0.0.0" as is).

This makes my server show up in the LAN tab as well as make it available on the internet at its actual IP address (but not listed anywhere and I protect it with a password).

⚠️ Replacing -ip 0.0.0.0 with anything else removes the server from the LAN tab for me.

⚠️ sv_lan 1 appears to be wholly unnecessary to make the server show on LAN tab. In fact, using sv_lan 1 causes the changelevel command to crash the server when you have specified the +map parameter or removed the -ip parameter. Now, you can actually work around this by setting the starting map through the map or randommap command (instead of +map) and then switch to the next map in your cycle with the changelevel_next command, but it's easier to just not use sv_lan 1 in the first place.

@borzaka
Copy link
Contributor

borzaka commented Oct 8, 2018

The fixing attempt in LAN Discovery worked for me:

  1. Change ip="0.0.0.0" to an actual interface IP
  2. In the fn_parms section replace -ip ${ip} with -ip 0.0.0.0

There was no need for +sv_lan 1, it worked with and without it.

Debian GNU/Linux 9.5 (stretch)

I proposed to add sv_lan to csgoserver default config file in #2031

@dgibbs64 dgibbs64 reopened this Oct 8, 2018
@dgibbs64
Copy link
Member

dgibbs64 commented Oct 8, 2018

@UltimateByte there is more info being posted about this. Not sure if more is required for the docs

@UltimateByte
Copy link
Contributor

@dgibbs64 Well, @borzaka confirms what we concluded before while @marlonrichert says basically the opposite.
This would require testing. I could test that since I have a local Debian server (my NAS on Open Media Vault) :)

@marlonrichert
Copy link

marlonrichert commented Oct 9, 2018

@UltimateByte @dgibbs64 I'm not saying the opposite of @borzaka. We agree on the following:

  • In the fn_parms section, -ip ${ip} should be replaced with -ip 0.0.0.0
  • There is no need for sv_lan 1. (Although, for me, using it causes problematic side effects.)

Where we differ is in whether you should replace ip="0.0.0.0" with an actual interface IP. For me, doing so actually removes it from the LAN tab.

I'm running it on Ubuntu 16.04.5 LTS.

@UltimateByte
Copy link
Contributor

What ports are you using? Some reported that server discovery only works with some port ranges.

@marlonrichert
Copy link

I'm using the defaults:

DESCRIPTION  DIRECTION  PORT   PROTOCOL
> Game/RCON  INBOUND    27015  tcp/udp
> SourceTV   INBOUND    27020  udp
< Client     OUTBOUND   27005  udp

@chandywerks
Copy link

chandywerks commented Jan 9, 2019

_default.cfg is the default config and will be overwritten every time. You must not edit your config this way.

This work around was working for me but it seems like a recent update has made it so that it does get overwritten every time.

So now I'm stuck. The only way I was able to fix it was by removing the -ip argument completely. Is there a way to remove that param?

GitHub
Linux Game Server Managers_. Contribute to GameServerManagers/LinuxGSM development by creating an account on GitHub.

@borzaka
Copy link
Contributor

borzaka commented Jan 9, 2019

@chandwki As it says, you should make your own config based on _default.cfg; duplicate _default.cfg, and rename it to your instance, for example csgoserver.cfg if you use ./csgoserver to manage your game server. And edit that file with your settings.

@chandywerks
Copy link

chandywerks commented Jan 9, 2019

I'm understand.

But how am I supposed to remove -ip from the fn_parms()? Is there another way to override it?

@borzaka
Copy link
Contributor

borzaka commented Jan 9, 2019

Edit the fn_parms() in your custom instance.cfg based on _default.cfg. So, don't remove it from the custom .cfg.

@chandywerks
Copy link

Oh... of course. Yeah, works now that I removed the -ip param.

I was just copying "parms" but not the other part. I'm a little sleep deprived getting ready for a LAN party this weekend haha. Thanks for the help.

@dgibbs64
Copy link
Member

#1741 maybe related

@gingerbreadassassin
Copy link
Author

Coming back here years later because I'm working on a docker version of LGSM as a school project. It turns out that, in swarm mode, spinning up a CSGO docker service with -ip 0.0.0.0 works for both private and public IP addresses if you use host networking mode. So long as you assign one of the ports listed in the OP to the server, it will show up in both the LAN tab and the master server list (at least, according to the steam web API. I can see the servers if I add them to favorites via their public IP, but they don't seem to just show up in the "Internet" tab. This may be due to server configuration, however).

If you don't need to have the server show up in the LAN tab, I believe you can choose any arbitrary port, assuming it is allowed through your firewall.

@dgibbs64 dgibbs64 linked a pull request Sep 20, 2020 that will close this issue
13 tasks
@dgibbs64 dgibbs64 added this to the v20.5.0 milestone Sep 20, 2020
@dgibbs64 dgibbs64 added type: bug Something isn't working and removed cannot reproduce Unable to reproduce the issue labels Sep 20, 2020
@dgibbs64
Copy link
Member

connects to #3015

@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants