Edit DHCP pool size?

Is it possible to edit the size of a DHCP pool? For example I want to change my DHCP pool from a /26 to a /25… Is there a command that I can use that will do this without having to recreate the entire DHCP server?

The goal is to avoid any downtime…

Assuming the following layout (DHCP on 10.0.0.0/24 on a range from .10-.154):

[admin@Mikrotik] > /ip address print
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS       NETWORK    BROADCAST    INTERFACE
 0   10.0.0.1/24   10.0.0.0   10.0.0.255   LAN

[admin@Mikrotik] > /ip dhcp-server print
Flags: X - disabled, I - invalid
 #   NAME      INTERFACE  RELAY  ADDRESS-POOL   LEASE-TIME ADD-ARP
 0   DHCP-LAN  LAN               DHCP-Pool-LAN  3h
 
[admin@Mikrotik] > /ip dhcp-server network print
 # ADDRESS       GATEWAY    DNS-SERVER      WINS-SERVER     DOMAIN
 0 ;;; LAN
   10.0.0.0/24   10.0.0.1   10.0.0.1
[admin@Mikrotik] >

[admin@Mikrotik] > /ip pool print
 # NAME           RANGES
 0 DHCP-Pool-LAN  10.0.0.10-10.0.0.254

Here are the steps to edit to go to a /23:

  1. change the subnet mask, and broadcast address on the IP address on the interface the DHCP clients connect to:
  2. change the DHCP server network statement to match
  3. grow the IP pool

So, first change the subnet on the interface:

/ip address
set [find interface=LAN] address=10.0.0.1/23 broadcast=10.0.1.255

If you find that you don’t want to recalculate values, you can delete the IP address and add it back in in under a second and have the router do it for you:

/ip address 
remove [find interface=LAN]; add address=10.0.0.1/23 interface=LAN;

Then change the DHCP server network:

/ip dhcp-server network
set [find address="10.0.0.0/24"] address=10.0.0.0/23

Then grow the pool:

/ip pool
set [find name=DHCP-Pool-LAN] ranges=10.0.0.10-10.0.1.254

Hope that helps.