19 June 2009
Changing the DHCP scope subnet mask
Change the subnet mask in 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 new subnet, but this will lead to 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
Use the below command to export the scope configuration
C:\>netsh dhcp server \\”Server name” scope “scope subnet” dump>c:\dhcp.txt
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 resemble 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
Edit the file and save
After this, delete the scope and run the below command to create the scope from the txt file
C:\>netsh exec c:\dhcp.txt
This will automatically create the DHCP scope with the new subnet mask
This way you can change other configuration details along with subnet mask change, like IP range and Excluderanges
Subscribe to Windowstricks by E-mail to get the free updates and free tools
Share this . . .