Configuring dnsmasq for HomeAssistant installation

Hello,

I am a beginner to Home Assistant. I have the following setup :-

  • Home Assistant running on PI3 via Docker
  • DuckDns configured with port forwarding

Problem : I am able to access Home Assistant Front End using DuckDNS outside of my home network but could not access it inside my home network.

Based on my research on internet, it seems we have to use dnsmasq addon to resolve this issue.

Since, I am using Home Assistant and not Hassio.io, I do not see the option to install add-on.

I have installed dnsmasq explicitly on PI3 using this command :-

sudo apt install dnsmasq

Can someone please tell me what to edit in the configuration file for dnsmasq (I am referring to config file for dnsmasq and not Hassio addon).

Thanks!

Stop dnsmasq while editing files

$ sudo service dnsmasq stop

Add to /etc/dnsmasq.conf (eg)

no-dhcp-interface=
server=8.8.8.8
server=8.8.4.4
no-hosts
addn-hosts=/etc/dnsmasq.hosts

Add to new file /etc/dnsmasq.hosts (eg … Modify the ip address as required and replace YOURDOMAIN)

192.168.1.239 YOURDOMAIN.duckdns.org

Checks /etc/dnsmasq.conf syntax

$ dnsmasq --test

After edits

sudo service dnsmasq start

Make sure that you tell your router to use your PI3 for DNS Services (Change DNS Settings).

Bear in mind that most routers have two DNS addresses in their settings, in my case my router would use either DNS address, this meant that sometimes my *.duckdns.org address did not resolve. To fix this I installed DNSMasq on a second (always on) device on my network. ie the router points to two identically configured DNSMasq servers on my network.

The other option is to leave the second DNS setting blank (NOT RECOMMENDED); but if you do this there will be no redundancy in your system and if your DNSMasq server goes down this will cripple your internet access.