DHCP Pools

Started by ks98330q, May 14, 2023, 11:31:41 PM

Previous topic - Next topic
May 14, 2023, 11:31:41 PM Last Edit: May 17, 2023, 03:35:09 AM by ks98330q
SO maybe im not understand the reality of the DHCP pools.  Allow me to enumerate what I try do:

I have the OPNSense
I have 4 wireless AP, servers, etc, etc.  I want to use DHCP reservation here.
I have a few client I want to never change the IP, but im too lazy to go change the device to the static IP.
I want to use DHCP reservation here too.

Soooo.  I make the pools.

The IP of OPN is FOO.1
According to Services -> DHCP4 -> LAN, the available range is FOO.1 to FOO.254 (/24 network)
I have the DHCP4 RANGE setup from FOO.42 to FOO.200
I want all my network hardware to get the IP from pool of: FOO.2 to FOO.20
I want the clients I am too lazy to hand config from the pool of: FOO .21 to FOO.41
Everyone else gets FOO.42 to FOO.200 on a dynamic, no reserve basis.

So I do this and I get this error in the logs:

  Dynamic and static leases present for FOO.X.
Remove host declaration s_lan_0 or remove FOO.X
from the dynamic address pool for FOO.0/24


Where FOO.X is the client in my network hardware pool.  I use X because when I remove the one it complains about from static reserve, it gripes about another client.  I did also install  the MAC addresses of the devices I want in each pool, to that pool, and chekced the "DENY CLIENTS EXCEPT THOSE LISTED BELOW" on each pool ONLY. (Services -> DHCP4 -> LAN ->Additional Pools -> Pool:FOO, and Pool: BAR -> MAC Address Control)

I did NOT select the Deny clients.... check box on Services -> DHCP4 -> LAN.
So my understand of it is this:  The clients of the particular MAC in the FOO pool will get addresses in the FOO.2-20 range.  The other pool in its range.   If I remove a client MAC from any pool, it will only get an address from the FOO.42-200 range.

Is it all right?

If it is, why do I get the complaints in the DHCP log and how to dispose of it?






This would be easier if you post a screenshot of your DHCP config screen(s).

Here is what I think you're saying.

You have a 192.168.0.0/24 ip range which is configured to hand out IPs 192.168.0.42 to 192.168.0.200.
You wish to statically assign network hardare to IPs 192.168.0.2 to 192.168.0.20.
You wish to statically assign some clients to IPs 192.168.1.21 to 192.168.1.41.

I'm unclear on is if you're trying to set up 192.168.1.0 IPs in a 192.168.0.0/24 range or if that's a typo.  DHCP can only assign IPs based on it's available range.  /24 won't give you 192.168.0.0 and 192.168.1.0.

Yes, you are correct on what i am trying to do.  It is this.

You have a 192.168.0.0/24 ip range which is configured to hand out IPs 192.168.0.42 to 192.168.0.200.
You wish to statically assign network hardare to IPs 192.168.0.2 to 192.168.0.20.
You wish to statically assign some clients to IPs 192.168.1.21 to 192.168.1.41.


Apparently I do have the typo somehwere.

Quote from: CJRoss on May 15, 2023, 01:11:39 PM
This would be easier if you post a screenshot of your DHCP config screen(s).

Here is what I think you're saying.

You have a 192.168.0.0/24 ip range which is configured to hand out IPs 192.168.0.42 to 192.168.0.200.
You wish to statically assign network hardare to IPs 192.168.0.2 to 192.168.0.20.
You wish to statically assign some clients to IPs 192.168.1.21 to 192.168.1.41.

I'm unclear on is if you're trying to set up 192.168.1.0 IPs in a 192.168.0.0/24 range or if that's a typo.  DHCP can only assign IPs based on it's available range.  /24 won't give you 192.168.0.0 and 192.168.1.0.

you need to use the static mapping if you want to be lazy :)

in your Services > DHCPv4 > LAN go all the way down to the bottom and add Static DHCP Mapping. This uses the device MAC address.

Write down all the MAC address of all the devices individually and add them here.

-ADD MAC
-ADD IP
-ADD HOSTNAME
-ADD DNS
-ADD GATEWAY

you need to do this for every device.

Quote from: ks98330q on May 16, 2023, 03:02:07 AM
Yes, you are correct on what i am trying to do.  It is this.

You have a 192.168.0.0/24 ip range which is configured to hand out IPs 192.168.0.42 to 192.168.0.200.
You wish to statically assign network hardare to IPs 192.168.0.2 to 192.168.0.20.
You wish to statically assign some clients to IPs 192.168.1.21 to 192.168.1.41.


Apparently I do have the typo somehwere.

I'm still confused.  Are you trying to assign static 192.168.1.x ips to a 192.168.0.x pool or not?

Quote from: lilsense on May 16, 2023, 03:15:32 AM
you need to use the static mapping if you want to be lazy :)

in your Services > DHCPv4 > LAN go all the way down to the bottom and add Static DHCP Mapping. This uses the device MAC address.

Write down all the MAC address of all the devices individually and add them here.

-ADD MAC
-ADD IP
-ADD HOSTNAME
-ADD DNS
-ADD GATEWAY

you need to do this for every device.

That's what they're doing.  But AFAICT it's not working because they're trying to assign static ips outside of the subnet range.

May 17, 2023, 03:33:43 AM #5 Last Edit: May 17, 2023, 03:38:16 AM by ks98330q
Ugh!   Yes the typo comes again.....
Let me fix it now...
I did also edit the original post so please re-read.  Sorry for all this....

Quote from: CJRoss on May 16, 2023, 03:02:44 PM
Quote from: ks98330q on May 16, 2023, 03:02:07 AM
Yes, you are correct on what i am trying to do.  It is this.

You have a 192.168.0.0/24 ip range which is configured to hand out IPs 192.168.0.42 to 192.168.0.200.
You wish to statically assign network hardare to IPs 192.168.0.2 to 192.168.0.20.
You wish to statically assign some clients to IPs 192.168.1.21 to 192.168.1.41.

I wish to assign some to 192.168.0.21-.41

Apparently I do have the typo somehwere.

I'm still confused.  Are you trying to assign static 192.168.1.x ips to a 192.168.0.x pool or not?

Quote from: lilsense on May 16, 2023, 03:15:32 AM
you need to use the static mapping if you want to be lazy :)

in your Services > DHCPv4 > LAN go all the way down to the bottom and add Static DHCP Mapping. This uses the device MAC address.

Write down all the MAC address of all the devices individually and add them here.

-ADD MAC
-ADD IP
-ADD HOSTNAME
-ADD DNS
-ADD GATEWAY

you need to do this for every device.

That's what they're doing.  But AFAICT it's not working because they're trying to assign static ips outside of the subnet range.
Yes.  this i know.  It is very basic networking....  Im not trying to assign out of the subnet.

But alas, my autistic brain tends to thinks a little differently...

Please.  See in the original post, the complaint DHCP is sending about static, and dynamically configured lease.  This is the genesis of my thread..

My brain = aaargh!! ::) 
[/color]

Quote from: ks98330q on May 17, 2023, 03:33:43 AM
Ugh!   Yes the typo comes again.....
Let me fix it now...
I did also edit the original post so please re-read.  Sorry for all this....

No worries.  But yes, that is weird.  Have you been able to get any static ips to work?  What happens if you remove the static ips?  Does DHCP start?

Can you post screenshots of your DHCP screen?

I thought I understood setup and question but I'm not sure now.
You have a scope of 1 to 254 (minus the usual like interface ip) based on netmask. This you have correct.
You set your DHCP dynamic range 42 to 200. This you have OK.
For the reservations for your clients, you set them as you see fit obviously. You got this ok.
As long as you have clients reserved out of 42 to 200 you're OK.
If removing clients from outside 42 to 200 if what gives you trouble, save after deleting each one. It might still be in the lease so might need to delete from lease list.
Post screenshots otherwise please.

Quote from: cookiemonster on May 17, 2023, 03:00:00 PM
I thought I understood setup and question but I'm not sure now.
You have a scope of 1 to 254 (minus the usual like interface ip) based on netmask. This you have correct.
You set your DHCP dynamic range 42 to 200. This you have OK.
For the reservations for your clients, you set them as you see fit obviously. You got this ok.
As long as you have clients reserved out of 42 to 200 you're OK.
If removing clients from outside 42 to 200 if what gives you trouble, save after deleting each one. It might still be in the lease so might need to delete from lease list.
Post screenshots otherwise please.

You don't need to delete dynamic leases when you create a static one.  The dynamic lease will eventually expire and be replaced with the static one.

maybe that is 22.3. I'm on 22.7 still and last time I was setting reservations, I had this behaviour. So maybe it has changed, or the way I was doing it.

May 18, 2023, 01:48:55 PM #10 Last Edit: May 18, 2023, 04:17:40 PM by lilsense
Quote from: CJRoss on May 17, 2023, 04:56:10 PM
Quote from: cookiemonster on May 17, 2023, 03:00:00 PM
I thought I understood setup and question but I'm not sure now.
You have a scope of 1 to 254 (minus the usual like interface ip) based on netmask. This you have correct.
You set your DHCP dynamic range 42 to 200. This you have OK.
For the reservations for your clients, you set them as you see fit obviously. You got this ok.
As long as you have clients reserved out of 42 to 200 you're OK.
If removing clients from outside 42 to 200 if what gives you trouble, save after deleting each one. It might still be in the lease so might need to delete from lease list.
Post screenshots otherwise please.
You don't need to delete dynamic leases when you create a static one.  The dynamic lease will eventually expire and be replaced with the static one.


Yes you do need to delete this and for as long as the device is on the network and has a DHCP IP address, it will continue with this address unless you disconnect and delete the MAC from the DHCP pool. At this point the DHCP reservations will take place.

Quote from: cookiemonster on May 18, 2023, 12:44:56 PM
maybe that is 22.3. I'm on 22.7 still and last time I was setting reservations, I had this behaviour. So maybe it has changed, or the way I was doing it.

Nope.  I've been using OPNSense for longer than that and it's always been like this.  The only current issue is that adding a static lease causes DNS reporting to break until you turn it off and on again.

Quote from: lilsense on May 18, 2023, 01:48:55 PM
Yes you do need to delete this and for as long as the device is on the network and has a DHCP IP address, it will continue with this address unless you disconnect and delete the MAC from the DHCP pool. At this point the DHCP reservations will take place.

I'm sorry, but you're wrong.  I even went so far as to just confirm it with a dynamic client on my network.

The fact that the client continues to use the old IP has nothing to do with the DHCP server.  It's because the client won't ask for a new lease until you do a renew, flap the interface, or restart the client.

1. Windows client using DHCP with a dynamic lease of 192.168.0.124 and a four hour lease duration.
2. Click on the + sign to convert the dynamic lease to a static lease of 192.168.0.50
3. Windows client still shows the original 192.168.0.124 lease and expiration time
4. ipconfig /renew on the windows client
5. Windows client now shows 192.168.0.50 lease with a two hour lease duration

The DHCP server will be immediately updated but it's up to the client to ask for a new lease before it sees the change.  DHCP is a pull process, not a push.