DNSmasq nat loopback works on some devices

Does this work when you are connected to your home wifi? Or only when you are outside the house? house

1 Like

Hi krash,

via duckdns.org it only working from outside or via LTE

Hey, @Khalid_Abu_Hamza

I had the exact same issue like you but I managed to fix it by following this thread.

Set up the DNS at the wifi setting of each device (yeah it’s a pain but it works)
x.x.x.x (your internal HA’s IP)
8.8.8.8
8.8.4.4

@rabbit52068 I will give it a shot. Yeah I dont like the way to have the setup but if it will be more userfriendly for my wife. Its good enough to go.

As @rabbit52068 said, you need to set up some more settings.

After you set up dnsmasq on your pi, you have your own dns server that will now essensially translate every http://myhassiodomain.duckdns.org requests to internal.ip

In order for all your devices to use this feature you need to have them use your hassio as dns server. This can be done by two ways:

  • Manually set up the ip/dns settings on each device by entering your hass.io IP as primary DNS and a popular dns address as secondary. (you can look here if you want to select the fastest secondary dns for you)
  • Change you router’s DHCP settings and have the router assign the dns servers automatically. To do that, you ll need to log in to your router’s admin page, look for the DHCP settings and change the preferred DNS servers as above. Note that if you have multiple Access Points in your house and all of them have DHCP enabled you ll need to configure all of them.

Hope this helps

Thanks tried to set the DHCP server to 8.8.8.8 and 8.8.4.4 correct?

No, you need to set the first address to your home assistant internal ip. The second to whatever you choose.

Oke let me explain my steps:

Step 1 added this to dnsmasq

{
“defaults”: [
“8.8.8.8”,
“8.8.4.4”
],
“forwards”: [],
“hosts”: [
{
“host”: “xxx.duckdns.org”, #no https or port
“ip”: “hassio.internal.ip”
}
]
}

Step 2
Login to router:

DHCP server

Default gateway: router ip
Primary dns: hassio up
Secundaire dns: 8.8.8.8.

Save.

Step 3 reboot all
Step 4 wait to get online
Step 5 go dukdns.org domain via lte PASSES
Step 6 go to dukdns.org domain via WiFi Failed message: Unable to connect to Home Assistant. Retry!

Sounds good, although we can’t check for faults in the code as you pasted it.
Check two things:
First the WiFi settings on your mobile device, that they are on automatic (to use the DHCP server) and see what the actual addressed it got from the server are.
Two, open hassio panel (the one with the add-ons) and check the logs of dnsmasq, there should be requests from the device that would give you some insight on what’s going on.

1 Like

Okay, hereby the dnsmasq settings I have set.
{
“defaults”: [
“8.8.8.8”,
“8.8.4.4”
],
“forwards”: [],
“hosts”: [
{
“host”: “duckdns.duckdns.org”,
“ip”: “192.168.2.105”
}
]
}


{
“lets_encrypt”: {
“accept_terms”: true,
“certfile”: “fullchain.pem”,
“keyfile”: “privkey.pem”
},
“token”: “388d32c2-d33a-4fe0-9e50-dc1333f4ebb7”,
“domains”: [
duckdns.duckdns.org
],
“seconds”: 300
}

It works!!!

The thing was I was only testing on one device and it kept confusing me with cache. So I picked up my wife’s device and I noticed I was unable to visit duckdns domain

Added the port :8123 to the domain and it works!! Thanks @krash and @rabbit52068

Hi everyone!

Does someone tried this - NAT loopback for duckdns - with adguard plugin for hassio?

I’ve been breaking my head around with this lately and nothing seems to work. Some help will be appreciatted.
Thanks!