Today my Internet is down: locally everything works, how to make it work also in address xxxx.duckdns.org?

Hi,

Due to some maintenance of the provider today the Internet will be down. Thanks to HASS everything works locally. When I connect locally to my HASS host I can connect to it browsing to 192.168.1.10:8123, but does not work if I borwse to https://xxx.duckdns.org.

Is there a way to make it work also with the address xxxx.duckdns.org, when connected to the local WIFI?

p.s. currently I am using HASSIO with the duckdns addon and nginx proxy manager addon

This

is because you have no contactable domain name server (DNS).

If you cant contact a DNS server to resolve the URL to an IP address one method you could use is the lmhosts file on your PC.

Currently my need is the iphone and android phone of the members of the family: I put to all of them as browser shortcut https://xxx.duckdns.org, and works perfectly but even if at home in WiFi is not working when internet is down.

Can I do this “lmhosts” also in android and iphone smartphones?

For Android I see this guide

https://www.modmy.com/how-modify-hosts-file-your-android-device

is it ok, and what to put in the host file?

Depending on your router firmware you could set it up in there.

Basically you’d point xxxx.duckdns.org to 192.168.1.10

Ok, I managed to do this on my android phone

  • connect the snartphone with USB cable (enable USB debugging on phone)
  • open file explorer in windows
  • launch powershell
  • in powershell launch this command (replace adb with a directory on your PC)

adb pull /system/etc/hosts C:\adb

my file hosts content is


127.0.0.1       localhost
::1             ip6-localhost

shall I add a line like below

127.0.0.1           localhost
192.168.1.12:8123   https://xxx.duckdns.org
::1                 ip6-localhost

?

Well that’s even better, avoids to change all the smartphones. In which settings of the router?

Depends on your router, check for anything about DNS settings. Once you find it you’ll want to adjust your DNS server lookup.

I have my DNS server lookup in the following order:

127.0.0.1
1.1.1.1
8.8.8.8

This way anything local is resolved before it has to hit the internet.

You can’t just arbitrarily modify /system files on mobile devices unless they are rooted and the partition is set to rw

The guide is for non-rooted phones, I pulled it but have not pushed it yet

The non-root method

For this method, you will require a computer with the Android Debug Bridge (or ADB) installed on it. If you don’t already have ADB, you can grab it from Google’s developer resource page. Install ADB, and then run a command prompt in ADB’s installation directory.

  1. Connect your device to your computer via USB (make sure you’ve already enabled USB debugging in the developer settings). Run the command
    adb devices
    to ensure your device is connected, and that ADB is reading and interacting with your device appropriately.
  2. Download your hosts file from your device by issuing the command
    adb pull /system/etc/hosts F:\hosts
    (replace F:\ with the directory you wish to copy your hosts file to)
    This will copy your hosts file to your computer, to allow you to edit it in Notepad.
  3. Now, simply navigate to the directory which you copied the hosts file to, and edit away! Remember, once you’re done you need to push the file back to your device. Issue the command:
    adb push F:\hosts /system/etc/
    (Again, replace F:\ with the directory where you’re storing your hosts file)
    and you’re good to go.

Even with ADB, the /system partition is READ ONLY.

Too bad, you may want to write to whom did the guide and tell him that he is wrong

https://www.modmy.com/how-modify-hosts-file-your-android-device

I am too scared to check on my brand new smartphone :smile:

Mmhh , my router has just one field for DNS settings

the address I put is a host with pi-hole (so I don’t get ads when browsing). Its an Ubuntu-PC

so maybe I can change the file hosts of the Ubuntu?

Ok the file /etc/hosts contains


127.0.0.1       localhost
127.0.1.1       ubuntu

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

I just add a line

192.168.1.12:8123 https://xxx.duckdns.org

?

since you’re running pihole, you can use pihole to manage your DNS entries.

1 Like

I am very bad at solving issues related to netwoking

Can I make changes from the pihole GUI (where?)? Because its pi-hole in HASSIO so I can’t change pihole configuration file (in the sense I do not know where they are).

Or maybe in the HASSIO addon config? I tried but is not working (tried both virtual_host and putting host


{
  "password": "xxx",
  "update_lists_on_start": true,
  "admin_port": 4865,
  "dns_port": 53,
  "ssl": false,
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  "interface": "",
  "ipv6": true,
  "ipv4_address": "",
  "ipv6_address": "",
  "virtual_host": "xxx.duckdns.org",
  "hosts": [
    {
      "name": "hass",
      "ip": "192.168.1.12"
    }
  ]
}

If I do from the browser

http://hass

I get

DNS_PROBE_FINISHED_NXDOMAIN

I don’t know the pihole add-on, because I don’t use hassio, but it should function just like normal pihole and it uses dnsmasq or something similar to host DNS entries. Your config should actually be in your addons directory, but using the mapping in the config interface should work the same.

If you are using certs in your HA config, you will want to use https.