bntjah / lancache

Improve download speeds and reduce strain on your Internet connection at LAN parties. Locally cache game installs and updates from the largest distributors: Steam, RIOT, Blizard, Hirez, Origin, Sony, Microsoft, Tera, GOG, ArenaNetworks, WarGaming, and Uplay. Super easy to setup with auto installer script!
173 stars 44 forks source link

Use hostnames instead of fixed IP address on interfaces #29

Open travispk opened 7 years ago

travispk commented 7 years ago

I used to use this configuration of a LANCache a few years ago (https://blog.yolocation.pro/index.php/2016/02/03/how-to-install-lancache-on-debian/)

One thing I REALLY liked about it, is that it only used 1 IP address. It had the hostnames part of the Nginix configuration for virtual name hosting. For example, if Steam client connected, Nginx would look at the Host in the HTTP header and identify it is connecting to a Host defined for Steam and direct it to that depot. This GREATLY simplified the LANCache configuration and DNS. Thoughts on implementing that in your AWESOME lancache?

bntjah commented 7 years ago

Have to look in to this; great idea though!

travispk commented 7 years ago

Awesome! I have my event coming up this weekend. So I'm getting the LANcache server ready for it. LANFest NETWAR 32.0 - https://lanfest.intel.com/events/netwar32

travispk commented 7 years ago

I wish I had more free time cycles to work on this. Does anyone else?

If we add "server_name" directives in server settings in each vhost depot. We could consolidate all of the depots to a single IP address on the lancache server and GREATLY simplify it. Just need to take all of the DNS entries in Unbound and add them to server_name in each vhost. When a HTTP request comes to lancache, nginx will identify via http host header which vhost this request belongs to (virtual hosts), instead of by interface IP address.

For example, for Steam:

server { listen 80; server_name .steamcontent.com client-download.steampowered.com content1.steampowered.com content2.steampowered.com content3.steampowered.com content4.steampowered.com content5.steampowered.com content6.steampowered.com content7.steampowered.com content8.steampowered.com cs.steampowered.com clientconfig.akamai.steamstatic.com hsar.steampowered.com.edgesuite.net .cs.steampowered.com .hsar.steampowered.com.edgesuite.net .akamai.steamstatic.com;

We could then make these changes to lancache and it's installer:

  1. Remove the host address in the "listen" directive in Nginx that forces the depot to a specific interface IP (let it go to the default single IP on box). Just make it listen 80;
  2. Remove proxy_bind from Nginx
  3. Remove everything that modifies the host file
  4. Remove everything that modifies the system network interfaces
  5. Modify Unbound records to all be the same single IP of lancache
  6. Rejoice in great simplification of lancache, the installer, and the manual install.

For existing installs: Fresh install of OS for existing lancache install might be wise after this simplification (removal of additional interfaces, host entries, etc.) Or steps to clean it up.

ilumos commented 6 years ago

@travispk I've done this in my fork: https://github.com/zeropingheroes/lancache