Quote:
Originally Posted by michaelk
2&3&4. As far as I know you can add a configuration file with desired settings in /etc/NetworkManager/dnsmasq.d
dhcp-range=192.168.1.100,192.168.1.250,12h (sets range for DHCP and lease time)
In a /24 network valid IP address range is x.x.x.1 - x.x.x.254
You can set a DHCP static IP address sometimes known as address reservation too but must be outside the DHCP range.
dhcp-host=d0:50:99:82:e7:2b,192.168.1.xxx (change MAC to match server)
|
Thanks so much! Thanks to your info, I have made a lot of progress, although not actually solving my problem yet.
First off, I figured out that in Debian 12, I need to create this config file in /etc/NetworkManager/dnsmasq-shared.d rather than dnsmasq.d
I based this on the command that is being run by NetworkManager:
Code:
$ ps -ef | grep dns
nobody 4525 686 0 10:37 ? 00:00:00 /usr/sbin/dnsmasq --conf-file=/dev/null --no-hosts --keep-in-foreground --bind-interfaces --except-interface=lo --clear-on-reload --strict-order --listen-address=192.168.7.1 --dhcp-range=192.168.7.10,192.168.7.254,60m --dhcp-leasefile=/var/lib/NetworkManager/dnsmasq-enp4s2.leases --pid-file=/run/nm-dnsmasq-enp4s2.pid --conf-dir=/etc/NetworkManager/dnsmasq-shared.d
kuo 4980 1873 0 10:39 pts/2 00:00:00 grep dns
(I'm testing on a little sub-network so that's why the IP addresses are different from what was specified at top.)
So here's my problem ... this command includes --dhcp-range, and this overrides whatever dhcp-range I specify in my config file.
My config file looks like this:
Code:
dhcp-range=192.168.7.222,192.168.7.225,12h
#dhcp-host=d0:50:99:82:e7:2b,192.168.7.32
#dhcp-host=00:1a:a0:e4:63:a3,192.168.7.19
So far, I've experimented with setting reserved IP addresses with dhcp-host (currently commented out), and it actually does "succeed" even when the specified IP address is within the dhcp-range. By "succeed", I mean that I get no errors or complaints, and this IP address is indeed served up to the client even though this IP address is within the dhcp-range.
HOWEVER ...
Maybe my problem is actually solved?
If I alter my conf file, and then look at the list of dhcp clients, I see this:
Code:
root@cinderella:~# cat /etc/NetworkManager/dnsmasq-shared.d/IJKdns.conf
#dhcp-range=192.168.7.232,192.168.7.235,12h
dhcp-host=00:1a:a0:e4:63:a3,192.168.7.77
root@cinderella:~# cat /var/lib/NetworkManager/dnsmasq-enp4s2.leases
1704563803 00:1a:a0:e4:63:a3 192.168.7.77 mulan ff:a0:e4:63:a3:00:01:00:01:26:87:1a:46:00:1a:a0:ad:63:66
In other words:
1) I did NOT alter the dhcp-range, which seems hard specified to 192.168.7.10,192.168.7.254,60m.
2) I did specify a dhcp-host to 192.168.7.77, within that dhcp-range
3) NetworkManager didn't complain, and served up 192.168.7.77 to the client
4) This did create an entry in dnsmasq-enp4s2.leases
So, I think that the entry in dnsmasq-enp4s2.leases means that the DHCP server will NOT accidentally assign a different client its IP address.
I'm going to mark this problem as solved, unless my understanding turns out to be incorrect.
For now, I think my solution is:
1) On my replacement router machine, just use NetworkManager to manage all my network connections and stuff (I'm handling network security separately ... beyond the scope of this issue)
2) Set the internal network wired connection to "Shared to Other Computers", with 192.168.1.1/24/192.168.1.1.
3) Create /etc/NetworkManager/dnsmasq-shared.d/IJKdns.conf looking something like this:
Code:
dhcp-host=00:1a:a0:e4:63:a3,192.168.1.32
And I think that does it! The dhcp-range will by 192.168.1.10 to 192.168.1.254 and there may be nothing I can do about that. But I think it will avoid serving up 192.168.1.32 to any other clients, so that'll be okay.
As it is, there are actually a lot of other computers which I'd like to specify the IP address on, so that'll be nice and easy for me to configure as well.
All in all, this is MUCH simpler for me to install, set up, and manage than my current router. It's a mess of IP chains and stuff.