This is a story of how I did this, this is not a how-to guide you can copy blindly.
I was in a situation where a local network was setup to use 192.168.0.0/24
as its local network sub-net. For a few organisational reasons I wanted to move this to 10.10.0.0/16
. The extra fun was there were machines in this network that were not trivial to stop.
Plan
The basic plan is:
- Attach a new IP to the LAN interface
- Update DHCP to have a new pool and network
- Change DHCP to hand out the new IP range
- Renew DHCP on all devices (or wait for a renewal)
- Remove the old DHCP pool and network config
- Remove the old IP on the interface
The method this relies on is having both the old router IP and the new router IP active and valid at the same time. This means that thse IP’s can’t already be used.
Migrating
For this migration, a Mikrotik router is being used, so all the below steps show the relevant commands that can be used for each step.
Assumptions
br-lan
is the LAN interface that is being changed192.168.0.0/24
is the old LAN network10.10.0.0/16
is the new LAN network
Attach new IP
So that the router can work as a router for the devices once they have their new IP, we assign the new IP to the lan port
/ip address
add address=10.10.0.1/24 comment=NewLanIP interface=br-lan network=10.10.0.0
Create a new DHCP Pool
This defines the allocatable range of IP’s that the DHCP server can hand out
/ip pool
add name=dhcp_pool_new ranges=10.10.0.2-10.10.254.254
Create a new DHCP Network definition
This sets up the dns server to advertise, you may want to also specify PXE options here. Copy from your old network.
/ip dhcp-server network
add address=10.10.0.0/16 dns-server=10.10.0.1,1.1.1.1,8.8.8.8
Change DHCP server over
Finally, now that we have all the configuration structures setup, the DHCP server can be set to use the new range
/ip dhcp-server
set address-pool=dhcp_pool_new numers=0
Renew DHCP on nodes
This will depend on your environment. Worse case you can wait out the DHCP renew time on all the leases.
Cleanup
At this point in time, all machines should be migrated. You can now delete the original DHCP config