Jump to content

shadowgaminglounge

Member
  • Posts

    2
  • Joined

  • Last visited

Reputation Activity

  1. Informative
    shadowgaminglounge reacted to jakkuh_t in Steam Caching Tutorial   
    Heyo! Here's a little tutorial to accompany our "Downloading Games at 10 GIGABIT?" video.
     
    I know it looks like a lot, but it's actually not that hard to setup.
     
    This tutorial is designed around Ubuntu 18.04 Desktop, but should be adaptable to most Linux distros. We aren't going to go into detail about setting up your storage medium, so you will have to do your own research on that. Here's a link to a good article on how to setup a software RAID in Ubuntu if that's what you intend on using.
     
    Setup a non-root user to issue docker commands. If you are using 18.04 Desktop, you should already be using a non-root account w/ sudo access Otherwise add a user, replacing "USERNAME" with your desired username while logged in as root. adduser USERNAME If you wish to run docker commands via sudo, add the user to the sudo group: usermod -aG sudo USERNAME OPTIONALLY: if you just want to allow the user to use docker commands: usermod -aG docker USERNAME Ensure you have curl installed sudo apt install curl -y Install Docker sudo curl -sSL https://get.docker.com/ | sh Docker can be installed solely by your distro's package manage, but running the following command takes care of all dependencies and will ensure you end up with the newest version of docker Verify Docker is functioning correctly. Run the following command to check if docker installed and is functioning properly. It should output with a bunch of text hopefully including: "active (running)" in green. That means docker is working properly sudo systemctl status docker
    OPTIONAL: If you intend to cache services other than just steam, like origin, or battle.net/blizzard, add the corresponding amount of IPs necessary. If you just want to cache steam games, you don't need to add any additional IPs - steamcache will run just fine on the main system IP ASSUMING nothing else is already using ports 53 (dns forwarding), and 80 (caching service). Otherwise, you need to determine the amount of additional IPs you will require. Add 1 additional IP per extra service you'd like to cache. For example, if you wish to cache steam and origin, you would need 1 additional IP on top of the existing IP of the system, for a total of 2 IP addresses. For our long term setup we need 6 IPs total, as we will be caching everything EXCEPT for Uplay as that seems to break it for whatever reason. 192.168.1.50 - steamcache-dns and steam-cache docker containers 192.168.1.51 - origin-cache (Origin) 192.168.1.52 - blizzard-cache (Battle.net) 192.168.1.53 - riot-cache (Riot Games) 192.168.1.54 - frontier-cache (Frontier Launchpad) 192.168.1.55 - windows-cache (Windows Updates) Make sure you CHANGE the example IPs to follow your subnet, some people's routers use "192.168.1.o", some are "192.168.0.x", it really depends. You also don't have to use .50-55, you can use any unused local addresses. I'd recommend checking the systems current IP address and going off of that (should be the first IP listed). hostname -I MAKE SURE no other devices on your network are already using those IP addresses. Mobile apps like "Fing" can be useful to scan your network to find unused IPs (this can also be used to find out what your subnet is) With your IPs now decided upon, it's time to set them in NetworkManager utility, run: sudo nmtui Navigate into "IPv4 Connection">"Wired connection 1" (this might be named something else, so select the entry under "ethernet") Set "IPv4 Configuration" to "Manual" Enter each desired IP, with an "/32" appended to the end to indicate to the system that it is a single IP address range, like shown below Set "Gateway" to the IP address of your router. This is "192.168.1.1" for us. Set "DNS servers" to your desired DNS servers, if you don't know what this is use "1.1.1.1" and "8.8.8.8" Exit out via <OK>, then <Back>, then Quit. Restart networking by running: sudo systemctl restart networking Check that the IP addition worked by running "ping ADDITIONALIP" on another computer on the same network. This would be "ping 192.168.1.51" or .52, .53, .54, or .55. If it doesn't respond to pings, try restarting the system. If it still does not work, make sure there are no IP conflicts and that you entered the settings properly. Start the docker containers for each caching service Depending on how many caching services you intend to run, you might have to run up to 8 full length commands to get all of the services running, thankfully you can just copypasta them from here and edit to suit your setup. Only run the caching container commands for services you want to use and then remove the IPs from the dns container command for the services you don't intend to cache. Change the IPs of each module to your decided up IP address(es) Change the 2 instances of "/home/USERNAME/cache/" after "-v" on each module to the location you intend to store the cached data. If the caching server is just a single drive system, the supplied location will work after changing "USERNAME" to the username of the user you are using (lol, get used). Start the steamcache-dns docker container This container takes incoming DNS requests and forwards any content that should be cached to the caching server, and any other requests to their intended location. Remove the lines for services you aren't using, and make sure to change the IPs to the correct IP for each caching container. Change the 192.168.1.50 after "-p" to the main IP of the server sudo docker run \ --restart unless-stopped -d \ --name steamcache-dns \ -p 192.168.1.50:53:53/udp \ -e UPSTREAM_DNS=1.1.1.1 \ -e STEAMCACHE_IP=192.168.1.50 \ -e ORIGINCACHE_IP=192.168.1.51 \ -e BLIZZARDCACHE_IP=192.168.1.52 \ -e RIOTCACHE_IP=192.168.1.53 \ -e FRONTIERCACHE_IP=192.168.1.54 \ -e WINDOWSCACHE_IP=192.168.1.55 \ steamcache/steamcache-dns:latest Start the sniproxy docker container This container forwards HTTPS requests that the cache cannot read due to encryption straight along to the original destination, without it Origin has a lot of issues. docker run \ --restart unless-stopped -d \ --name sniproxy \ -p 443:443 \ steamcache/sniproxy:latest Check the status of the containers All of the containers should show up as "Running for X" sudo docker container ls If everything is working, head over to a client computer and set the DNS Navigation to Settings>Networking & Internet>Change adapter options>Right click your internet adapter>Properties>uncheck IPv6>Click IPv4 and then Properties Check "Use the following DNS server addresses" Set the "Preferred DNS server" to the IP of your steamcache-dns docker container, for us that is "192.168.1.50" Set the "Alternate DNS server" to your DNS provider of choice, if you don't know what this is, use "1.1.1.1" On the client computer open command prompt and run ipconfig /flushdns Attempt to download a game! You can monitor usage on the server via an app like "nload". On first download you should see a lot of traffic both incoming and outgoing, but it should pretty much be strictly outgoing when downloading already cached content  
    SUCCESSS!
     
    Any Linux guru's out there feel free to comment any additional info you think would be helpful. I'm by no means an expert, but these are the steps we took to get it working.
     
    Sources (useful if you're more interested):
    https://steamcache.github.io/
    https://github.com/steamcache/generic
    https://hub.docker.com/r/steamcache/steamcache-dns/
     
    Also, if you want to learn how to set this up raw dawg with a full manual install, Arstechnica has a great article on how to do that, along with a bunch more information related to the docker setup. Check it out here: https://arstechnica.com/gaming/2017/01/building-a-local-steam-caching-server-to-ease-the-bandwidth-blues/
     
     
×