Skip to content

Instantly share code, notes, and snippets.

@DrJume
Last active September 1, 2024 16:33
Show Gist options
  • Save DrJume/490e08f7f1be1daf5f5d3ae82a1a733e to your computer and use it in GitHub Desktop.
Save DrJume/490e08f7f1be1daf5f5d3ae82a1a733e to your computer and use it in GitHub Desktop.
Using lancache with a FritzBox

Using lancache with a FritzBox is not very straight forward:

  1. You need to have access to the DNS settings in the FritzBox web interface. Some providers disable this setting to force their customers with specific settings, like their own (mostly slow) DNS servers.
  2. Set both DNS server entries to your local IP address, on which the lancache is accessable.
  3. The FritzBox has a DNS rebind protection. To disable this for the hostnames, which are used for the lancache, you need to specify them as a list format in the web interface.

All the hostnames can be found at uklans/cache-domains. Download the repo and switch into the directory.

cat *.txt | grep -v "^#" | sed -E 's/\*\.//' | sort | uniq

These commands pipe their output as a input into the next one. This is a very powerful technique in the world of Unix.

  • cat *.txt - display the content of all files ending with ".txt" in a concatenated form

  • grep -v "^#" - discard all lines beginning with a hashtag (comments)

  • sed -E 's/\*\.// - substitute all '*.' (wildcards) from the hostnames with an empty string. The symbols need to be escaped with a '\' for them to be interpreted literally and not as a placeholder. (beware of the -E flag, I mostly use the more modern Extended RegEx mode, which also is the standard in most scripting/programming languages)

  • sort | uniq - sort all the lines in order to remove duplicates with uniq

@janstuemmel
Copy link

Thank you! I stumbled accross rebind protection yesterday but didn't think of it today -.-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment