Featured image of post Changing the subnet mask in Microsoft DHCP Server

Changing the subnet mask in Microsoft DHCP Server

Changing the subnet mask in a Microsoft DHCP Server without having to create a new DHCP scope.

I recently needed to change the subnet mask from /24 to /23 for a customers network, which also included changing the DHCP scope. Unfortunately its not possible to change the subnet mask through the GUI.

Rather than delete the current scope and recreate this manually, a quick Google helped me find a quicker solution.

  1. Open Command Prompt and run the following command:

    1
    
     netsh dhcp server \\<DHCP SERVER> scope 192.168.X.X dump > C:\dhcpconfig.txt
    
  2. Open the configuration file that we exported the configuration to in step 1 (dhcpconfig.txt). Look for the highlighted subnet mask like in the image below, change the highlighted subnet mask to the new subnet mask.

    DHCP Configuration file

    If you are also going to change the DHCP range that the server is going to give out to clients make the change here:

    Change DHCP range

  3. When saving the file make sure its being saved using ANSI encoding.

    ANSII Encoding

  4. Now delete the current DHCP scope.

    Delete DHCP scope

  5. Next we are going to import the DHCP configuration text file using the following command:

    1
    
    netsh exec c:\dhcpconfig.txt
    

    If you have any excluded IP ranges that are in the old DHCP range then these will fail to import and the errors can be ignored.

  6. Confirm that all looks as expected in the DHCP GUI and run the following command on a client machine to make sure that the client gets a IP address in the new range.

    1
    
    ipconfig /release && ipconfig /renew
    
Built with Hugo
Theme Stack designed by Jimmy