Creating and managing DHCP scopes using Netsh

by Mitch Tulloch [Published on 5 Aug. 2009 / Last Updated on 6 March 2009]

You can use the Netsh command to create and manage DHCP scopes from the command line.

You can use the Netsh command to create and manage DHCP scopes from the command line. A scope is a pool of IP addresses that a DHCP server can lease to clients that need them. You can use this approach to write batch scripts of Netsh commands you can run on a DHCP server to quickly configure it.

For example, to create a scope named "Second Floor" that has network ID 10.10.20.0 and subnet mask 255.255.0.0, use the following command:

netsh dhcp server add scope 10.10.20.0 255.255.0.0 "Second Floor"

Then to add the address range 10.10.20.100 to 10.10.20.150 to this scope, use this command:

netsh dhcp server scope 10.10.20.0 add iprange 10.10.20.100 10.10.20.150

And if you want to exclude the address 10.10.20.125 from your scope, do this:

netsh dhcp server scope 10.10.20.0 add excluderange 10.10.20.125 10.10.20.125

You can even create a reservation for a specific address like 10.10.20.144 like this:

netsh dhcp server scope 10.10.20.0 add reservedip 10.10.20.144 0004FE42A3BE

Here 0004FE42A3BE is the MAC address of the system you want to reserve the address for.

See Also

Featured Links