This then means we need to facilitate such things as "gaming"...
I often think that "geeky" things are very much under-represented at schools. As I think I've said before, school sysadmins, even if they don't actively engage kids in classrooms, ought to facilitate a broader "curriculum" of ICT content beyond what is in various subjects.
I don't think gaming (as opposed to hacking, robotics, electronics and programming) are particularly geeky any more, but it certainly is a lot more geeky than running around a field kicking / carrying / hitting / being hit by balls, which seems to be the only out-of-classroom activity that gets any traction (indeed, sport gets too much attention IMO).
I've personally avoided getting involved in encouraging yet more fragging of n00bs - most teenage boys with the inclination to do so already spend more than enough hours frantically clicking mice at things on screen (I certainly did, although typically not all that frantically, as the largest number of hours went to things like Transport Tycoon and Sim City 2000 - although some early RTS and various flight sim type things certainly took a few hours here and there - mid '90s was my teenage era).
I'd really rather they learnt about programming, networks, firewalls and securing themselves from "hackers" and useful things, but *shrug* that seems not to interest many - and I don't have the time to run that stuff any more.
However, as the "Gatekeeper of the Internet" (aka Chief Firewall Wrangler/BOFH), it's the sort of thing that ultimately lands in my lap.
We convened a meeting of interested parties on Tuesday. We (the mastermind teacher and myself) set forth basic ground rules, and then told pupils that they needed to get hold of me via email with a list of server software requirements and settings wrt hosted dedicated game servers, firewall ports and services for the games they really wanted to master.
Basic ground rules were things like:
- You must legitimately own the game you want to play, and all requisite software.
- You must bring your own gaming hardware.
- You must leave the lab where activities happen in as good or better condition than when you found it.
- If it works, it works, if it doesn't, find another game. (AKA don't harass IT to muck about with the firewall rules, because we have better things to do, and it turns out that games are a PITA to deal with on many NGFWs).
- Internal game servers are really where it's at.
- Your device must be formally registered on our network.
- Implicit: Wheaton's Law.
- You "own" the activity - do the hard work, learn what needs to be done to facilitate this, not just pitch up, frag n00bs, and expect someone else to do all the heavy lifting.
- Instapermabans are a thing if you flout any of these rules, or get caught being naughty in any way.
Of course, re: 8, nothing has materialised from the kids over the past few days (#millennials, hey?); being pro-active (and because I had a little time this week) I investigated a few options, because I'm sure next week will be too busy, and the plan is to start Doing Things by Tuesday afternoon.
If you have sufficiently advanced kids floating around - and you can trust them with an internet facing server - then get them to sysadmin the thing, from setting up to maintaining, patching and adding/tweaking game servers. It's a very good learning exercise. Of course, you can make an internal-only one if you like and let them run it.
The most promising thing, by far, for managing this sort of thing is Linux Game Server Manager, which wraps various Steam (and a few other) dedicated servers in a nice load of Git-backed bash scripts. If you want to do it all yourself, the canonical tool (for Steam games) is SteamCMD.
As FPS is (unaccountably, IMO) by far the most popular genre with gamers, that's where we'll start.
The chaps (no girls pitched up!) wanted primarily CS:GO (Counterstrike: Global Offensive, for those with better things to do than clicking on other people until they die), so that was the first thing I experimented on.
I also like to make sure that having lots of money isn't a pre-requisite to taking part, and decided Team Fortress 2 is a reasonable free to play game (if you want something really tiny and modest in needs, check out assault cube; it has an easy to set up local server mode for LAN games).
I also wanted the server to be available over the Internet - in part, because we have day scholars and boarders, so it makes sense to maximize potential for match-playing - and, one day, the inter-school matches will probably require it!
Basic Ubuntu Server config & Steam setup
- Create a dedicated Steam account (don't use your personal one).
- Make sure you verify your new account and add a phone number to it (and verify that). You'll possibly need to install the Steam client on a machine with a GUI to do this successfully.
- If you need to set a server up for a game you must own (like CS:GO) buy it on Steam with your new account - indeed, you pretty much need to spend at least $5 to get a non-limited account to be able to generate GSLT tokens anyway.
- Find a reasonably modern Ubuntu server (15 or later) and put it on some hardware (a VM is fine). It's probably a good idea to install and configure postfix (using a smarthost) so you can get your game servers to bother you quietly when they break.
- It's going on the Internet. Put it in a DMZ and firewall it (both on your border firewall and with a default-to-deny host-based firewall; I use Shorewall).
- Allow through the relevant ports and protocols, from wherever to wherever is needed, given your topology.
- Insert port forwards on your router/firewall, if needed; if you have a spare, use a dedicated IPv4 address (publicly routable); make sure the outgoing NAT address matches whatever your incoming port forwards happen on; even easier, make it natively have a routable IP address in a DMZ.
- The port forwards you need depend on what servers you are running - by default, you will need 27015 for both TCP and UDP, and 27020 for SourceTV. You will (obviously) need to forward and allow through firewalls other ports if you run more than one server. Obviously, you also want to allow traffic out from the server.
- Set up split horizon DNS or hairpin NAT, as is your preference/site norms, if you need to.
- Install and set up the relevant servers (see below).
Whilst there is quite a lot of documentation on LGSM, I didn't find it all that intuitive (probably because I wanted to try and find and install LGSM before installing a gameserver, but that's not quite how it works...). In reality, you find the server you want, and follow the instructions for each one. So, it's WABM time...
- create a local user for each game server on your Ubuntu server:
- adduser <servername>
- adduser csgoserver
- rinse and repeat for any others you want to run (tf2server etc. etc.) - their multiple servers wiki entry is a little opaque on this subject, but doing it as I say here seems the easiest.
- install LGSM dependencies:
- sudo dpkg --add-architecture i386; sudo apt-get update;sudo apt-get install mailutils postfix curl wget file bzip2 gzip unzip bsdmainutils python util-linux ca-certificates tmux lib32gcc1 libstdc++6 libstdc++6:i386
- go pick the relevant server from https://gameservermanagers.com/servers/
- login as your game server user:
- su - <servername>
- su - csgoserver
- Install the LGSM files; on the game server manager page there will be something that says "download and run the script" - for CS:GO, it is:
- wget -N --no-check-certificate https://gameservermanagers.com/dl/linuxgsm.sh && chmod +x linuxgsm.sh && bash linuxgsm.sh csgoserver
- Run the installer from your shell once the download finishes; follow any instructions.
- ./csgoserver install
- rinse and repeat for each game server you want, remembering to change username each time.
Game settings customisation
- cd ~
- cd /lgsm/config-lgsm/csgoserver/
- cp _default.cfg csgoserver.cfg
- vim csgoserver.cfg
- edit as you need to with regards to settings like your Steam login, GSLT tokens, and the like.
- ## SteamCMD Login
- Not all games need a steam login - those that allow anonymous login for instance, don't. This page (scroll down) covers those that do.
- For games that require it, make sure you generate and pass a GSLT token by filling in the gslt="" setting - insert the token between the quote marks.
- Other gameservers will follow similar naming convention and file locations.
- You can also mess around with player numbers, maps, and may other settings.
- write the file (:w)
- quit (:q)
- Restart your gameserver if it is already running.
LGSM includes a handy feature ("FastDL") for passing out various game files (like maps) quickly to your players via a local HTTP server. Whilst they can get them from Steam, this is often limited (to ~20kbps) - and thus can take aaaages. If you have Apache2 installed, you can then set it up. If you then enable Apache's usermod, you can have a FastDL directory for each game quite easily. This can suck up quite a lot of disk space quite fast for games with a lot of big resources.
- run your gameserver in fastdl mode, e.g.
- ./csgoserver fastdl
- follow through the prompts.
- wait for the system to copy across and bzip all the files - this can take some time.
- Edit the config file at ~/serverfiles/csgo/cfg/csgoserver.cfg (other games will differ slightly) to point at the correct location.
- Add the URL and server directives:
- sv_downloadurl "URL"
- sv_allowdownload 0
- The URL will be something like http://yourservername.yourtld/~yourserveruser/fastdl/ - leave the quote marks there and paste the URL in there.
- You can also use an IP address instead of FQDN if you're using hairpin NAT - but otherwise, split horizon DNS will normally work better. Obviously, if you use an IP address and the server is available over the Internet, make sure that it is the publicly routable IP.
- Make sure your firewalls allow HTTP downloads.
- If you get stuck, the FastDL wiki entry is quite helpful. You may need to chmod your game server user home directory 755, and likewise your public_html directory and files therein - in particular, encrypted home directories may cause issues. Before you change permissions, try loading the URL in your browser - within the fastdl folder, you should see a bunch of files (usually in sub-directories).
- Restart the server if it's already running so the fastdl settings take effect.
- NB: This is also the file where you can change what your game server is called and put in passwords to control remote server admin and remote gaming connections.
Starting LGSM game servers
- Change to the relevant user (sudo su - <username>)
- cd ~ to change to home directory of that user (in case you don't end up there)
- ./<gameservername> start
- ./csgoserver start
- watch for errors, if any; correct the underlying problem. Otherwise it should all work just fine.
Some basic troubleshooting
for the remainder of this guide, assume ./csgoserver is whatever the shell script is for interacting with the relevant game - it will be different for each game instance under each user.
Check out all the LGSM commands
|Check out all those handy options...|
Are your servers running?
netstat -atunp | grep srcds_linux
running the command above as root will quickly show you want processes are up and running - if you see the ports you expect, that's a good sign!
Track your gameservers
There are probably lots of similar sites, but this one seems quite straightforward; it also lets you test reachability of a public game server from outside of your network. It takes at least a week of membership to that one before you can "claim" your server and start tracking it.
This is another good way of tracking usage of your servers too.
This is another good way of tracking usage of your servers too.
Update your gameserver
I had weird errors concerning various "fixes" to do with bots and stuff on my CSGO server when I started it; a reinstall didn't help. I eventually tried the update command, and hey presto, that fixed it.
Reinstall your gameserver
Validate your gameserver
Check your gameserver details
You want your ports to be correct, and the status to be online - and anything else in there to be correct as per your settings!
If you signed up to one of the game tracking services, you can usually generate funky little banners like these: