Hello guys!
Sometimes a /24 subnet is running out of free usable IP addresses and we need to extend the network. I want to show you how easy it is and what you have to keep in mind. First we need to plan our new network. The easiest way is to extend your current network, so you don’t have to change all of your devices. For example: We are currently running 192.168.2.0/24 so we use the subnetmask 255.255.255.0. We will extend this to /23 (255.255.254.0). Keep in mind that you need to plan it right, because there are cases where you go up or down in your subnet-id. I suggest this online calculator: www.subnet-calculator.com
For example:
- 192.168.1.0/24 to /23 = 192.168.0.0/23, subnetmask 255.255.254.0
(usable IP addresses from 192.168.0.1 to 192.168.1.254) - 192.168.2.0/24 to /23 = 192.168.2.0/23, subnetmask 255.255.254.0
(usable IP addresses from 192.168.2.1 to 192.168.3.254) - 192.168.2.0/24 to /22 = 192.168.0.0/22, subnetmask 255.255.252.0
(usable IP addresses from 192.168.0.1 to 192.168.3.254)
We will go from 192.168.2.0/24 to 192.168.0.0/22. First we will export the Microsoft DHCP settings with this command (reserved-IPs are also getting exported):
netsh dhcp server dump all > c:\dhcp.txt
Delete your current DHCP scope and open the txt file with notepad, press Control+H and replace “Dhcp Server” with “netsh dhcp server”. Search for your current subnetmask 255.255.255.0 and change it to 255.255.252.0. Your subnet also needs to be replaced in the txt file, so press Control+H again to replace “192.168.2.0” to “192.168.0.0”.
After this, we need to manually change the iprange and excluderange (PUCK is my test-server ;-) ). Always use the full range, we will configure excluderanges at the start and the end of the subnet:
net dhcp server \\Puck Scope 192.168.0.0 Add iprange 192.168.0.1 192.168.3.254 net dhcp server \\Puck Scope 192.168.0.0 add excluderange 192.168.0.1 192.168.0.100 net dhcp server \\Puck Scope 192.168.0.0 add excluderange 192.168.0.200 192.168.3.254
as you can see, our DHCP will return IP addresses from 192.168.0.101 to 192.168.0.199. In most cases, you can delete the areas with “classes”, “filter” and “options. Change the file ending from .txt to .bat and double click the file. You should now have your new DHCP scope:
after this you need to change the subnetmask of all devices with fixed IP-addresses:
- firewall/gateway
- all printers
- all servers
The servers are running through so they don’t need a restart nor clients will have a disconnect. I’m always doing those changes within the customer working hours :-)
Have a nice day!