DNSMasq for DHCP and .home DNS names

I want to centralise static IP address assignments and local DNS names for a bunch of devices in my home, and thinking to use DNSmasq to do this. This is because I have a bunch of devices I want to name and most of them don’t make a .local name available (or not reliably - for instance homeassistant.local is very unreliable for me).

The HA DNSMasq configuration doesn’t include DHCP configuration, but I assume that the installed DNSmasq itself still does, and that I can put the DHCP config in to the HA JSON file.

But before I start messing around with this, I’m just wondering if there are any akternative approaches, or any advice on use of DNSMasq in this way?

I also wonder if the add-on could be extended to facilitate this kind of device/address management, by building a list of the currently known devices, with MAC addresses etc, and allowing them to be configured (much like some home routers to). Is that a possibility, or is there any other approach to identifing devices more easily than visiting each one individually to find MAC addresses.

Any thougnts? Thanks.

My suggestion…
You sound unsure enough that I highly suggest you learn a LOT more about mdns, dnsmasq, avavi, and the rest of the stuff you need to know before you break everything in your system and have to start over.
HA is designed to run on a flat network, mess with that at your own risk (and knowledge level)

Consider this… The enterprise smart home syndrome

Whilst on the surface you may think this a good idea, I would hesitate to do this with an App (addon) to Home Assistant. The key here is that DNS and DHCP isn’t really part of Home Assistant although it relies on it.

My personal advice is to see if you can do this on your router as in most home networks this already handles DHCP. It will more than likely already have a UI page where you can see a list of devices with MAC Address and IP Address assigned by DHCP and hence should already have a list of everything on your network.

The biggest issue when you setting up a network infrastructure is that there isn’t really a global standard. To clarify, .local isn’t really a reserved domain name since it’s status has been defined by the IETF and not by ICANN. This is important as the IETF have defined .local for Multicast DNS (mDNS) and zero-configuration networking which is different to how DNS works. Basically any time a system tried to resolve a ‘.local’ domain it should send a request to a multicast address (like 224.0.0.251) and not to a traditional DNS Server.

The subject of your post includes ‘.home’ DNS names, however, ‘.home’ is also not a reserved domain name and hence should not be used - neither the IETF or ICANN have specifically reserved this. In essence it means that anywhere it is used is being done so without adhering to any known standard and hence is probably making up their own standard.

For safety there are currently a few options:

1). Use ‘.home.arpa’ as your internal domain. This is defined in RFC 8375 by the IETF. Unfortunately it is a bit long to type, but it does tell DNS clients that “this is a local, non-global address”

2). Use ‘.internal’ which was reserved by ICANN for private use and hence will never exist on the public internet.

3). Use a sub-domain of a domain you own (‘home.mydomain.gtld’). It’s your domain so you can do what you want with it including getting valid SSL certificates.

Hopefully, the one thing you will take away from the above is the simple fact that ‘.local’ is not technically a DNS name and you need to understand that in 2002 Apple released ‘Rendezvous’ (later renamed ‘Bonjour’) which essentially squatted on the domain name. It wasn’t until 2018 that Microsoft fully embraced mDNS in Windows in essence ending a “Active Directory vs Bonjour” war.

Once you have decided on your internal domain, the next step is looking at how you will name your devices. Again, there isn’t a global standard here and there are many different recommendations, however, it is best to think about this early since as your network grows it will be harder to go back and make changes. As such I would always recommend looking at something similar to [site]-[location]-[function]-[index]. Many may suggest names like ‘plex-server’, however, that is where an alias should be used, since if you move Plex to a new machine you only need to update the one DNS Record rather than renaming physical hardware.

The final consideration you should make, is how you plan to support IPv6. You may not be using it at the moment and your ISP may not be providing you with IPv6 addresses, but adoption is growing. This is more important in the world of Home Automation since Thread does not work on IPv4 and more manufacturers are releasing Matter/Thread based products.

I use dnsmasq for exactly what you’re wanting to do, but with one HUGE difference - I use dnsmasq, along with odhcpd, through my OpenWrt router. Even though letting other devices or services handle DNS and DHCP is possible, I’d, personally, never let it be handled by anything other than my router.

1 Like

Whilst I also use DNSMasq through Opnsense (with Unbound for ad blocking), I can see use cases for running DNS and DHCP on a secondary device such as PiHole. However, it is critical to understand DHCP in your own network to ensure you don’t end up with two servers colliding (it is possible to use DHCP on the same network if they are configured appropriately).

For a basic home network, it is quite feasible to turn off any router based DHCP Server and use PiHole as a DHCP Server as well as DNS Server with Ad Blocking.

Thanks for the replies. I did find this guide, for those interested, and I do intend to give it a try at some point.

https://carpie.net/articles/setting-up-a-home-network-dhcp-dns-server-with-dnsmasq