Skip to content

Lan Cache Server

Deathraymind edited this page Dec 23, 2023 · 2 revisions

Documentation: Setting Up a Steam Cache Server on TrueNAS SCALE

Introduction

This guide outlines the process of setting up a Steam cache server using TrueNAS SCALE. The cache server will help in reducing bandwidth usage and improving game download speeds on your network.

Prerequisites

  • TrueNAS SCALE server installed.
  • Understanding of ZFS, Docker, Kubernetes, and network configuration.
  • pfSense router and optional Zentyal or AD/LDAP server for network management.

Configuration Steps

1. Preparing TrueNAS SCALE

  • Login to TrueNAS SCALE.
  • Go to System Settings > GUI Settings.
  • Change web ports to 444 and 81 to free ports 443 and 80 for the cache server.
  • Ensure a storage pool is created in Storage > Create Pool.
    • Use similarly sized drives for a RAID-Z configuration for data redundancy.

2. Creating Directories for Cache Data

  • Navigate to Datasets > Add Datasets.
  • Create a new directory named data, then within it, create another directory called cache.

3. Setting Up Kubernetes

  • TrueNAS SCALE uses Kubernetes (via Rancher) for scalable Docker deployment.
  • Go to Apps > Settings > Advanced Settings.
    • Node IP: Set to 0.0.0.0 (localhost).
    • Route Interface: Set to your physical interface (e.g., enp0s25).
    • Route v4 Gateway: Set to your router’s IP (e.g., 172.16.0.1).
    • Cluster CIDR: Use a different subnet than your network (e.g., 172.17.0.0/16).
    • Service CIDR: Use another separate network (e.g., 172.18.0.0/16).
    • Cluster DNS IP: Set to 172.18.0.10.

4. Static IP Configuration in pfSense

  • Set a static IP for TrueNAS SCALE (e.g., 172.16.16.110) in pfSense (Status and Leases).
  • Restart TrueNAS SCALE.

5. SSH into TrueNAS SCALE

  • Use the command: ssh admin@172.16.16.110.

6. Installing Docker Compose

  • Download the latest version of Docker Compose from the official releases.
  • Install with:
    sudo curl -L "[Docker Compose Release URL]" -o /usr/local/bin/docker-compose
    sudo chmod +x /usr/local/bin/docker-compose

7. Setting Up Lancache

  • Navigate to the cache directory: cd /mnt/NAS/data/cache.
  • Clone the Lancache repository:
    git clone https://github.com/lancachenet/docker-compose lancache
    cd lancache
  • Edit the .env file with sudo nano .env and configure as follows:
    • LANCACHE_IP=172.16.16.110
    • DNS_BIND_IP=172.16.16.110
    • UPSTREAM_DNS=172.16.16.40 (Your Pi-hole or primary DNS server).
    • CACHE_ROOT=/mnt/NAS/Data/cache
    • Other relevant settings (disk size, memory, timezone).

8. Starting Lancache

  • Run sudo docker-compose up -d to start the Lancache Docker instance.

9. Integrating with Network

  • If using a Zentyal or AD/LDAP server for DNS management, configure it to use the Lancache server as a DNS forwarder.
    • Add a new DNS forwarder pointing to the Lancache server (e.g., 172.16.16.110).

10. Testing the Setup

  • On a host machine, test with nslookup steam.cache.lancache.net (should resolve to TrueNAS SCALE IP).
  • Ping google.com and your AD/LDAP server (e.g., cybersecurity.lan) to confirm network connectivity.

Conclusion

By following these steps, you have set up a Steam cache server using TrueNAS SCALE. This setup will allow for efficient game downloads and updates, reducing internet bandwidth usage on your network. Remember to monitor and maintain your TrueNAS SCALE and network configurations for optimal performance.

Clone this wiki locally