Jump to content

Synology NAS lancache+pihole

lancache.thumb.png.5f635cb03e2f5633e0883b133e14d0cf.png

 

First of i should start saying that this is my first tutorial, i am not extremely experienced with linux or docker(started using it just this year) and everithing here was built on aproches that none seemed to use.

Before going any further this is using Lancache-Monolitic, not just a specific instance.

 

Now with that out of the way the folowings are the status quo of the aproach used in this tutorial(if i can call it that):
Advantages:

  1. (this could be considered either a pro or a con) The NAS ip adress is not used for anything relating lancache or pihole; they use different IP's
  2. Pihole log shows the real adress so no more " all requests form 172.16.0.1"
  3. Only docker and it's features are used(if we count the containers)
  4. 90% GUI  utilisation 10% use of CLI, you could use Putty or even linux terminal(i used that) because you need access to the root files
  5. No meddling with the router or making port forwardings or proxy's
  6. And, NO VM!

Disadvantages (or not solved issues):

  1. For the moment it is mandatory to start the containers manualy in a specific order or this doesn't work. I will try to find a solution on this and i have a lead but don't know how to implement it ( manualy assign MAC addresses to the containers was the best i could find but don't know how to do it yet)
  2. lancache dns and sniproxy are on different IP's, so only the dns can be used at this time. Like above i have a solution but no time to research now, and that would be either a bridge between the network or merging all docker containers in one

 

Prerequisites:

  1. A Synology NAS with DSM installed and functional (or something with a working docker application)
  2. Docker installed
  3. A working ssh connection  ( you can find other tutorial for this on the web)
  4. A bit ok knowledge about you're network; mostly you're router IP, subnet(usualy 255.255.255.0 or the equivalent /24), and what IP's you have free on the network

 

Now let's start the fun part:

To speed things out make sure you have the following images downloaded in you're docker: 

  1. pihole/pihole:latest
  2. lancachenet/monolithic:latest
  3. lancachenet/lancache-dns:latest
  4. lancachenet/sniproxy:latest
  5. portainer/portainer-ce:latest

 

First Step is to install Portainer( this is the part where you need th SSH into the NAS)

I will use the linux terminal so i need to do the following:

  1. use the command "ssh [user]:[IP of the NAS]" to connect to the nas
  2. use "sudo su -" to get priviledges to use the "docher info" command
  3. use "docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v [**]:/data portainer/portainer" here [**] should look something like this: "/volume1/docker/portainer/data"(without " )*

that path assumes you have a "docker" directory in you'r file system and a structure like so: 
docker

└── portainer
    └── data

1310147243_Screenshot2021-02-18155638.thumb.png.a263f90d7e8f350d57c713d2e21b5de7.png

 

After this we need to find the name of the network card using "ip addr", look for the zone where it's mentioned the NAS ip, in my case "ovs_eth0". Remember this!

 

1247249160_Annotation2020-06-09231119.thumb.png.1b5bede1460a95aec1d17e17634f74ee.png

Now we are done with the CLI and should see the portainer container in the docker interface

1759329684_Annotation2020-06-09225825.thumb.png.9cdc0b871cc055d9d682ca00442724f8.png

 

 

Now we need to go on the following URL to configure portainer: [IP of the NAS]:9000 ; in my case 192.168.1.2:9000 

the first time you get here you will receive a page where you need to create a user with a password followed by one where you need to sellect docker local. You should then be send to a page that looks like this:

1525620458_Annotation2020-06-09230919.thumb.png.1e90a6fd2338fc31e20edeb33450900a.png

Next click on local then go to the left side on the Networks tab:

265696411_Annotation2020-06-09231019.thumb.png.b3eaca83608a262dd597acbf11f301f0.png

 

Here you need to add a newtork someting like this:

2089910850_Annotation2020-06-09232053.thumb.png.ed50ea3dc39d4786e63215b67fb6de88.png

 

Name: write something here

Driver: needs to be macvlan
Port Network card: type what you have found earlier in CLI

Gateway; you're router IP
Subnet: Mine is 192.168.1.x/24 that means that i can have any ip from 192.168.1 all the way to 192.168.1.254, you can find this information in the DHCP tab of you're router
IP range: here you need to specify what IP you want to save for all the containers that will inhabit this network, i chose to alocate the IP's in the range 192.168.1.16 - 192.168.1.32 that is why i have /29


 

Now we have a configuration but we need a concrete connection so go back to the networks and click Add again and do the following:

1660477624_Annotation2020-06-09232153.thumb.png.84405253e87bac25decdfd09f8fd46ce.png

 

Name: this time this is a little bit more important because you will use this so chose a good one

Driver: the same macvlan
This time however you need to chose "Create" NOT "Configure".

Configuration: chose the one you made earlyer.

Optional but i use it is the "Enable manual container attachment" this will let you change containers network dynamicaly. Good to have i tought.


 

After you click create we are done with portainer for now.

We go back to the Docker interface on our NAS.

First we need to configure pihole, you can go to any instalation video but the most important thing will be in the network tab click on "+" and add our newly created network and delete the old "bridge" one, leav all the "Port settings" on Auto and set the "ServerIP" from the Environment tab to the first addres in our range. In my case 192.168.1.16 .

598506455_Annotation2020-06-0923215a3.thumb.png.315bc1d4b2d253706c7243b19c979e38.png

 

Now you need to make shure that the pihole works so go to the assigned addres in my case 192.168.1.16 and should be reddirected to the admin page. After you login you need to go to Setting->DNS and make shure the left "Upstream DNS Servers" are all unchecked and in the right you check Custom1 (IPv4) and write the 3'rd addres in you're range mine was 192.168.1.18 . (One issue here is that sometimes if you check to use both custom dns's [custom 1 and 2] i was facing some packets not caching, this needs to be checked later so for now i use only custom 1)

1500495252_Annotation2020-06-0923215b3.thumb.png.0774a7925a60d85207c46d87e8fe91eb.png

 

Now you can install lancache with the same aproach as Pihole, selecting the newly created network, leave all ports on Auto the rest you can find in a tutorial ( if need be i will add later some more details) but the most important is to have the good network selected.

Now to install lancache-dns and sniproxy, this have the same principles but the environment "LANCACHE_IP" needs to be set to the second ip in the network, mine is 192.168.1.17 and "USE_GENERIC_CACHE" is set on true. if you don't see this you need to click + on the top. And i beleve it's the same with sniproxy.

Now all you need to do is set you're DNS to the pihole addres and start testing if it works(maybe with those 100MB games that you have laying around in the steam).

 

 

Very Important!

Now that we have set all the Ip we need to start the containers in the following order every time(portainer is an exception, because it's irelevent when we start it): PIHOLE -> Lancache-monolitic -> Lancache-dns -> lancache-sniproxy(this is optional because it's not working right now).

To verify that the containers have been started in the good order you can go to portainer to Networks -> click on you're network that you made(the "Create" one) and make shure you have at the bottom something like this:

where my pihole has the first ip .16, my lancache has the second .17 and the dns has .18

1832706105_Annotation2020-06-0923215c3.thumb.png.b95b24c59c54707e66dfa9f1436607e1.png

 

 

Final toughts:

If someone is interested in solving the isues i will gladly update this post after i verrified that it will work.

If someone want's to stilize this post it can contact me with a PM.

From what i've tested i have Peek download 67.3 MBps when downloading from the cache using wifi in the same room from both Steam and Epic. As af the time of writing this i have 300GB of games cached and an acces log of over 100MB :D

If you encounter problems i will try to help you but i don't realy have much time because i'm in the last year of college and i'm ending it soon, but i will try. Hope this helped someone.

P.S. if someone makes a video on this i demand to be good quality and to leave a link here so i can see it :)))

Annotation 2020-06-09 225610.png

Link to comment
Share on other sites

Link to post
Share on other sites

I learn about lancache today and you upload your tutorial the same day ! 😀

 

I can fill my synology with my games now 😄

 

 

Thanks a lot !

Link to comment
Share on other sites

Link to post
Share on other sites

  • 8 months later...

This is my first time using docker and one of my first times using linux other than Home Assistant on a raspberry pi so I'm unclear on whether I've done something entirely wrong, missed a step, or if the latest versions of these docker containers are no longer compatible (I don't even know how that would work so sorry if that's so out of touch its offensive or smthg). 

 

I can't access the portainer. Am I supposed to be accessing it on my synology's local ip with the port 9000? or have I just misunderstood?

 

could someone please help, theres 6 gaming PCs in the house and all on the same games but the internet speed barely breaks 5mbps so a seige update will set us back a week instead of a night atm.

Matthew Gilbride

Link to comment
Share on other sites

Link to post
Share on other sites

@Matt1632 Soo you say you followed all the steps, ssh into your nas, installed the docker container with a command like the one I used and the not be able to access the [nas ip]:9000 ?

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Soul Eather said:

@Matt1632 Soo you say you followed all the steps, ssh into your nas, installed the docker container with a command like the one I used and the not be able to access the [nas ip]:9000 ?

to the best of my knowledge

 

I'll go over it againt to see what I've done wrong but yes, i'm saying i cant get anything to turn up on port 9000 

Matthew Gilbride

Link to comment
Share on other sites

Link to post
Share on other sites

@Matt1632 from what i see the method still works. you might want to try again. I edited the original post to hopefully be more clear and instead of the original "portainer/portainer" now i tried with "portainer/portainer-ce" wich is the latest version 2.1.1.
And may be that i not understood corectly but you did try to access that address([IP of the NAS]:9000) via you'r browser(like you do to get to it's desktop) no?

Link to comment
Share on other sites

Link to post
Share on other sites

6 hours ago, Soul Eather said:

@Matt1632 from what i see the method still works. you might want to try again. I edited the original post to hopefully be more clear and instead of the original "portainer/portainer" now i tried with "portainer/portainer-ce" wich is the latest version 2.1.1.
And may be that i not understood corectly but you did try to access that address([IP of the NAS]:9000) via you'r browser(like you do to get to it's desktop) no?

I typed in my nas's ip:9000 into chrome

 

Matthew Gilbride

Link to comment
Share on other sites

Link to post
Share on other sites

1. Did you check to se if it's started on the docker interface in DMS?
2. If it's running can you post the log from Details> Log?

Link to comment
Share on other sites

Link to post
Share on other sites

56 minutes ago, Soul Eather said:

1. Did you check to se if it's started on the docker interface in DMS?
2. If it's running can you post the log from Details> Log?

i will check as soon as i can and get back to you

Matthew Gilbride

Link to comment
Share on other sites

Link to post
Share on other sites

  • 1 month later...

After many guides found on the internet but only with this I was able to make everything work.
I only have problems with battle.net, it doesn't download at full speed.
Has anyone had this problem?

Link to comment
Share on other sites

Link to post
Share on other sites

17 hours ago, AMBRO666 said:

After many guides found on the internet but only with this I was able to make everything work.
I only have problems with battle.net, it doesn't download at full speed.
Has anyone had this problem?

As i see from other people comments it is a problem from lancache and it doesn't seem to have a fix.
If you wanna read more about this i found a github issue and a reddit post that talks more about this: GitHub, Reddit

Link to comment
Share on other sites

Link to post
Share on other sites

  • 1 year later...

I know this is super old, but I just had two thoughts on ways to deal with the starting order issue.
1) Is to use a unique network for each container (and setting one available IP for that network when creating it) (Update: this option doesn't work)
2) It may be possible to ensure everything comes up in the same order by using a docker-compose stack

Update:

I was able to get everything to work using a docker compose stack in Portainer. Let me know if I should start another thread with instructions on how to do that.

Edited by Freddo3333
Update
Link to comment
Share on other sites

Link to post
Share on other sites

8 hours ago, Freddo3333 said:

I know this is super old, but I just had two thoughts on ways to deal with the starting order issue.
1) Is to use a unique network for each container (and setting one available IP for that network when creating it) (Update: this option doesn't work)
2) It may be possible to ensure everything comes up in the same order by using a docker-compose stack

Update:

I was able to get everything to work using a docker compose stack in Portainer. Let me know if I should start another thread with instructions on how to do that.

Hi, sorry for the late reply, I think it would be better if you create another tread with step by step instructions as to not have any confusions. And if you want tag this tread.

Link to comment
Share on other sites

Link to post
Share on other sites

On 9/17/2022 at 6:53 AM, Freddo3333 said:

I know this is super old, but I just had two thoughts on ways to deal with the starting order issue.
1) Is to use a unique network for each container (and setting one available IP for that network when creating it) (Update: this option doesn't work)
2) It may be possible to ensure everything comes up in the same order by using a docker-compose stack

Update:

I was able to get everything to work using a docker compose stack in Portainer. Let me know if I should start another thread with instructions on how to do that.

Looking for a solution like that. If you could create a new thread 🙂 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×