Hello everyone,
I am trying to configure my pihole as a DHCP server for multiple vlans. For each vlan I want a different domain:
192.168.10.0/24 = .home
192.168.20.0/24 = .iot
192.168.30.0/24 = .not
192.168.40.0/24 = .guest
I created a a file called /etc/dnsmasq.d/09-custom.conf where I have the following:
#VLAN 20
#router
dhcp-option=tag:vlan20,option:router,192.168.20.1
#dns server
dhcp-option=tag:vlan20,option:dns-server,192.168.20.2,192.168.20.3
#domain-search
dhcp-option=tag:vlan20,option:domain-search,iot
#dhcp range
dhcp-range=set:vlan20,192.168.20.10,192.168.20.200,255.255.255.0,24h
#VLAN 30
#router
dhcp-option=tag:vlan30,option:router,192.168.30.1
#dns server
dhcp-option=tag:vlan30,option:dns-server,192.168.30.2,192.168.30.3
#domain-search
dhcp-option=tag:vlan30,option:domain-search,not
#dhcp range
dhcp-range=set:vlan30,192.168.30.10,192.168.30.200,255.255.255.0,24h
#VLAN 40
#router
dhcp-option=tag:vlan40,option:router,192.168.40.1
#dns server
dhcp-option=tag:vlan40,option:dns-server,192.168.40.2,192.168.40.3
#domain-search
dhcp-option=tag:vlan40,option:domain-search,guest
#dhcp range
dhcp-range=set:vlan40,192.168.40.10,192.168.40.200,255.255.255.0,24h
server=/home/
server=/iot/
server=/not/
server=/guest/
server=/home/192.168.10.2
server=/iot/192.168.20.2
server=/not/192.168.30.2
server=/guest/192.168.40.2
The output of my /etc/network/interfaces is as follows:
# Location: /etc/network/interfaces
# Please modify network settings via: dietpi-config
# Or create your own drop-ins in: /etc/network/interfaces.d/
# Drop-in configs
source interfaces.d/*
# Ethernet
allow-hotplug eth0
iface eth0 inet static
address 192.168.10.2
netmask 255.255.255.0
gateway 192.168.10.1
auto eth0.20
iface eth0.20 inet static
address 192.168.20.2/24
auto eth0.30
iface eth0.30 inet static
address 192.168.30.2/24
auto eth0.40
iface eth0.40 inet static
address 192.168.40.2/24
The DHCP leases work fine. Each vlan gets the expected IP range and domain-search. However all the devices get the same domain like hostname.home.
Does anyone have this kind of configuration that is willing to help me?
Kind regards,
Américo