Question about DNS configuration inside home network for a caching service

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,898
Location
USA
I'm researching this utility/project on github called LANcache which is used for caching game downloads from the various online distribution methods such as Steam, Origin, Blizzard, etc. I'm fine with going through and setting up a dedicated system/VM to host this solution. What I'm unsure about is how does one configure the DNS side of things such that when an existing or new system plugs into my network like in the case of where I have a few people over for a LAN party that whenever people try to download and install a game that the DNS routes to this new LANcache system? Would I need to also create my own DNS server and route all my traffic through that via a config change on my router?

This website suggests this but I'm not 100% clear on it such that it would make things transparent to the systems on my network. They say "Remember to let you local DNS server forward all the required addresses to your nginx server.". This makes sense to me but it assumes I have my own DNS server (I guess)? Is this a case where I can setup my own DNS as primary and then use something like Google for the second and third or would my own DNS only just forward everything to different locations?
 

ddrueding

Fixture
Joined
Feb 4, 2002
Messages
19,715
Location
Horsens, Denmark
Sounds right. Most NATing routers have a DNS server in them, but it is unlikely to support this kind of conditional redirect.
 

blakerwry

Storage? I am Storage!
Joined
Oct 12, 2002
Messages
4,203
Location
Kansas City, USA
Website
justblake.com
dnsmasq running on the lancache server or a pfsense (or similar software) allows you to override specific DNS names and point them to an arbitrary ip address. Another option would be to add the entries to your hosts file (perhaps the template hosts file could be hosted on the lancache server for easy access/distribution).

Full blown DNS servers like BIND tend to work at the zone level, and overriding individual records in a zone that you are not authoritative for may be possible, but is probably trickier and not something I'm familiar with. I believe Windows server DNS allows something similar where you can be authoritative for a zone and specify a few records and then let anything not defined in your zone fall through to a different server (your normal recursive DNS server, for example). This could be one option for those not running dnsmasq and wanting to avoid hosts files.
 

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,898
Location
USA
Sounds right. Most NATing routers have a DNS server in them, but it is unlikely to support this kind of conditional redirect.

I do have a fairly flexible router; I'm using a Ubiquiti EdgeRouter PoE and they've added a lot of advanced features in the most recent releases so I was hoping to leverage some of that if I was able to.

dnsmasq running on the lancache server or a pfsense (or similar software) allows you to override specific DNS names and point them to an arbitrary ip address. Another option would be to add the entries to your hosts file (perhaps the template hosts file could be hosted on the lancache server for easy access/distribution).

Full blown DNS servers like BIND tend to work at the zone level, and overriding individual records in a zone that you are not authoritative for may be possible, but is probably trickier and not something I'm familiar with. I believe Windows server DNS allows something similar where you can be authoritative for a zone and specify a few records and then let anything not defined in your zone fall through to a different server (your normal recursive DNS server, for example). This could be one option for those not running dnsmasq and wanting to avoid hosts files.

My router offers dnsmasq support which I'm currently using as part of a whole-house ad-block but I'm unclear if that's something I can leverage for this task. What I'd really like is to not have every person have to edit/append a hosts file on their system if possible. I was trying to understand what is needed to make it seamless from their perspective. I'm fine with hosting a separate system to act as a DNS server if that would be the most transparent way of doing this I just don't really know where to start to learn more about how to set something like this up. I think what you described is what I was hoping for. If my local DNS server only managed/redirected the small subset of domains to my LANcache and basically forwarded lookups to official DNS servers I was hoping something like that could work.
 

Howell

Storage? I am Storage!
Joined
Feb 24, 2003
Messages
4,740
Location
Chattanooga, TN
Keep in mind that serving DNS it's a combination of what your local dvd server knows and what it can ask someone else. A hosts file is a way of telling a device what it knows and preempts what it might learn automatically.
Based on your description of what the special software does, you need dhcp to point your lan clients at the special server when querying certain addresses and do dynamic lookups otherwise. So you need to be able to edit the hosts file on your dns server (as defined in dhcp settings) and work normally the rest of the time. If the Ubiquity will do that, you are golden. Otherwise, you can configure dhcp to use the special server for DNS, configure the hosts file on the special server, and configure forwarders on the special server for dynamic lookups.

Hope that is enough meat for what you are trying to do.
 

Howell

Storage? I am Storage!
Joined
Feb 24, 2003
Messages
4,740
Location
Chattanooga, TN
Since I'm awake again, I was referring before to what your dns server already knows. The circumstances I'm thinking of would be when the dhcp server hands out an address, it updates its own dns cache in conjunction. Also, some client devices can be configured to send DNS updates even if they are statically assigned ips, I'm thinking of printers. I believe according to the rfc any client must give its own hosts file ultimate authority; and a dns server is both a client and a server.

In addition to the ideas from the previous post you could have the whole router request dns from the special server and the special server could talk to the outside world. You would not need to modify any hosts files with this method but all DNS queries would be dependant on the speed of the special server.

Sorry for the play by play, it's hard to know exactly which concept is missing.
 

blakerwry

Storage? I am Storage!
Joined
Oct 12, 2002
Messages
4,203
Location
Kansas City, USA
Website
justblake.com
If you're already using dnsmasq, then you're in good shape. I'm not familiar with the edgerouter config, but dnsmasq is often configured to read from /etc/hosts or a separate hosts file and use this data for providing DNS answers to clients. Specify the necessary entries in your /etc/hosts file on your edgerouter and then restart dnsmasq. Test by using nslookup on a client that uses your edgerouter for dns resolution.
 

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,898
Location
USA
I'm a bit late in replying to my own thread for this topic. I ended up trying out these Docker images from Steamcache. One image makes use of nginx to do the caching and lookup and the other runs a specific instance of bind as a DNS server. These both live on a Linux VM inside my home network that is not accessible from outside. The last step was for me to add the IP address of this VM to the DNS server list in my router as the first DNS server with the additional two going right to Google.

Since this new DNS server forwards to Google anyway it does add an extra level of lookup (or so that's how I envision it). I don't know if how I've configured this will cause me issues in the long run which is why I'm mentioning it here. This is the DNS server configuration as found on github. My assumptions which could be very wrong are that if this DNS server is offline, my router should continue by using the additional two servers (from Google) that I've defined. I just won't get the caching benefit during this time.

Overall the cache isn't working 100%. I've been monitoring the logs and doing some tests with downloading a game so that it caches the chunks of data, uninstalling the game, then downloading again to see if it reads from my cache and I'm not seeing 100% hit rate. I'm probably seeing more like 30%. When it does hit form the cache, it's very fast. I'm seeing downloads near 70MB/sec through Steam.

I found a issue being tracked on github similar to mine which I'm following. I don't know if this is DNS-related due to how I have things configured. I'm still learning and experimenting with this all.
 
Top