I have several local networks (vlans) with a singe router. My Pi-hole is accessible as DNS server for all of them. I have several servers/services in local net that are shared by all or selected vlans. The severs are accessible/visible under IP addresses of each vlan, so my NAS is visible under multiple IP in all vlans. Additionally one vlan is connected over IPSec tunnel (site to site) to one other network (treated as local).
Now it comes to the need. Is it possible to configure Pi-hole to have different "Lists of local DNS domains" for each vlan? I would like to use same domain name but resolve it to different IPs depends on vlan. Any ideas?
I have standard Pi-hole installation (as of now ;)) ver. 5.9 on raspberry Pi 4
pihole-FTL is Pi-hole's tailored fork of dnsmasq, so anything that can be accomplished with dnsmasq can be accomplished with Pi-hole as well, provided it is not conflicting with Pi-hole's own settings.
From a quick glance at that option, simply configuring your router to allow inter-VLAN access to your Pi-hole and adjust Pi-hole's listening behaviour wouldn't be enough to satisfy your requirements.
You'd likely have to configure your Pi-hole host machine for additional virtual network interfaces matching each of your VLANs.
You should consult network-specific channels of your OS for details on how to achieve this.
Thank you for the explanation. I've managed to create virtual interfaces an assign them proper IP addresses in the vlans. Pi-hol is accessible from vlans. Anyway I've stuck on dnsmasq configuration. My PI do not recognize any dnsmasq commands.
I thought dnsmasq is installed with Pi-hole installation but it seems not. Should I install dnsmasq first? How can I execute dnsmasq command?
You need not and shoud not install dnsmasq separately, as that will likely result in port conflicts, with the potential of rendering Pi-hole inoperational.
You can apply your custom configuration options by creating a dnsmasq configuraton file, e.g. /etc/dnsmasq.d/42-multi-vlan-hostnames.conf.
When done adding options, run a dnsmasq syntax check:
pihole-FTL dnsmasq-test
If ok, restart Pi-hole for the settings to take effect: