DHCP server - allowing Static Mappings within pool range?
-
My understanding is that the underlying DHCP server doesn't support mappings within pool ranges, and you simply need to split the range.
But it seems to me like it's something that pfSense could potentially achieve itself when setting up the config - for every reservation it finds within the pool range, it simply splits the ranges itself and sets up the dhcpd server in a way that it supports.
I was just wondering if anyone has considered trying it - or alternatively, whether for some reason it's simply considered a bad idea for pfSense to implement?
-
I suspect you're creating a problem where one doesn't exist.
What advantage would you get with this? -
@matthewfearnley While not saying this couldn't be accomplished - if there was such a need or want that the development time could be justified. Feel free to submit a feature request over on the pfsense redmine.
I am with @JKnott this is something that is quite easy to accomplish on your own to be honest.
Common practice for all my years in IT is normally to leave IPs at the beginning of the block and ones on the end to allow for static IPs or reservations.
Say for example your network is 192.168.1.0/24 you just make your pool say
192.168.1.10 to 192.168.1.250
This leaves you room at the beginning and end for your static devices or you reservation devices. Adjust the range for what you might need .20 to .240 for example.. While sure you could break up the pools to leave room in the middle
.20 - .100, .110 - 250 etc.. Normally you either leave IPs out of the pool at the beginning or end or both..
-
Thanks for your replies.
I think one reason to do this would simply be so you can take an existing lease and make it static so that it doesn't change in future. This is something that is possible on Windows DHCP servers.
If the answer is simply that it's bad practice and it's not something we should make easier to do, then that's fine.
If I actually found time to look into this and see if I could make a patch, is it something that would be accepted if done well, or would it be rejected as an undesirable feature?
-
@matthewfearnley said in DHCP server - allowing Static Mappings within pool range?:
rejected as an undesirable feature?
I find that unlikely, anything that provides automation to something that can be done already manually how could that be undesirable?
If you want to spend time to code up something, as long as the code is sound I really don't see why such a thing would be rejected.
Currently if I want say .129 to be a reservation I can do it now with creating 2 different pools on the dhcp server, leaving that .129 out of the pool ranges. If you had something that did that automatic when I add the .129 reservation. Why would that be rejected, as long as the code was sound..
Now a "patch" that people download on their own wouldn't be the way to go about it, you would want to do a PR, and let the developers look over it, if its good then it would be included in pfsense. That is my understanding of how it works. Or is suppose to work.
https://docs.netgate.com/pfsense/en/latest/development/pull-request.html
-
@matthewfearnley It can work, but is bad practice. See here Static Mappings Inside DHCP Pools
-
@pwood999 this would be limiting the pools so they do not include the IPs being used static, or via reservation.
While I completely agree with you it is bad practice to create a static on the device inside the pool. In this scenario the pool(s) would be broken up so that the IPs in the middle of the range would not be inside a pool there would be multiple pools say
192.168.1.10-100
192.168.1.120-250So that say .101 would be not inside a pool.
-
@johnpoz Yes totally agree. I was simply answering Matthew's earlier question about good or bad practice. Same thing applies to isc-dhcp when configured manually in Linux - also the logs bitch about host declarations inside the pool !!
-
@johnpoz said in DHCP server - allowing Static Mappings within pool range?:
192.168.1.10-100
192.168.1.120-250
So that say .101 would be not inside a pool.Actually, it would be between two pools, not within one. Then again, given DHCP addresses are by design temporary, why worry about it. If you want a mapped address, do it outside of the pool.
-
Sometimes I really question your reading comprehension @JKnott
And yeah the whole point is outside the pool(s) no matter how many you have inside the ip range for your network.
-
@matthewfearnley said in DHCP server - allowing Static Mappings within pool range?:
This is something that is possible on Windows DHCP servers
Technically I think it's required on Windows...basically Windows does make it a reservation (they even call it that) and pfSense (ISC dhcpd) doesn't. And yes it is very handy for assigning an IP to, say, a printer that a printer tech set up as DHCP without asking us...