Hi again with my stupid questions:
I’m using pi-hole as DHCP server.
The question is: If dietpi is down for some reason, can this affects the devices connected through pi-hole? I mean when dietpi is down the devices connected are off-line too?
Hi again with my stupid questions:
Basically yes if your clients use PiHole as DNS server. Without PiHole being available, non of your clients (who use PiHole as DNS) will be able to resolve DNS request.
mmm this could be a problem for me because I have some devices that have to be connected 24hours a day.
Since I’m using pi-hole just to be able to connect from outside of the network and just to reach Owncloud from outside, do you have any suggestions on how to split the network between dietpi and all the other devices?
you are planning to switch off DietPi/OwnCloud/PiHole? You are not going to keep your SBC running 24/7?
Yes that is my idea… using it as a personal cloud
in this case your workaround using PiHole is not working.
Yes this is what I thought since two days ago I reboot remotely the pi and after it wasn’t reachable and I was not either able to reach another device.
What could be a solution for this purpose?
Rebooting the device should not have any effect. Usually everything should be back online in a couple of seconds.
Do you use any VPN solution to access your device remotely?
I assuming from the other postings that he made, that he probably meant to shutdown remotly the Pi remotly, not rebooting?!
And earlier you wrote:
Since I’m using pi-hole just to be able to connect from outside of the network and just to reach Owncloud from outside
Pi-Hole is not necessary to reach your network from outside your LAN. Pi-Holes main purpose is to block ads by using DNS filter lists.
Using a VPN would be maybe a better soultion for you, to have access to you LAN from the outside.
So for your better understanding: You need a DHCP and DNS server which are always “online”, to make sure your devices can communicate to the internet. Before you starting using Diet-Pi, your router did that job (he provided the DNS adresses for host resolution and gave your devices IP adresses for communication among themselves.)
A solution for you could be that you use your router again for DHCP (because your router is always turned on) and you assign your devices, which stay always on, custom DNS entries instead of using the IP of your Pi-Hole device.
I know Pi-hole has another function but, since my router is not able to manage my DDNS domain when I’m inside my network, we found a way to use pi-hole as DHCP server… I don’t think a VPN could solve this problem.
And also, yes I rebooted (not shootdown) the pi. I don’t know why after reboot it wasn’t reachable (nor out neither in the network) anymore. I manually and brutally rebooted it to solve this issue.
if possible connect a screen and try to reboot again. Maybe it will show something.
Btw: If I’m not mistaken, you changed the router in between. Isn’t it? Maybe the new one is able to handle your DDNS request from inside your network. Did you tried that?
Honestly, I tried to search the router app in order to check if there is a way to manage the DDNS inside the network. Since I didn’t find a section where to insert the DDNS credentials, I assumed it isn’t possible…
I check it better
can you share the router model?
And usually there is no need to enter the DNS record for your DDNS into the router. Usually a router should be able to handle it alone, passing the traffic correctly. The old router had some technical limitations not being able to manage this. But you could simply do a test.
Use one of your desktop computer and change DNS server to your router. As well you could stop PiHole for this test (yes, other LAN clients might have some issues during the test). And than test to access your OwnCloud application from inside the network on that desktop computer you changed DNS server to your router.
the router is:
Produced by:Sky CP Ltd
I found the DNS settings without any possibilities to change them (I think).
basically the question would be, if you are able to access your privat cloud using the router as is. Means, no PiHole and no special settings. Just the way you did before we start the journey.
sorry, but how can the router solve mydomain.ddns.net if I don’t tell him someway how to translate it? At the moment I tell to pi-hole how to do it and in the no-ip account there is no way to indicate where it should point to.
The DDNS service, which is running on your router (or your Raspberry Pi or wherever you run it), detects your public IP and detects when your public IP is changing and transmits it to the no-ip servers, which transmits it to the worldwide DNS root servers. Or maybe it goes straight to the DNS root servers, IDK, but the point is, it’s deposited there somehow.
When you now try to reach yourDDNS.com, your machine from where you call this domain asks the DNS servers, which you had configured on your machine (in your case it makes a request to your PiHole).
And in your piHole config you have set some DNS upstreams servers like google or cloudflare or quad9 or maybe you even run your own DNS server like unbound.
But no matter which way you go, they all get the IP for your requested domain call from a database which has the same data as the DNS root servers.
So every internet user which tries to reach your DDNS domain is forwarded to your public IP. It works like for every other domain on the internet, the only difference is, that you run a webservice on a non-static IP.
If you had a static IP, you could just register a domain, point it to your IP and you don’t have to care about it anymore. No need for DDNS.
This is how DNS works, kinda
I have some more addition, because you talked about that you have to “tell” PiHole about your DDNS.
When you make a custom DNS entry in PiHole, for example from yourDDNS.net to the local IP of your webservice device, your DNS call get’s “intercepted” from your PiHole.
like: jappevpn.ddns.net → 192.168.111.66
Normaly the route would be (without extra entry in Pihole, when you call from inside your LAN):
Your machine → Pihole → DNS upstream server you configured in Pihole
This DNS server now returns own your public IP back to you and you make a route from your machine to the internet back to your own network.
If you make an entry for this in PiHole like mentioned above, the route is just:
Your machine → Pihole
because PiHole has now an entry for this domain in its database: the local IP of your webservice device.
So you “save” some unnecessary route trough the internet.
Some routers (I know it from FritzBox) prevent to point a Domain to a local IP (keyword DNS-rebinding) and you have to “whitelist” your DDNS-domain in your router.
Thanks Jappe for the detailed informations.
Let me recap with my words to see if I understood well how it works.
In a normal use of a raspberry with dietpi intalled, if I would reach the pi from outside my network, I should have a ddns domain. This is true if I have a router which is able to configure a ddns domain (which has to be declared somehow from me in advance in it). Is this true?
what if in my router there is no such function? In this case I should tell dietpi: “ ehi there! Keep in mind if someone call my domain.ddns.net you should open this page that is stored in the pi”. Am I wrong?
If your router can’t handle DDNS, you just can use dietpi-ddns. My router could do it but I don’t use it, I use the ddns-service of DietPi and it works just fine.
No, that’s not how it works.
When you use a DDNS service, your public IP and your domain is stored on the DNS root name servers, which you contact automatically with every request you make.
Your domain is just a “better name” for your public IP. It would be a pain in the ass to remember all of these IPs of the websites you want to visit. Domain names are easy to remember, (like google.com) but a (in worst case) 12-digit-number is not (like 126.96.36.199).
In the end you don’t need a domain, if you are the only one who is using your services and your IP doesn’t change (often).
You could just type in your public IP into your browser.
When I request your domain, I have no idea what your public IP is. So my device needs to look up your public IP somewhere. Just the domain is not enough. The average user don’t fiddle with their network settings, so they use automatically the DNS servers set by their ISP (often pre-configured in the router, which you got by your ISP).
But other people use Quad9 (default of DietPi, I guess) or Cloudflare or some other DNS service or people like me even run their own DNS resolver.
But what they all have in common is, that they grab their data (which IP belongs to which domain) from a central DNS server network, where every domain from the internet and their associated IPs are stored. When you use a DDNS service, your public IP and your domain is stored there too.
So when you use a DDNS service, this service checks periodically your public IP and transmits it to this central DNS network. You don’t have to configure anything in PiHole, the only thing you have to do for this is to config you DDNS-service.
When I now request your domain, my machine first contacts my own DNS server. When I have no IP for your domain in there, it requests the central DNS network. My machine gets now your public IP from there and then my browser uses this IP to make contact to your machine.
So you see, in “real” you make two requests: the first one to find out the IP for the domain and then the “actual” call to contact this IP.
And now the special case:
When you now call your own domain from your own network, where your device is running in, it would be a unnecessary rundabout way to contact the central DNS servers, which will send you your own public IP and then you make a connection from your LAN into the internet back to your public IP.
Then it comes in handy to make a DNS entry in Pihole: You link your domain with the LOCAL IP of your device, so you don’t have to leave your LAN. Your browser then makes a request to PiHole, and PiHole has an entry for your domain and gives back the LAN IP of the device and not your public IP, like the central DNS name servers would do.
IRL it’s a bit more complicated, see the image below
The most DNS resolvers have huge databases withall this info stored in, so you don’t have to contact all these servers (Step 3 to 6), which saves some time and your request is faster. This is called DNS-caching or cached DNS. The disadvantage of this is, that it needs some time (in exceptional cases up to 48 hours) until these caches know “new” domains and IPs (for example when you setup your DDNS service). But most of the time it’s just a matter of minutes.
Imagine between step 2 and 3 sits your Pihole. When your pihole has an entry for the requested domain, it goes straight to step 7. if not, it goes to step 3. (This is only valid when you call your domain from inside your network)
When I call your domain, or every other person, we all have to contact the DNS root name servers, to get your IP.
So when you call for example http://jappevpn.ddns.net, in the background your browser contacts the DNS root name servers, grabs the associated public IP and then calls this public IP on port 80 (188.8.131.52:80, because http means to request on port 80, for example https would be port 443, ftp would be port 21 etc.).
My router receives then a request on port 80. I configured some port forwading in my router, requests on port 80 are forwarded to my RaspberryPi 4 (192.168.XXX.XXX) also to port 80. On my RapsberryPi runs a webserver (Lighttpd), which is also listening on port 80 and serves you then the website, which your browser shows you.
The next logical question is: How the heck know the machines the route, when they got the public IP to a server?
I guess this is all done by big routing tables and some algorithms?
But back to topic now