Skip to content

Windows Server 2008 R2 DHCP Core – Step by Step Installation

May 28, 2013

In Windows Server 2008, we can setup the DHCP Server role and configure DHCP parameters including Scope, IP Range etc and the startup type all from command line.

This is especially useful, if you are using Windows Server Core installation.

The following step by step procedure should help you complete the task :

Install DHCP Server role

The following command from the command prompt should add the DHCP Server Role.

start /w ocsetup DHCPServer

In Windows Server 2008 Core, the Role name is “DHCPServerCore”. So, in Windows Server 2008 Core installation, it is

start /w ocsetup DHCPServerCore

 

Set DHCP Service to be Automatic

By default, after the role is enabled, the Service is still disabled. Hence Set the type to Auto as follows

sc \\%computername% config dhcpserver start= auto

 

Start the DHCP Server

net start dhcpserver

 

Add DHCP Server and Authorize in AD

If the DHCP server is installed in an Active Directory domain, you must authorize it in Active Directory. Now, let’s use the netsh commands to setup the server and configure the relevant parameters.

netsh dhcp add server %computername% 192.168.0.5

Adding server dc1, 192.168.0.5

Command completed successfully.

Where DC1, is the DHCP Server and the IP Address follows it

 

Add DHCP Scope

netsh dhcp server 192.168.0.5 add scope 192.168.10.0 255.255.255.0 Scope1 Scopevlan10

Command completed successfully.

In the above the DHCP scope – 192.168.10.0 255.255.255.0

Scope1 – Scope Name

ScopeVlan10 – Comment for the scope

Syntax is

netsh dhcp server 192.168.0.5 add scope <Subnet> <Subnet mask> <ScopeName> <Scope comment>

 

Set Scope IP Range

netsh dhcp server 192.168.0.5 scope 192.168.10.0 add ipra nge 192.168.10.1 192.168.10.254

Changed the current scope context to 192.168.10.0 scope.

Command completed successfully.

Here the IP range is 192.68.10.1-192.168.10.254 for the scope 192.168.10.0

Syntax is

netsh dhcp server <Server> scope 192.168.10.0 add iprange <StartIP> <EndIP>

Add Exclusion Range

Add any IP Exclusion ranges if any.

netsh dhcp server 192.168.0.5 scope 192.168.10.0 add excluderange 192.168.10.1 192.168.10.25

Changed the current scope context to 192.168.10.0 scope.

Command completed successfully.

Here the exclusion list has the range between 192.168.10.1 to 192.168.10.25

Syntax is

netsh dhcp server <server> scope <scope> add excluderange <startexclusion> <end-exclusion>

 

Set Option Code 003 for Default Routers

Set the option Code 003 and specify the Gateways

netsh dhcp server 192.168.0.5 scope 192.168.10.0 set optionvalue 003 IPADDRESS 10.1.1.1 10.1.1.2

Changed the current scope context to 192.168.10.0 scope.

Command completed successfully.

Here the gateways are 10.1.1.1 & 10.1.1.2

Syntax is

netsh dhcp server <server> scope 192.168.10.0 set optionvalue 003 IPADDRESS <gateway1> <gateway2>

 

Set Option Code 006 for Default DNS Servers

netsh dhcp server 192.168.0.5 scope 192.168.10.0 set optionvalue 006 IPADDRESS 192.168.0.5 192.168.10.1

Changed the current scope context to 192.168.10.0 scope.

Command completed successfully.

Here the DNS Servers are 192.168.0.5 & 192.168.10.1

Syntax is

netsh dhcp server <server> scope 192.168.10.0 set optionvalue 006 IPADDRESS <primary> <secondary>

 

Activate DHCP Server Scope

Now, the relevant DHCP settings are complete. Lets activate the Scope

netsh dhcp server 192.168.0.5 scope 192.168.10.0 set state 1

Changed the current scope context to 192.168.10.0 scope.

Command completed successfully.

This should help you up and running with DHCP in less than 5 minutes. You can always modify from command line or by using DHCP MMC later on!!!

From → Server Core!!!

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: