[Solved]How to connect outside of dietpi network

I would like to understand how to mantain the connection whether I’m in or out of the dietpi network.
I already create a DDNS (with no-ip provider) and already configured the router with the right credential. With these configurations i reach it when I’m out of the network but, once back in the same network i should switch to the local ip address and, as you can imagine, is not really confortable.
Any suggestions?

What application you are trying to access from outside your network? Usually you should be able to use your DDNS name, even if you are inside your network.

I’m trying to access Owncloud, but i found the same problem trying to access the dietpi console through ssh…
If i’m outside my network I access it well, once back in the network the domain name stop to work, and i have to go back to the dietpi local address.
I Hope you understand what I meant.

well you would need to check how the your DDNS is resolved locally in your network and how your router is handling such request if they are coming from inside your network. Usually it should not be an issue to access your domain even from inside.

This is called hairpin nat, or nat loopback. It might or not be supported on your router.
Performance-wise it is much worse to access an internal server over the router by its public ddns hostname.
In OpenWrt routers there is an option to add the hostname to be resolved to the internal private IP, but this is not something I’d expect on most commercial routers.

If you use an own DNS server like Pihole, you could add a custom DNS entry as well.

You can, but there is a catch. The router (or whichever device is updating the ddns) must not use the pihole for resolving that hostname.

usually it shouldn’t be an issue to keep the router using a upstream DNS.

Ho again,
Sorry for the late answer, I was trying to read something about pi-hole.
Honestly , I’m not sure to have understood well.
Should I install pi-hole on my pi, add a custom DNS, without touching the router?

The solution could be to install pihole, disable dhcp on router, setup pihole to be dhcp, and add the ddns hostname on Pihole as an internal address. Make sure that the ISP router which is updating the ddns is not using the Pihole for dns.

Usually using dietpi-ddns should not be an issue. DietPi will detect external IP individually and not by resolving the DDNS.

Joulinar , what does “ Usually using dietpi-ddns should not be an issue” mean? I don’t have to use pihole?

Meanwhile I tried to install pihole (just do fun :slight_smile: ) with this command

 curl -sSL https://install.pi-hole.net | bash

according with what I found here: https://github.com/pi-hole/pi-hole/#one-step-automated-install
I’m not sure if it is installed.
How can I check if it’s ok?
And also: how can I set up pihole as DHCP and add the DDNS?

I guess you are mixing quite a lot of things.

Pihole could have been installed using dietpi-software. Which would have been the recommended way.

Put the DDNS topic aside for a moment.

Before using Pihole, make sure you can disable DHCP on your router. Another option is if your router support to set a specific DNS server inside it’s DHCP server settings. But this you would need to find out yourself.

To access Pihole just enter following in your browser http://IP.of.your.system/admin

Detecting external IP is one thing. The other thing is to query the ddns to get what is registered and decide whether it is necessary to update it.

This is not how dietpi-ddns is working.

I tried to install pihole but the process stopped here:

 Step: Installing SQLite: Persistent single-file database system

[ INFO ] DietPi-Software | APT install for: sqlite3, please wait...

Just after please wait…
How can I check if it is installed well?

just open another ssh session and have a look to running processes using htop. Be patient, it could take a while depending on the speed of the Debian package server.

I just checked with the commend suggested but, I’m afraid, I can’t see pihole in execution.
See attached screenshot

To confirm that Pihole is not installed, I tried to connect from the browser entering, as suggested by you

The answer is: 404 Not Found
Should I try to re-install it again? or it’s better to do something (some check maybe) before re-trying?

did the installation of Pihole finished?

dietpi-software install 93