DHCP and DNS app (formerly addon) with a fancy Web UI

Hi,
I have completed an addon for HomeAssistant that provides a DHCP server with several features (it’s based on ‘dnsmasq’ instead of the ISC DHCP server which is also end-of-life).
The addon comes also with an UI that allows to easily sort and filter the list of DHCP clients in the network.

Here’s the addon: GitHub - f18m/ha-addon-dnsmasq-dhcp: An Home Assistant app that runs dnsmasq both as DHCP server and DNS server · GitHub

I’m now using that as my home network DHCP server since several days without any issue.
Hope it can be useful to others as well!

Francesco

9 Likes

great work!

2 Likes

why not activate this also as a dns server ?

Yes, it would be possible to use also the DNS part of dnsmasq.
So far I didn’t activate it as I’m not much interested.
But it would be a nice new feature, indeed.
In meanwhile you can run dnsmasq as a DNS server using the Core Addon named “core_dnsmasq”

I know we can edit the config in YAML. But where are those config file(s) located? It’s nice to be able to edit in an external editor and easily back up and restore them.

@cicishahita ,
The YAML config file for every HomeAssistant addon is managed by HA and is actually stored as JSON file under /usr/share/home assistant OS/addons/data/79957c2e_dnsmasq-dhcp/options.json

That file will be automatically backupp’ed when doing an HA backup, so as long as you backup regularly HA, your addons configs are safely backupped as well.

1 Like

Thanks! I can see the files in backup. But I cannot access that directory you mentioned via smb (through samba share addon), can I? I’m still more comfortable editing files with external editor.

@cicishahita ,
I don’t know the answer to your question as I don’t use the Samba share addon… I typically log via SSH to my HomeAssistant server…

My suggestion is to keep it simple: edit the dnsmasq-dhcp config with your favourite editor and then copy-paste the resulting YAML in the Addons screen of HA (just click on the 3 dots menu and choose “edit as yaml”)…

1 Like

@gcosta74 ,
I realize that I never updated you on the DNS server thing.
Since version 2.0.x, dnsmasq-dhcp does support also using dnsmasq as DNS server!

1 Like

Just updating this thread: the version 3.0.0 of the addon (released today) supports running DHCP/DNS on multiple network interfaces.

In my case for example I’m using a miniPC like this one:

and one port is connected to the first home network, while the second port connects to the security cameras (for Frigate) and they live in a different, isolated network.
Both are now served by the same DHCP server with my dnsmasq-dhcp addon :slight_smile:

@f18m
good idea about copy paste into my prefered editor, and…

actually just now i tried ssh-ing into ha, and i still couldn’t find it. the only directories inside /usr/share are:
alsa/
apk/
applications/
bash-completion/
cmake/
dbus-1/
git-core/
icons/
licenses/
man/
mariadb/
misc/
nano/
ncat/
nmap/
perl5/
sounds/
tabset/
udhcpc/
vim/
X11/
xml/
zoneinfo/
zsh/

Daos it support ipv6? Have you any documentation to define pools?

Hi @MicheleMalgeri ,
Sorry for the delay.

Daos it support ipv6?

Actually IPv6 is something I didn’t really test: in my network I use only IPv4.
However I just completed a survey of the addon code and configuration and I couldn’t see anything that is IPv4 specific.
All code supports both IPv4 and IPv6.
The only thing to note is that for both IPv4 and IPv6, “private IPs” must be given in the pool creation.
A private IP is defined in RFC 1918 (IPv4 addresses) and RFC 4193 (IPv6 addresses).

Have you any documentation to define pools?

Did you check ha-addon-dnsmasq-dhcp-server/DOCS.md at 311d265bf0ef37860ec78a1b7de6ebe3affeac96 · f18m/ha-addon-dnsmasq-dhcp-server · GitHub ?
Look in particular under the " DHCP Pool" concept and perhaps at the “Configuration” section for the YAML structure…

@cicishahita ,
I hope you solved your configuration issues but based on your last answer I think there was a misunderstanding. I meant to say: edit the addon config locally with your editor and then copy-paste it to the HomeAssistant UI.
You can copy-paste the full addon config if you hit the “Edit in YAML” option in the top-right corner of the “Options” pane, see screenshot:

Any plans to add Unbound support?

Any plans to add Unbound support?

Actually I never used Unbound… is there any gain/advantage compared to dnsmasq (let’s say for an home network use case) ?
Looking at the website it seems to have only the DNS functionality, not DHCP…

https://docs.pi-hole.net/guides/dns/unbound/

They explained it better than i can.

I see the value in having a local (recursive) DNS server in your home network. Indeed this is already possible with the dnsmasq-DHCP addon, but it uses internally the “dnsmasq” recursive caching DNS server, instead of the “unbound” recursive caching DNS server.
So I don’t know what users might gain by changing the implementation to use “unbound” vs “dnsmasq”…

Hope this clarifies a bit.

Thank you for this Add-On. Works like a charm. Took me a while to setup because of the number of devices. Amazing. Great Job :clap:
It is important to remember that in the case of backup and restore onto another hardware the Ethernet Interface name will change and therefore may seem like the Add-On is broken, it is not hehe Interface name mismatch in the the Config.
Superb!

1 Like

Thanks @richardmx5guys ,
I’m now working to extend the addon so that an event is fired into HomeAssistant event bus whenever a device joins the network (as a DHCP client) or leaves the network (missing a DHCP renewal).

This will make it possible to create automations that can help to monitor the home network and immediately detect any failure in sensors or actuators (as long as they use DHCP)…

1 Like