Dhcp server on different vlans 802.1q not adding domain

Morning all.. 23.05.x here..

(I tried to figure out the formatting.. but there seems to be no preview.. so in advance I apologize for formatting issues.. will edit/correct if I am able.. )

The device will handle dhcp requests and add to be used for local DNS after registration..

dnsmasq already does this, I'm just looking for this on a compact device..

will be ten vlans, different subnets..

I have everything working, but I cannot seem to get the right options either through the gui or uci..

man page says:

If the address range is given as ip-address/network-size, then a additional flag "local" may be supplied which has the effect of adding --local declarations for forward and reverse DNS queries. Eg. --domain=thekelleys.org.uk,192.168.0.0/24,local is identical to --domain=thekelleys.org.uk,192.168.0.0/24 --local=/thekelleys.org.uk/ --local=/0.168.192.in-addr.arpa/

:/etc/config# cat network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd09:b429:f50b::/48'
        option packet_steering '1'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'lan1'
        list ports 'lan2'
        list ports 'lan3'
        list ports 'lan4'
        list ports 'lan5'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config device
        option type '8021q'
        option ifname 'lan0'
        option vid '42'
        option name 'lan0.42'
        option ipv6 '0'

config interface 'vlan42'
        option device 'lan0.42'
        option proto 'static'
        option ipaddr '192.168.48.254'
        option netmask '255.255.255.0'
        option gateway '192.168.48.1'
        list dns '10.20.0.6'
        list dns_search 'pms.v42'
        option delegate '0'
        option defaultroute '0'

config device
        option name 'lan0'
        option ipv6 '0'

config device
        option type '8021q'
        option ifname 'lan0'
        option vid '172'
        option name 'lan0.172'
        option ipv6 '0'

config interface 'vlan172'
        option device 'lan0.172'
        option proto 'static'
        option ipaddr '172.16.48.254'
        option netmask '255.255.255.0'
        option gateway '172.16.48.1'

This gives me a lan0.42 (vlan42) and lan0.172 (vlan172) - please correct me if there is something I am missing.. the switch is trunked but I couldn't find anything in openwrt to receive a trunk..

/etc/config# cat dhcp

config dnsmasq
        option domainneeded '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option ednspacket_max '1232'
        option localservice '0'
        option nonwildcard '0'
        list server '10.20.0.6'
        option rebind_protection '0'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option ignore '1'

config odhcpd 'odhcpd'
        option maindhcp '0'
        option leasefile '/tmp/hosts/odhcpd'
        option leasetrigger '/usr/sbin/odhcpd-update'
        option loglevel '4'

config dhcp 'vlan42'
        option interface 'vlan42'
        option limit '150'
        option leasetime '2h'
        option start '100'
        option domain 'pms.v42'
        option local '/pms.v42/'
        list dhcp_option '3,192.168.48.1'
        list dhcp_option '6,10.20.0.6'
        list dhcp_option '15,pms.v42'
        list dhcp_option '43,01:04:00:00:00:02'
        list dhcp_option '42,172.16.254.241'

and this is my test machine:

/etc/config# grep 48.110 /tmp/dhcp.leases
1684421599 d8:9e:f3:98:a8:f3 192.168.48.110 DESKTOP-RJEB8RF 01:d8:9e:f3:98:a8:f3

looks like dnsmasq is running and working:

:/etc/config# ss -nlp | grep dnsmasq
udp   UNCONN 0      0                      0.0.0.0:53           0.0.0.0:*    users:(("dnsmasq",pid=16429,fd=6))
udp   UNCONN 0      0                      0.0.0.0:67           0.0.0.0:*    users:(("dnsmasq",pid=16429,fd=4))
udp   UNCONN 0      0                            *:53                 *:*    users:(("dnsmasq",pid=16429,fd=8))
tcp   LISTEN 0      0                      0.0.0.0:53           0.0.0.0:*    users:(("dnsmasq",pid=16429,fd=7))
tcp   LISTEN 0      0                            *:53                 *:*    users:(("dnsmasq",pid=16429,fd=9))
:/etc/config# drill -x 192.168.48.110 @127.0.0.1
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 22856
;; flags: qr aa rd ra ; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;; 110.48.168.192.in-addr.arpa. IN      PTR

;; ANSWER SECTION:
110.48.168.192.in-addr.arpa.    0       IN      PTR     DESKTOP-RJEB8RF.

;; AUTHORITY SECTION:

;; ADDITIONAL SECTION:

;; Query time: 0 msec
;; SERVER: 127.0.0.1
;; WHEN: Thu May 18 09:07:47 2023
;; MSG SIZE  rcvd: 74

/etc/config# drill desktop-rjeb8rf @127.0.0.1
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 43375
;; flags: qr aa rd ra ; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;; desktop-rjeb8rf.     IN      A

;; ANSWER SECTION:
desktop-rjeb8rf.        0       IN      A       192.168.48.110

;; AUTHORITY SECTION:

;; ADDITIONAL SECTION:

;; Query time: 0 msec
;; SERVER: 127.0.0.1
;; WHEN: Thu May 18 09:08:01 2023
;; MSG SIZE  rcvd: 49

Again everything is working, but it isn't adding a domain.tld (pms.v42 in what I am looking for) and I am not sure why..

when I look at the generated configuration for dnsmasq it does not have the domain or local entries in there..

 cat /var/etc/dnsmasq.conf.cfg01411c
# auto-generated config file from /etc/config/dhcp
conf-file=/etc/dnsmasq.conf
domain-needed
enable-ubus=dnsmasq
edns-packet-max=1232
server=10.20.0.6
addn-hosts=/tmp/hosts
dhcp-leasefile=/tmp/dhcp.leases
resolv-file=/tmp/resolv.conf.d/resolv.conf.auto
dhcp-broadcast=tag:needs-broadcast
conf-dir=/tmp/dnsmasq.d
user=dnsmasq
group=dnsmasq


dhcp-ignore-names=tag:dhcp_bogus_hostname
conf-file=/usr/share/dnsmasq/dhcpbogushostname.conf


bogus-priv
conf-file=/usr/share/dnsmasq/rfc6761.conf
no-dhcp-interface=br-lan
dhcp-range=set:vlan42,192.168.48.100,192.168.48.249,255.255.255.0,2h
dhcp-option=vlan42,3,192.168.48.1
dhcp-option=vlan42,6,10.20.0.6
dhcp-option=vlan42,15,pms.v42
dhcp-option=vlan42,43,01:04:00:00:00:02
dhcp-option=vlan42,42,172.16.254.241


Is there a way to export those?

uci commit dhcp
service dnsmasq reload

doesn't seem to put them in the config either..

I also don't know where the bogus-priv dnsmasq entry is coming from either..

Thank you in advance..

also /etc/dnsmasq.conf has:

domain=pms.v42,192.168.48.0/24,local

but wait..

the init script reads /var/etc/dnsmasq.conf which does not exist..

Adding the correct dnsmaq config seems to produce working A and PTR results..

 grep dnsmasq.conf /etc/init.d/dnsmasq
BASECONFIGFILE="/var/etc/dnsmasq.conf"
                dnsmasqconffile=/etc/dnsmasq.conf

I copied /etc/dnsmasq.conf to /var/etc/dnsmasq.conf and everything seems to be working..

I do not know how this particular jail works.. but it looks as if it is in a jail

18609 root      2824 S    {dnsmasq} /sbin/ujail -t 5 -n dnsmasq -u -l -r /bin/ubus -r /etc/TZ -r /etc/dnsmasq.conf -r /etc/ethers -
18611 dnsmasq   3320 S    /usr/sbin/dnsmasq -C /var/etc/dnsmasq.conf.cfg01411c -k -x /var/run/dnsmasq/dnsmasq.cfg01411c.pid

does /var/etc/ become /etc.. and is /etc/dnsmasq.conf just not copied into the jail..

I do not know openwrt well enough..

rebooting unit to figure out if those files will exist .. after reboot /var/etc/dnsmasq.conf was gone /etc/dnsmasq.conf persisted with my additions.. and seemed to be working correctly..