[Solved] IP address pool reservation - LAN

I currently using a WRT32000ACM router with OpenWRT cer. 21.02.0....is it possible to reserve a specific pool of IP addresses on my LAN so the DHCP server do not serve them out but I can assign the reserved ones to specific devices on my network? How to I go about doing that from the UI, or can this task be completed via the command line, how would I do this.

Thanks
Ricardo

The DHCP server IP pool is defined as a start address and a limit. If the start is 100 and the limit is 150, the server will issue addresses in the range 100-249. You can adjust these limits to set the range you want for general DHCP allocations.

Pool settings GUI: Network > Interfaces > LAN [edit] > DHCP Server > General Setup

Beyond that, you can setup static leases (DHCP reservations) really anywhere within the subnet, provided that those addresses don't conflict with true static IP assignments you may have on individual devices. By that, I mean that you can setup a static lease inside or outside the pool. In the above example, I could setup a reservation at 155, and another one at 95, and one at 253. All of those would be valid, and the DHCP server would only issues those addresses to the appropriate client (by MAC address).

Static Leases GUI: Network > DHCP & DNS > Static Leases

4 Likes

You can also reserve addresses by hostname, which is useful if for example you have a laptop with both Ethernet and wifi it will get the same IP whichever interface you use. Of course devices that don't issue a unique hostname would be reserved by MAC address.

When a hostname and a MAC are both specified in a reservation, the MAC will determine the assignment. Any hostname sent by the client will be ignored, and your hostname is the DNS name instead.

3 Likes

Thank you so much, I really appreciate your help.

You’re welcome.

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.

There are valid in a perfect world but my experience is that there will be lag and strange interruptions in data traffic every time the dnsmasq updates the leases if static and pool addresses share space.
And if you separate pool and static leases then pretty much all dhcp related strange hiccup problems are gone.

1 Like

@flygarn12 - I've never heard of this issue or experienced it. If this can be confirmed across multiple configurations, it should be filed as a bug.

1 Like

I had similar issues when I first came to OpenWrt almost 2 years ago and seemed to get around it by using a pool from 2-39 and making all my static leases from 100 - 250.

I've never really thought about it since, Just used the same old, same old.

1 Like

Is it a bug or a feature?
This is how it works in the parking garage also.
I think is make more logical sense that you cant overbook IP addresses from the pool that are also booked even though the VIP device is offline. When it gets online it expects their address.

Most certainly it would be a bug. dnsmasq should not have any impact on general traffic -- it is not a traffic shaper tool. It has 2 main functions -- DHCP and DNS.

I don't really agree with this analogy. By that logic, if a big SUV parks in a compact space, the flow in and out of the garage would be severely limited, despite the fact that the entry/exit lanes are unaffected.

So there is a bit of a philosophical debate that can happen here in terms of the preferred allocation of addresses within a subnet. Some people say you should always do your DHCP reservations within the pool (since the clients are getting the address via DHCP), leaving the entire space outside the pool available for true static IP assignments. Others say that you should leave the pool available for true dynamic devices, and that you should use addresses outside the pool for reservations. At the end of the day, though, this is just opinion, as long as the DHCP server allows you to do what you want.

The pool won't get 'overbooked' insofar as:

  • addresses that are reserved will never be handed out to other devices
  • the pool size can be increased by simply adjusting the limit (and in some cases the start, too).

There is no fundamental difference between the available addresses inside vs outside the pool, provided that there is sufficient availability in the pool for the truly dynamic addresses. If I have/expect 100 devices and 75 of them are reserved, my pool should be >= 25 if I assign reservations outside the pool, or >=100 if I assign within the pool.

a DHCP client will get whatever IP the DHCP server issues. It has the opportunity to refuse the lease, but in almost every normal case, the client doesn't "expect" a particular IP address. If the pool is exhausted and it doesn't get an IP address, that is just the way it is. But I'll refer back to my comment that the user can increase the pool size to account for the number of leases that are needed.

You argue with yourself here. First you say it is absolutely bug and the you argue for the feature thing?

If the owner of the parking space comes to the parking space and some other “pip” stands there, then it will always become a conflict.
And therefor you don’t even let the cars in that don’t belong in the garage, they are left outside fighting for the bad parking spaces somewhere out there if they find any.

No. The bug, if true, is this:

This would be the case if we were talking about issues with DHCP supplied addresses conflicting with true static IPs (i.e. manually configured on a given host). This does not apply to DHCP in general, provided that the DHCP pool and/or reserved leases outside the pool don't conflict with IP addresses that are statically configured on other hosts.

Consider it this way: The DHCP client is equivalent to a person who has access to park in a given lot, but not necessarily a given space. The lot is sized sufficiently such that it won't run out of spaces, in general. Let's also say that there is a parking lot attendant who actually parks the cars (or at least tells everyone where to park). The attendant may park any car in any available space within the lot, except for special reserved ones -- assigned spaces for VIPs. The attendant will never use those reserved spaces except for when the specific VIP arrives. The DHCP server, similarly, will never distribute the reserved address to any other device except the one for whom it is reserved.

The only time a conflict will occur is if someone parks their own car (bypassing the attendant) in the VIP spots. That is the equivalent of a static IP manually assigned on a specific device. But this is not related to the way that DHCP (both in general and with respect to static reservations) will operate.

I followed your suggestion but I still having issues with one of the network Interface (LAN).
I set the LAN interface to /25 (10.10.10.1/25) then set the DHCP to start issuing at 129 with Limit 90; saved then save&apply the configuration.
I then reboot both my router and PC and when they can back on line the PC got a low number IP (10.10.10.57); I then release and flush the DNS from my PC then renew and got the same low IP.
What am I doing wrong.

Do you have Windows in the PC and have you turned off fast boot?

You haven’t forgotten any static IP settings anywhere in router or PC?

Did you turn off everything in the network and then started by turning on the router and when that is operational started everything else?
But I recommend when changing this to do a complete power cut to everything to get everything to forget their old leases they want to use until the timer runs out.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.