This is on a fully patched Ubuntu 22.04LTS.
This concerns dnsmasq when it is a subsystem to NetworkManager. It's apparently completely different than if dnsmasq is run stand alone.
I'm attempting to get dhcp working from dnsmasq when it is automatically started from the NetworkManager system. It took me a while to realize that dnsmasq was not taking it's configuration from where the dnsmasq documentation says it will, from /etc/dnsmasq.d . A man NetworkManager.conf explains it takes its instructions from /etc/NetworkManager/dnsmasq.d and never mentions there's a second location that apparently is used also or instead of, /etc/NetworkManager/dnsmasq-shared.d .
Without any conf file anywhere, I get this via journalctl:
Jan 06 06:04:25 zima.private.ycc dnsmasq-dhcp[1235]: DHCP, IP range 192.168.2.10 -- 192.168.2.254, lease time 1h
When I put my conf file into /etc/NetworkManager/dnsmasq.d, it was completely ignored because here is what I get via journalctl:
Jan 06 06:09:55 zima.private.ycc dnsmasq-dhcp[1685]: DHCP, IP range 192.168.2.10 -- 192.168.2.254, lease time 1h
It was only when I moved that conf file into /etc/NetworkManager/dnsmasq-shared.d that I got any indication that it was listening to me.
Here is the entirety of my dnsmasq.conf file. As can be seen, I've commented major portions out for testing.
Code:
log-dhcp
port=0
domain-needed
bogus-priv
interface=wlp1s0
domain=private.ycc
dhcp-range=192.168.2.50,192.168.2.254,255.255.255.0,12h
#dhcp-range=192.168.2.2,static
#dhcp-range=192.168.2.3,static
#dhcp-range=192.168.2.4,static
#dhcp-range=192.168.2.5,static
#dhcp-range=192.168.2.6,static
#dhcp-range=192.168.2.7,static
#dhcp-range=192.168.2.8,static
#dhcp-range=192.168.2.9,static
#dhcp-host=D4:62:EA:7B:E8:42,billhuawei.private.ycc,192.168.2.2,infinite
#dhcp-host=7C:6C:F0:47:21:9B,janetphone.private.ycc,192.168.2.3,infinite
#dhcp-host=24:C6:13:4F:F1:B9,billtablet.private.ycc,192.168.2.4,infinite
#dhcp-host=24:F0:C3:0C:3F:C9,janettablet.private.ycc,192.168.2.5,infinite
#dhcp-host=F8:A9:A0:4A:BA:08,janetnexus.private.ycc,192.168.2.6,infinite
#dhcp-host=50:2C:C6:2B:26:32,gree.private.ycc,192.168.2.7,infinite
When I have the conf file only in the /etc/NetworkManager/dnsmasq-shared.d and nothing in /etc/NetworkManager/dnsmasq.d, this is what I get via journalctl:
Jan 06 06:21:25 zima.private.ycc dnsmasq-dhcp[1186]: DHCP, IP range 192.168.2.50 -- 192.168.2.254, lease time 12h
Jan 06 06:21:25 zima.private.ycc dnsmasq-dhcp[1186]: DHCP, IP range 192.168.2.10 -- 192.168.2.254, lease time 1h
Jan 06 06:21:25 zima.private.ycc dnsmasq-dhcp[1186]: DHCP, sockets bound exclusively to interface wlp1s0
When I put the exact same conf file also into /etc/NetworkManager/dnsmasq.d, this is what I get via journalctl:
Jan 06 06:49:35 zima.private.ycc dnsmasq-dhcp[1185]: DHCP, IP range 192.168.2.50 -- 192.168.2.254, lease time 12h
Jan 06 06:49:35 zima.private.ycc dnsmasq-dhcp[1185]: DHCP, IP range 192.168.2.10 -- 192.168.2.254, lease time 1h
Jan 06 06:49:35 zima.private.ycc dnsmasq-dhcp[1185]: DHCP, sockets bound exclusively to interface wlp1s0
For some reason, it insists on an overlapping range no matter what I do. Either way, dhcp isn't working.
When an Ubuntu box tries to get a connection, the connection is made without the dhcp lease. On Android units, the entire connection fails probably because it can't get a dhcp lease.
Does anyone know how to set dnsmasq up when it's in a NetworkManager environment? The documentation for this is wrong or nonexistent.