How to change the subnet mask of DHCP scope

By | June 18, 2009

Changing the DHCP scope subnet mask

Change the subnet mask in the existing DHCP scope

You can’t change the subnet mask of the DHCP scope directly without deleting the scope, need to delete the DHCP scope first then recreate the scope with the new subnet, but this will lead to the large amount of manual work

To avoid the manual work use the below NETSH command to change the subnet mask in existing DHCP scope with the simple steps

Also Read: DHCP Superscope

Use the below command to export the scope configuration

Syntex:

C:>netsh DHCP server \\” Server name” scope “scope subnet” dump>c:dhcp.txt

Example:

C:>netsh DHCP server \\Test01 scope 192.168.1.0 dump>c:dhcp.txt

To change the subnet mask of the scope

Open the dhcp.txt file and change the subnet mask, dhcp.txt file resembles the following

Changed the current scope context to 192.168.1.0 scope.

DHCP Server 192.168.1.24 add scope 192.168.1.0 255.255.255.0 “Vlan-1” “Vlan-1”
DHCP Server 192.168.1.24 Scope 192.168.1.0 set state 1

Continue reading → page 2

Also Read: Active Directory (AD) Real Time Interview Questions and Answers

Also Read: Windows Server Administrator Interview Questions and Answers

26 thoughts on “How to change the subnet mask of DHCP scope

  1. Diego

    Great post ! Worked for me on a 2008R2 machine saving the time of reconfiguring the whole DHCP Scope on 2 servers. Thank you!

    Reply
  2. Anonymous

    Thanks a lot!

    It works, however, in addition to changing scope’s mask in the dump-file, it is necessary to change its IP-address, too, to match its new mask. Otherwise the command:

    C:>netsh exec c:alabala.txt

    fails with appropriate error message.

    Reply
  3. Anonymous

    ive read this post and have one quick question i hope can be answered before i make the changes.
    im just changing the subnet mask from 255.255.0.0 to 255.255.255.0.

    When i delete the existing scope and quickly import the new one using this method.Will my clients automatically renew or does it need to be forced on the client..I dont want to make the change and have all the users calling as they have lost connectivity in a hospital enviroment.

    Reply
  4. Anonymous

    Worked great for me with one addition. My range was originally 10.144.67.0 with a subnet of 255.255.255.0. When i just changed the subnet to 255.255.252.0 the import woud fail with “bad parameter” I had to do a search and replace of the 10.144.67.0 with 10.144.64.0 and then it was able to import. Just found a simple subnet calculator online to tell me that a 252.0 subnet containing 67.0 had to start at 64.0.

    Reply
  5. Anonymous

    awesome .. double awesome .. just great .. thanks a bunch

    Reply
  6. Adam Kessler

    There is a significant step left out in the process expressed above. One that can lead to significant frustrations and network down time.
    The instructions to delete the scope after you have dumped the DHCP configuration is seriously incomplete. Before you can effective import a modified scope you must rename the dhcp.mdb and dhcp.pat files in the dhcp system folder. Without this step, the import process will always load the existing configuration and try to update it with the contents of the dump file. This will not work when attempting to change the network mask. The existing files must be renamed in order to create a new scope with the changed mask. I would highly suggest trying this on a non-production server first. I did so by first creating a new scope with the parameters I needed for the network definition. I did not define anything else. Once this was done, I dumped this to view the file for a scope as I needed it to be configured. I then copied out the parts reflecting the changes into the approriate areas of my production server’s dump and then imported that into the test server and checked the DHCP gui for proper completion. Once I was sure this worked, I used this file to import the changes into my production server. In this case because of the need to change the network mask, I had to rename the ,mdb and .pat files on the production server to basically create the new scope.

    Reply
  7. Anonymous

    This worked on a 2008r2 server with multiple scopes, followed the process outlined to (almost) to the letter, I only needed to change one scope. Perhaps if you have only one scope you would need to delete your mdb files, it was not neccessary in my case. This saved me a lot of work, thank you!

    Reply
  8. Anonymous

    Notwork for windows2003 DHCP server…It is not changing the DHCP scope
    subnet mask

    Reply
  9. Clay Tsuhako

    This looks very good for what I would like to do (10.0.0.1-254/255.255.255.0 to 255.255.252.0). My question would be what would I have to do to the devices (servers, switches,etc.) that have static IPs and the old subnet mask of 255.255.255.0? Would I still have to manually change all their subnet masks to 255.255.252.0?

    Reply
  10. Anonymous

    Just did this and it works exactly as the instructions suggest. No need to rename dhcp mdb and pat files as another poster has suggested.

    Reply
  11. Thank You

    Awesome !!!!! worked like a charm. I had around 20 reservations in my scope and all got restored after changing Scope and mask both, in 10 seconds !!!!

    Reply
  12. Craig Chapman

    Thank you for this! It worked like a charm and saved me a lot of time!

    Reply
  13. Jon

    I’ve created my own step-by-step version of this. The original is flawed in the sense that if you try to modify the only DHCP scope you have. It won’t work properly. Following the direction of another user on here, here is what you need to do:

    1) CMD: netsh dhcp server \\”Server name” scope “scope subnet” dump>c:\dhcp.txt
    2) Modify the txt file with the correct DHCP scope and Subnet Mask. Save it.
    3) Go into Services and STOP both DHCP client and Server services.
    4) Navigate to C:\Windows\System32\DHCP and rename both the “dhcp.pat” and “dhcp.mbd” files to .old
    5) Restart both DHCP client and Server services.
    6) CMD: netsh exec c:\dhcp.txt
    7) Open the DHCP admin tool and verify the scope is correct.
    8) Restart both DHCP services again to verify functionality.

    Reply
  14. Bill

    If you were using this command to increase change the subnet mask (increase the scope range), you need to delete the scope before re-importing it.. Wouldn’t deleting the scope clear all the current DHCP leases and therefore cause IP clashes when clients requested IP numbers?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *