Home Internet Mail Server Proxy Server Virus Windows Windows Server

Thursday, March 22, 2012

How to Change The Subnet Mask of DHCP Scope


A few days ago in my office, there was changing of subnet mask on one of subnet from DHCP of active directory. The subnet mask in existing DHCP scope can’t change directly without deleting the scope, delete the DHCP scope first then recreate the scope with new subnet.

Here are the steps:
  • Command to change the subnet mask in existing DHCP scope, we can use netsh.

The command to export the scope configuration:
C:\>netsh dhcp server \\”Server name” scope “scope subnet” dump>c:\dhcp.txt

Example:
C:\>netsh dhcp server \\DC01 scope 172.168.1.0 dump>c:\dhcp.txt

  • Change the subnet mask of the scope with open the dhcp.txt file and change the subnet mask in dhcp.txt file like example of below that underlined:
Dhcp Server 172.168.1.22 add scope 172.168.1.0 255.255.255.0 "Vlan-1" "Vlan-1"
Dhcp Server 172.168.1.22 Scope 172.168.1.0 set state 1
Save the dhcp.txt file, after that delete the scope.
  • Run below command to automatically create the DHCP scope with the new subnet mask from dhcp.txt file:
C:\>netsh exec c:\dhcp.txt
These steps also can change other configuration details along with subnet mask change, like IP range and Excluderanges.

3 comments:

  1. Awesome! Saved me a bunch of time with a byod implementation.

    ReplyDelete
  2. Thanks man ! The Microsoft article completely led me astray as the syntax of the netsh command was different and exported everything, not just the scope I wanted !

    ReplyDelete

Home Photography
Copyright © 2017 Xiu's Blog | All Rights Reserved.