lancachenet / monolithic

A monolithic lancache service capable of caching all CDNs in a single instance
https://hub.docker.com/r/lancachenet/monolithic
Other
728 stars 73 forks source link

Steam Beta Client supports LAN Event DNS injection #81

Closed carroarmato0 closed 4 years ago

carroarmato0 commented 4 years ago

The latest Beta update of the Steam client of December 20, 2019, mentions the explicit support for redirecting downloads and updates through a locally running cache server: https://steamcommunity.com/groups/SteamClientBeta/announcements/detail/1698352047820654696

General Support a LAN event using DNS injection on lancache.steamcontent.com to set up a local explicit caching proxy for downloads.

Looks like it should be enough to inject the IP address(es) of the local cache server for that DNS entry. For backwards compatibility this could just be appended to the list of managed DNS overrides to support both stable and beta releases of the Steam client.

VibroAxe commented 4 years ago

Just to keep this issue up to date, we are looking into this. There are a few complications with the way monolithic categorises cache types which we will need to iron out before this hits the live steam.

Currently we categorise cache traffic using the requested cdn name (matching it to the uklans list). Unfortunately this method will no longer work as we would remove all but the lancache cdn from the DNS injection list.

We are working with valve on how best to categorise steam traffic (possibly the user agent) and hope to have a PR in place soonish!

EDIT It's worth noting that generic should work immediately with this new setup (but would obviously invalidate your existing caches), just set the new override and it should start to work.

clee commented 4 years ago

This doesn't seem to be working with the current Steam beta for me at all. I took lancache-dns out of the equation, and added lancache.steamcontent.com directly to the hosts file on my Windows machine. No traffic goes to the monolithic container at all with this configuration.

With lancache-dns enabled, all of my Steam downloads are instead going through sniproxy, which I can see clearly by inspecting the network traffic.

Is there some step I'm missing? Does the lancache.steamcontent.com lookup have to be over DNS? Because I also tried using CoreDNS as the SOA for lancache.steamcontent.com to override the record that way, and it still doesn't work.

VibroAxe commented 4 years ago

What host names are you seeing in sni for steam?

VibroAxe commented 4 years ago

And what IP are you using for lancache

clee commented 4 years ago

My lancachenet/monolithic container is listening on 10.10.10.220, .221, .222, and .223.

When I have lancache-dns disabled, using either the hosts method or using CoreDNS, no traffic for Steam seems to even hit the container listening on those IPs, like, at all.

I tried using lancache-dns with CACHE_DOMAINS_REPO=git://github.com/clee/cache-domains, you can see that I removed everything except the lancache.steamcontent.com entry in steam.txt. With this configuration, none of my Steam traffic appears to be going to the monolithic container either.

When using lancache-dns with the default cache domains repo, it looks like sniproxy is seeing a bunch of connections like so:

2020-01-17 18:28:28 172.17.0.1:56706 -> 172.17.0.3:443 -> 69.241.121.226:443 [edge.steam-dns.top.comcast.net] 245846/245846 bytes tx 1454/1454 bytes rx 60.480 seconds
2020-01-17 18:28:28 172.17.0.1:56707 -> 172.17.0.3:443 -> 69.241.125.46:443 [edge.steam-dns.top.comcast.net] 247737/247737 bytes tx 1454/1454 bytes rx 60.478 seconds
2020-01-17 18:28:28 172.17.0.1:56709 -> 172.17.0.3:443 -> 69.241.121.242:443 [edge.steam-dns.top.comcast.net] 245475/245475 bytes tx 1454/1454 bytes rx 60.526 seconds
2020-01-17 18:28:28 172.17.0.1:56712 -> 172.17.0.3:443 -> 69.241.121.226:443 [edge.steam-dns.top.comcast.net] 704273/704273 bytes tx 1454/1454 bytes rx 60.776 seconds
2020-01-17 18:28:28 172.17.0.1:56710 -> 172.17.0.3:443 -> 69.241.50.42:443 [edge.steam-dns.top.comcast.net] 960358/960358 bytes tx 1454/1454 bytes rx 60.878 seconds
2020-01-17 18:28:28 172.17.0.1:56711 -> 172.17.0.3:443 -> 69.241.121.226:443 [edge.steam-dns.top.comcast.net] 1010298/1010298 bytes tx 1454/1454 bytes rx 60.936 seconds
2020-01-17 18:28:50 172.17.0.1:56696 -> 172.17.0.3:443 -> 69.241.121.250:443 [edge.steam-dns.top.comcast.net] 12507903/12507903 bytes tx 4982/4982 bytes rx 198.959 seconds
VibroAxe commented 4 years ago

Aaah. Are you on comcast?

clee commented 4 years ago

I am indeed.

mintopia commented 4 years ago

I've opened issue 85 for tracking feedback on this, as it's now live in the normal Steam client as of today. I've also highlighted the comcast issue here with Valve, I'll update this issue with anything when I get it.

mintopia commented 4 years ago

Can you confirm that lancache.steamcontent.com is resolving to your cache IP - as long as it resolves via nslookup, it should be enough (it should respect hosts file AFAIK). Also, if you could attach the relevant parts of your content.log file in your steam directory's logs folder.

There should be lines like this:

[2019-12-21 17:15:14] Enabling local content cache at '::ffff:c0a8:1e80' from lookup of lancache.steamcontent.com.
[2019-12-21 17:15:14] Adding cache type 'LANCache' on host '::ffff:c0a8:1e80'

It should be the case that with the lancache override Steam shouldn't be trying HTTPS, it should always fallback immediately to HTTP.

clee commented 4 years ago

Okay, after all the troubles I had, I went back to basics.

Now, I do indeed see Enabling local content cache at '::ffff:a0a:adc' from lookup of lancache.steamcontent.com. and the game I tested downloaded at over 800mbps. Hooray!

VibroAxe commented 4 years ago

@clee officially we don't support ipv6, but i'm pleased to see it looks like you have it working. I'm not sure how lancache-dns would behave in this situation so it's possible that's your issue. Either way, looks like it was config based and is now working. Glad you got it running!

Note: this rolled into the mainline steam today, so you shouldn't need beta any more

VibroAxe commented 4 years ago

Note: Temporarily we have added the lancache.steampowered.com into cache_domains in addition to the current known upstream domains. We now have agreement from steam that they we can cache key using a specific agent, so we should be able to improve this at some point

andriesinze commented 4 years ago

Okay, after all the troubles I had, I went back to basics.

  • Manually set DNS servers to 1.1.1.1 and 1.0.0.1
  • Enabled lancache.steamcontent.com entry in my hosts file
  • Restarted Steam
  • Started downloading a game I know is in the monolithic cache

Now, I do indeed see Enabling local content cache at '::ffff:a0a:adc' from lookup of lancache.steamcontent.com. and the game I tested downloaded at over 800mbps. Hooray!

Is that "cold cache" performance, so where the game wasn't downloaded already on the cache?

GotenXiao commented 4 years ago

Just as a note on the IPv6 addresses people are seeing here - the ::ffff/96 prefix is the entirety of the IPv4 address space mapped into IPv6, usually presented as ::ffff:192.168.0.1 or similar; ::ffff:a0a:adc maps to ::ffff:10.10.10.220. There's a commandline tool available on most Linux distributions called ipv6calc that can translate from the hexadecimal representation to the IPv4 dotted-octet representation for convenience.

More detail on Wikipedia and in RFC 4291 and RFC 4038.

clee commented 4 years ago
  • Started downloading a game I know is in the monolithic cache

Is that "cold cache" performance, so where the game wasn't downloaded already on the cache?

No, the game I was downloading (Alan Wake) was already in the monolithic cache.

However, I'm seeing some weird behavior here - my local lancache server gets picked up, and then this happens:


[2020-01-23 15:51:58] Downloading 854 chunks from depot 250821
[2020-01-23 15:52:08] Increasing target number of download connections to 4 (rate was 0.000, now 56.651)
[2020-01-23 15:52:10] Forgetting cache type 'LANCache' on host '::ffff:a0a:adc' due to chunk timeout.
[2020-01-23 15:52:10] HTTP (CDN,64) - edge.steam-dns.top.comcast.net (10.10.10.220:80 / 10.10.10.220:80, host: edge.steam-dns.top.comcast.net): Received 0 (Invalid) HTTP response for depot 250821
[2020-01-23 15:52:10] HTTP (CDN,64) - edge.steam-dns.top.comcast.net (10.10.10.220:80 / 10.10.10.220:80, host: edge.steam-dns.top.comcast.net): Disabling dual-stack for this connection
[2020-01-23 15:52:10] Failed unpacking chunk "62c8c8cdff8a5a41b3bd725662458f3fa576a2ee" from "::ffff:a0a:adc/depot/250821/chunk/62c8c8cdff8a5a41b3bd725662458f3fa576a2ee" (Unpack failed (c:1054848,u:0,b:2097152))
x-sazzad-rt commented 4 years ago

recently i've made a lancache follwing lancache.net page, and its working fine. but i need some some help. i've my own local dns server, so how may i forward lancache requests through my local dns......

carroarmato0 commented 4 years ago

recently i've made a lancache follwing lancache.net page, and its working fine. but i need some some help. i've my own local dns server, so how may i forward lancache requests through my local dns......

What DNS software are you using? Depending on which one, you can download this repository and have it generate the necessary configuration entry for you. Worst-case scenario you'll have to manage this manually: https://github.com/uklans/cache-domains

x-sazzad-rt commented 4 years ago

my local dns server running using bind..

x-sazzad-rt commented 4 years ago

In my ISP scenario i can't use lancache ip as a dns server to my client end, so can you please help me to find out a way so that, my clients will get cache content using my local dns server, actually i've need what configuration should to be done in my local dns.

carroarmato0 commented 4 years ago

In my ISP scenario i can't use lancache ip as a dns server to my client end, so can you please help me to find out a way so that, my clients will get cache content using my local dns server, actually i've need what configuration should to be done in my local dns.

The first step is to have your clients actually use your own local DNS server for resolving IP addresses. I assume that part is ok.

The fundamental idea of the Lan Cache is that your own local DNS server will reply to DNS queries for the various CDN Zones (Domains) used by whatever gaming platform you wish to serve locally.

So if you want to cache Steam games locally, you will have to create the relevant Zone file in Bind, and for each domain in this list, have bind answer back with the IP address of your cache server: https://github.com/uklans/cache-domains/blob/master/steam.txt