How to shrink Dynamic Range?

I use maas-dhcp for allocating IP address to BMC.

The Subnet to which Dynamic Range belong has BMC address with sticky type in used IP addresses.
I changed end IP address from 192.168.0.254 to 192.168.0.253, error occures with follow messages.

  **Error:** Requested dynamic range conflicts with an existing IP address or range.


Start IP address is 192.168.0.128.
Used IP addresses list doesn’t have192.168.0.254 and 192.168.0.253, but 192.168.0.130 whose BMC.

I want to shrink unused ip address space, is this possible?

Hi @sugaf1204 ,

could you please run the following queries on your database

select * from maasserver_iprange;
select * from maasserver_staticipaddress where text(ip) LIKE '192.168.0.%';

and paste the result?

I’m sorry for being late

Below is latest infomation.

maasdb=# select id, created, updated, type, start_ip, end_ip, subnet_id, user_id from maasserver_iprange;
 id |            created            |            updated            |   type   |  start_ip   |   end_ip    | subnet_id | user_id
----+-------------------------------+-------------------------------+----------+-------------+-------------+-----------+---------
 13 | 2024-05-01 05:43:46.394639+00 | 2024-05-28 07:23:36.76064+00  | dynamic  | 192.168.0.170 | 192.168.0.188 |         8 |       3
 21 | 2024-05-28 07:24:27.12778+00  | 2024-05-28 07:24:27.12778+00  | reserved | 192.168.0.189 | 192.168.0.189 |         8 |       3
 15 | 2024-05-01 07:43:45.717872+00 | 2024-05-28 07:24:53.641076+00 | dynamic  | 192.168.0.226 | 192.168.0.252 |         7 |       3
 22 | 2024-05-28 07:25:06.244222+00 | 2024-05-28 07:25:06.244222+00 | reserved | 192.168.0.253 | 192.168.0.253 |         7 |       3
 20 | 2024-05-08 10:13:47.213189+00 | 2024-05-28 07:57:26.448434+00 | dynamic  | 192.168.0.194 | 192.168.0.220 |        10 |       3
 23 | 2024-05-28 07:57:40.248707+00 | 2024-05-28 07:57:40.248707+00 | reserved | 192.168.0.221 | 192.168.0.221 |        10 |       3
 25 | 2024-06-04 06:36:59.89535+00  | 2024-06-04 08:31:41.593814+00 | reserved | 192.168.0.168 | 192.168.0.169 |         8 |       3
(7 rows)

maasdb=# select * from maasserver_staticipaddress where text(ip) LIKE '192.168.0.%' order by ip;
   id   |            created            |            updated            |     ip      | alloc_type | subnet_id | user_id | lease_time | temp_expires_on
--------+-------------------------------+-------------------------------+-------------+------------+-----------+---------+------------+-----------------
     90 | 2024-04-25 11:00:03.174088+00 | 2024-04-25 11:00:03.174088+00 | 192.168.0.129 |          1 |         8 |         |          0 |
  79964 | 2024-06-09 08:51:40.413978+00 | 2024-06-09 09:06:04.70132+00  | 192.168.0.135 |          1 |         8 |         |          0 |
  43989 | 2024-05-22 05:03:04.347526+00 | 2024-05-22 05:04:04.077414+00 | 192.168.0.138 |          0 |         8 |         |          0 |
 197187 | 2024-07-12 09:42:37.063033+00 | 2024-07-17 05:13:26.155434+00 | 192.168.0.139 |          1 |         8 |         |          0 |
  43980 | 2024-05-22 05:02:49.53675+00  | 2024-05-22 05:03:51.451246+00 | 192.168.0.142 |          0 |         8 |         |          0 |
  43977 | 2024-05-22 05:02:46.975236+00 | 2024-05-22 05:03:58.204872+00 | 192.168.0.152 |          0 |         8 |         |          0 |
  79970 | 2024-06-09 08:51:54.866557+00 | 2024-06-09 09:06:08.540189+00 | 192.168.0.161 |          1 |         8 |         |          0 |
 132512 | 2024-07-02 00:35:25+00        | 2024-07-02 00:35:25.932651+00 | 192.168.0.171 |          6 |         8 |         |        600 |
 133978 | 2024-07-02 00:35:36+00        | 2024-07-02 00:35:37.033817+00 | 192.168.0.174 |          6 |         8 |         |        600 |
 158985 | 2024-07-03 11:36:25.660471+00 | 2024-07-03 11:36:25.660471+00 | 192.168.0.177 |          6 |         8 |         |          0 |
 193344 | 2024-07-11 12:27:18.882303+00 | 2024-07-11 12:45:52.325918+00 | 192.168.0.189 |          1 |         8 |         |          0 |
  48494 | 2024-05-28 14:31:51+00        | 2024-05-28 14:31:51.890923+00 | 192.168.0.195 |          6 |        10 |         |        600 |
  63897 | 2024-06-06 02:30:26.994456+00 | 2024-06-06 02:30:26.994456+00 | 192.168.0.197 |          1 |        10 |         |          0 |
  48496 | 2024-05-28 14:31:10+00        | 2024-05-28 14:31:10.294334+00 | 192.168.0.197 |          6 |        10 |         |        600 |
  63898 | 2024-06-06 02:31:27.298622+00 | 2024-06-06 02:31:27.298622+00 | 192.168.0.198 |          1 |        10 |         |          0 |
  48510 | 2024-05-28 14:30:50+00        | 2024-05-28 14:30:50.193258+00 | 192.168.0.198 |          6 |        10 |         |        600 |
  63899 | 2024-06-06 02:32:30.092472+00 | 2024-06-06 02:32:30.092472+00 | 192.168.0.199 |          1 |        10 |         |          0 |
  48497 | 2024-05-28 14:33:32+00        | 2024-05-28 14:33:33.090561+00 | 192.168.0.199 |          6 |        10 |         |        600 |
  48509 | 2024-05-28 14:32:07+00        | 2024-05-28 14:32:07.595059+00 | 192.168.0.200 |          6 |        10 |         |        600 |
  63906 | 2024-06-06 02:34:17.42128+00  | 2024-06-06 02:34:17.42128+00  | 192.168.0.200 |          1 |        10 |         |          0 |
  63900 | 2024-06-06 02:33:00.167425+00 | 2024-06-06 02:33:00.167425+00 | 192.168.0.201 |          1 |        10 |         |          0 |
  48500 | 2024-05-28 14:30:52+00        | 2024-05-28 14:30:52.388046+00 | 192.168.0.201 |          6 |        10 |         |        600 |
  63908 | 2024-06-06 02:34:59.723736+00 | 2024-06-06 02:34:59.723736+00 | 192.168.0.202 |          1 |        10 |         |          0 |
  48502 | 2024-05-28 14:33:12+00        | 2024-05-28 14:33:12.490397+00 | 192.168.0.202 |          6 |        10 |         |        600 |
  48501 | 2024-05-28 14:32:17+00        | 2024-05-28 14:32:17.384691+00 | 192.168.0.203 |          6 |        10 |         |        600 |
  63907 | 2024-06-06 02:34:35.91266+00  | 2024-06-06 02:34:35.91266+00  | 192.168.0.203 |          1 |        10 |         |          0 |
  48506 | 2024-05-28 14:30:29+00        | 2024-05-28 14:30:29.788406+00 | 192.168.0.204 |          6 |        10 |         |        600 |
  63909 | 2024-06-06 02:35:35.989753+00 | 2024-06-06 02:35:35.989753+00 | 192.168.0.204 |          1 |        10 |         |          0 |
  63915 | 2024-06-06 02:36:10.968671+00 | 2024-06-06 02:36:10.968671+00 | 192.168.0.205 |          1 |        10 |         |          0 |
  48495 | 2024-05-28 14:32:16+00        | 2024-05-28 14:32:16.187954+00 | 192.168.0.205 |          6 |        10 |         |        600 |
  63917 | 2024-06-06 02:38:03.401186+00 | 2024-06-06 02:38:03.401186+00 | 192.168.0.206 |          1 |        10 |         |          0 |
  48498 | 2024-05-28 14:33:08+00        | 2024-05-28 14:33:08.391953+00 | 192.168.0.206 |          6 |        10 |         |        600 |
  63916 | 2024-06-06 02:37:07.449564+00 | 2024-06-06 02:37:07.449564+00 | 192.168.0.207 |          1 |        10 |         |          0 |
  48499 | 2024-05-28 14:31:48+00        | 2024-05-28 14:31:48.988659+00 | 192.168.0.207 |          6 |        10 |         |        600 |
  63918 | 2024-06-06 02:38:42.010272+00 | 2024-06-06 02:38:42.010272+00 | 192.168.0.208 |          1 |        10 |         |          0 |
  48504 | 2024-05-28 14:32:28+00        | 2024-05-28 14:32:28.903056+00 | 192.168.0.208 |          6 |        10 |         |        600 |
  61665 | 2024-06-05 04:07:09.742238+00 | 2024-06-05 04:07:09.742238+00 | 192.168.0.210 |          1 |        10 |         |          0 |
  48503 | 2024-05-28 14:30:10+00        | 2024-05-28 14:30:10.801632+00 | 192.168.0.210 |          6 |        10 |         |        600 |
  61666 | 2024-06-05 04:07:11.858713+00 | 2024-06-05 04:07:11.858713+00 | 192.168.0.211 |          1 |        10 |         |          0 |
  48507 | 2024-05-28 14:34:03+00        | 2024-05-28 14:34:03.895958+00 | 192.168.0.211 |          6 |        10 |         |        600 |
 193343 | 2024-07-11 12:27:18.74259+00  | 2024-07-11 12:45:52.24141+00  | 192.168.0.221 |          1 |        10 |         |          0 |
  48508 | 2024-05-28 12:26:09.434565+00 | 2024-07-11 12:45:52.477655+00 | 192.168.0.253 |          1 |         7 |         |          0 |
(42 rows)

I tryed to change ip range(id=20) from 192.168.0.194~192.168.0.220 to 192.168.0.194~192.168.0.219, then error is occuerd, Error: Requested dynamic range conflicts with an existing IP address or range..

Sticky addresses(192.168.0.195~192.168.0.211) are bmc’s addresses allocated by maas-dhcp from ip range(id=20).

I think this operation is simply to change the IP range of the DHCP server. So we think this operation should be possible.