Tag Archives: DHCP

Compacting DHCP database using Jetpack.exe

Like any other database, DHCP server database also need maintenance in periods to keep the performance and availability. In large infrastructures, DHCP database can grow fast. Like we do for other databases, DHCP server DB also can compact. Microsoft recommends to do this for any database larger than 30mb.

Back in windows NT time Microsoft introduce a utility call “Jetpack” which can use to compact WINS and DHCP databases. This tool still available even for windows server 2012 R2.

In this demo I will show how we can do the database compact. The compact process happens in 3 steps.

1)    Copy running DHCP database in to temporary databases.
2)    Delete Original DHCP DB
3)    Rename temporary database to the original database file name.

Please note that to do this first we need to stop the DHCP server. So make sure to pre-plan for the downtime.

In this demo I am using windows server 2012 R2 which is connected to domain. It holds DHCP server role for the network.

1)    Log in to the server as Domain admin or Enterprise Admin.
2)    Open command prompt as admin

jet1

3)    Then type cd %systemroot%\system32\dhcp

jet2

4)    Then type net stop dhcpserver. It will stop the DHCP server.

jet3

5)    Then type jetpack.exe dhcp.mdb tmp.mdb

jet5

Well this is the interesting part, if you do not have “wins server” role installed on the server, you will get error like, 'jetpack' is not recognized as an internal or external command, operable program or batch file.
But friends unfortunately, jetpack only comes with WINS server package. So you need to add this role if you do not have it.

jet4

6)    Finally type net start dhcpserver to start the dhcp server.

jet6

If you have any question feel free to contact me on rebeladm@live.com

Automatic DHCP server Backup

Dynamic Host Configuration Protocol (DHCP) server in organization may require backup and restore dhcp database in event of hardware failure, software failure, migration or in fault configuration change. How many of you guys know that Microsoft automatically backup your dhcp database? Sounds strange right? but yes system automatically backup the DHCP server config. In this post let’s see how we can adjust the default parameters of this automatic backup process.

In my demo I am using a server with windows server 2012 R2 in a domain. It do have DHCP server role installed and configure.

To start the process log in to server as Domain admin or Enterprise admin.
Then Server Manager > DHCP

dhcpbk1

Once mmc load, right click on the server node and click properties.

dhcpbk2

In the new window you can see it shows backup path as C:\Windows\system32\dhcp\backup. This is the default path. But we can change it to local folder or network share. Click on brows to select the new path. In my demo it is set to C:\DHCPBackup. Once path set click on ok.

dhcpbk3

dhcpbk4

System automatically backup the config in every 60 minutes time. But we also can change this schedule as per our requirement.
To do that we need to do some registry key edit. To open the registry mmc, go to Run > regedit

dhcpbk5

Then go to path HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DHCPServer\Parameters
In there you will be able to see a key called BackupInterval.

dhcpbk6

To edit the value double click on it, and then once open select, decimal value option.

dhcpbk7

As you can see default value is 60, to change it type the value you needs (the value represent the number of minutes) and press ok. In my demo I am going to set for 10 minutes.

Once done we can check the folder path we set to confirm the backup it’s made.

dhcpbk8

If you have any questions feel free to contact me on rebeladm@live.com

STEP-BY-STEP GUIDE TO MIGRATE DHCP FROM WINDOWS SERVER 2003 TO WINDOWS SERVER 2012 R2 USING WINDOWS SERVER MIGRATION TOOLS

Microsoft has already announced that windows server 2003 / windows server 2003 R2 versions support is coming to end in 14th July 2015 (http://support2.microsoft.com/lifecycle/search/default.aspx?sort=PN&alpha=Microsoft+Windows+Server+2003&Filter=FilterNO ).

It’s no wonder that still organizations using windows server 2003 / windows server 2003 R2 in their infrastructure with different server roles.

With windows server 2008 R2 Microsoft has introduce new great feature called “Windows Server Migration Tools” which will  allow administrators to migrate server roles, features, configuration settings seamlessly from one system to another(ex- windows server 2003). Windows server 2012 also includes this feature and in this article I will demonstrate how we can use it to migrate DHCP role to windows server 2012 r2.

Please note, To use this method we need to install this feature in both source and destination servers.

For the demonstration I am using following setup

Server Name

Operating System

Server Roles

Networks

dhcp-2k3.canitpro.local

Windows Server 2003 R2 Enterprise x86

DHCP

Network A – 10.10.10.0

Network B – 172.16.25.0

Network C – 192.168.148.0

CANITPRO-DC2K12.canitpro.local

Windows Server 2012 R2 x64

Before start the migration process it’s important to consider on following.

1)    To migrate the roles you need to log in to source and destination servers as “Domain Administrators”.
2)    Before start the migration process make sure source and destination servers’ runs with latest updates and service packs.
3)    If the source server runs with multiple network, multiple NIC make sure the destination server also have same number of NIC so it can be server with same network setup.

dhcp-2k3.canitpro.local server currently setup with 3 additional NIC to represent network A,B and C. those have configured with static ip addresses to match with relevant network it belongs to. The DHCP server host different DHCP scopes for each network.
Before we start the process we need to install the following software in windows server 2003(dhcp-2k3.canitpro.local) if it’s not there already.

1)    .Net Framework 3.5 (http://www.microsoft.com/en-us/download/details.aspx?id=21)
2)    Windows PowerShell 2.0 (http://support2.microsoft.com/kb/968929/en-us)

Install Windows Server Migration Tools in windows server 2012

1)    Log in to the Windows server 2012 as Domain Administrator
2)    Go to Server Manager > Add Roles and Features

dmig1

3)    It will open the Add roles and features Wizard and click next to start the process
4)    In next window, for the installation type select “Role-based or feature-based installation”  then click next to continue

dmig2

5)    In next window keep the default server selection and click next to continue

dmig3

6)    Then it will give option to select server roles but we need to install only a feature. So keep the default selection and click next to continue.

dmig4

7)    Then in features selection, select “Windows Server Migration Tools”  and click next to continue

dmig5

8)    In next window it will give the confirmation window and click on install to begin the installation process

dmig6

9)    Once installation is completed click on close to exit from the wizard

Prepare windows server migration tools for windows server 2003

1)    Log in to the Windows server 2012 as Domain Administrator
2)    Go to Server Manager > Tools > Windows Server Migration Tools > Windows Server Migration Tools

dmig7

3)    It will open up the command prompt and then type cd ServerMigrationTools

dmig8

4)    Now we need to create migration deployment package for windows server 2003. To save the files I have create folder “C:\WIN2K3MIG”. Now type the command .\SmigDeploy.exe /package /architecture x86 /os ws03 /path C:\WIN2K3MIG and press enter

dmig9

5)    This creates the package as following

dmig10

6)    Now we need to copy the folder C:\WIN2K3MIG\SMT_ws03_x86 to windows server 2003 which host the DHCP role

Prepare windows server 2003 (DHCP Source) for the migration

1)    Log in to the Windows server 2003 as Domain Administrator
2)    Go to Start > All Programs > Accessories > Windows PowerShell > Windows PowerShell

dmig11

3)    Then type “Net stop “DHCP Server”” and enter

dmig12

4)    This will stop the running DHCP server. Then open the folder copied from windows server 2012 R2 and then open the file called “SmigDeploy.exe

dmig13

5)    Then it will open up the command window. Then type Get-SmigServerFeature and press enter

dmig14

6)    This will examine the roles running on this server and provide list of roles which we can migrate over to windows server 2012 R2
7)    Now it’s time export the DHCP data using the tool. Before do it we need to prepare a share folder in network which will have access from both DHCP Source Server and DHCP Destination Server. I have create folder called “DHCPShare” in windows server 2012 and share it with read and write NTFS permissions.

dmig15

8)    Type the command Export-SmigServerSetting -featureID DHCP -User All -Group -path \\Canitpro-dc2k12\DHCPShare -Verbose and press enter to export the DHCP data. In here featureID define the server role. Once enter the command it will ask a password to protect the data.

dmig16

9)    Now in the share we can see it created the backup file.

dmig17

With this step it will successfully exports the DHCP data.

Remove DHCP roles from windows server 2003 R2

Since we no longer need DHCP role running on this server we can go ahead and uninstall the DHCP service.

1)    Log in to the windows server 2003 as member of administrator group
2)    Start > Control Panel > Add or Remove Programs

dmig18

3)    Then click on “Add/Remove Windows Components

dmig19

4)    In next window select “Networking Services” and click on details

dmig20

5)    From next window de-select the DHCP option and click ok

dmig21

6)    Then click next to uninstall the DHCP service


It will uninstall the DHCP role from the windows 2003 server.

Install DHCP Role in windows 2012 R2 server

1)    Log in to the windows server 2012 as member of administrator group
2)    Open Server Manager > Add Roles and Features

dmig22

3)    It will open the wizard and click next to continue
4)    For the installation type select “Role-based or feature-based installation” and click  next

dmig23

5)    Let the default selection run on server selection and click next to continue

dmig24

6)    For the server roles select DHCP and it will prompt to add relevant features. Click on “Add features” to add them and next to continue

dmig25

7)    For the features let it run with default. Click next to continue
8)    Then it will give brief description about DHCP server role and click next to continue

dmig26

9)    Next window it will give the confirmation and click on install to continue

dmig27

This will install the DHCP server role in the new server.

Import DHCP server data in to windows server 2012 R2

1)    Log in to the Windows server 2012 as Domain Administrator
2)    Open Windows Powershell using Server manager > Tools > Windows Powershell
3)    Type “Net stop “DHCP Server”” and press enter

dmig28

4)    Then type Add-PSSnapin microsoft.windows.servermanager.migration and press enter to use the migration tools command set.

dmig29

5)    Now to import DHCP data type Import-SmigServerSetting -featureID DHCP -Force -path C:\DHCPShare -Verbose (Note: Here I didn’t import the users or groups as its domain controller I am importing to but if necessary you can do it using –Users and Group command) and press enter. Here C:\DHCPShare is the folder path where we save the DHCP data from windows server 2003. It will ask the password to enter which we have define during the export DHCP server data process.

dmig30

6)    Then type Start-Service DHCPServer and press enter to start the DHCP server

dmig31

7)    Then authorize the DHCP server with command Netsh DHCP add server CANITPRO-DC2K12.canitpro.local 38.117.80.124

dmig32

Note : If the source DHCP server had multiple NIC with Multiple networks make sure the new server also match the same config. Assign the static ip address to those interfaces to match the configuration. This also can automated during the import process. You can get more info about command option in http://technet.microsoft.com/en-us/library/dn495425.aspx

Now we completed with the restore process and I already can see its issues IP addresses.

dmig33

STEP-BY-STEP GUIDE TO MIGRATE DHCP FROM WINDOWS SERVER 2003 TO WINDOWS SERVER 2012 R2

Microsoft has already announced that windows server 2003 / windows server 2003 R2 versions support is coming to end in 14th July 2015 (http://support2.microsoft.com/lifecycle/search/default.aspx?sort=PN&alpha=Microsoft+Windows+Server+2003&Filter=FilterNO ).

It’s no wonder that still organizations using windows server 2003 / windows server 2003 R2 in their infrastructure with different server roles. In last few post I have covered up how we can migrate different server roles from windows server 2003 to latest windows server 2012. This article also a part of the same series and it will explain how we can migrate DHCP server role.

For the demonstration I am using following setup

Server Name

Operating System

Server Roles

Networks

dhcp-2k3.canitpro.local

Windows Server 2003 R2 Enterprise x86

DHCP

Network A – 10.10.10.0

Network B – 172.16.25.0

Network C – 192.168.148.0

CANITPRO-DC2K12.canitpro.local

Windows Server 2012 R2 x64

dhcp-2k3.canitpro.local server currently setup with 3 additional NIC to represent network A,B and C. they have configured with static ip addresses to match with relevant network it belongs to. The DHCP server host different DHCP scopes for each network.

Backup DHCP configuration in windows server 2003 R2

1)    Log in to the windows server 2003 as member of administrator group
2)    Load the DHCP server console Start > Administrative Tools >  DHCP

dhcp1

3)    In here we can see the configured DHCP scopes

dhcp2

4)    Now it’s time to back up the config. To do that open the command prompt using start > run > type cmd and then enter
5)    Then type netsh dhcp server export C:\DHCPbk\dhcpbk.txt all and press enter. In here C:\DHCPbk\dhcpbk.txt is the file path which backup will save in to. It can change according to your requirement.

dhcp3

6)    Now please move file C:\DHCPbk\dhcpbk.txt in to CANITPRO-DC2K12.canitpro.local server which will be configured as new DHCP server ( windows server 2012 R2)

Remove DHCP roles from windows server 2003 R2

Since we no longer need DHCP role running on this server we can go ahead and uninstall the DHCP service.

1)    Log in to the windows server 2003 as member of administrator group
2)    Start > Control Panel > Add or Remove Programs

dhcp4

3)    Then click on “Add/Remove Windows Components”

dhcp5

4)    In next window select “Networking Services” and click on details

dhcp6

5)    From next window de-select the DHCP option and click ok

dhcp7

6)    Then click next to uninstall the DHCP service

It will uninstall the DHCP role from the windows 2003 server.

Install DHCP Role in windows 2012 R2 server

1)    Log in to the windows server 2012 as member of administrator group
2)    Open Server Manager > Add Roles and Features

dhcp8

3)    It will open the wizard and click next to continue
4)    For the installation type select “Role-based or feature-based installation” and click  next
5)    Let the default selection run on server selection and click next to continue
6)    For the server roles select DHCP and it will prompt to add relevant features. Click on “Add features” to add them and next to continue

dhcp9

7)    For the features let it run with default. Click next to continue
8)    Then it will give brief description about DHCP server role and click next to continue

dhcp10

9)    Next window it will give the confirmation and click on install to continue

dhcp11

This will install the DHCP server role in the new server.

Restore DHCP configuration

1)    Log in to the windows server 2012 as member of administrator group
2)    Open Command prompt with Run > cmd
3)    Type netsh dhcp server import C:\DHCPbk\dhcpbk.txt all and press enter. In here C:\DHCPbk\dhcpbk.txt is the backup file we copied from windows 2003 server.

dhcp12

4)    Go to Server manager > tools > DHCP

dhcp13

5)    Right click on the server name > All Task > Restart

dhcp14

6)    Once Restart done we can see all the scopes are visible which was in 2003 server.

dhcp15

7)    We still need to authorize the dhcp server, to do it again right click on server name and select authorize

dhcp16

Now we completed with the restore process and I already can see its issues IP addresses.

dhcp17

if any questions about the post feel free to contact me on rebeladm@live.com
 

Why DHCP ?

For any host to perform any communication it must have an IP address. When we take a network to each host need to have an ip address to function in network. When the number of hosts increases assigning IP addresses to them (manually) become issue. Especially when you move in to IPv6 the addresses are more complex as well. There for its better to have mechanism to assign IP addresses automatically when hosts are connects to network. As solution for this, Dynamic Host Configuration Protocol (DHCP) Service can use to issue ip address to connected computers and devices to the network automatically. All the configurations such as DNS server info, WINS Server Info etc also can automatically publish to the hosts.

There are lots of ways that you can configure DHCP Services. Most of the modern day Routers, Switches are comes with inbuilt DHCP server which can simply configure for network. Also we can configure operating system level DHCP servers on windows, Linux environments.

There are lots of benefits we can get for DHCP automatic IP addressing.

Advantages

Description

Save IP usage

When you use static ips have to provide at least one ip to device depend on the requirement. Once you used it there you cannot assign it to any other device. Because at any given time it cannot use same ip in 2 places. Let’s assume altogether we have 50 computers and you assign ips to all 50 as static. So now in your ip range you have used 50 ips. But in real world in one time may be only 25 computers running. So you have wasted 25 ips from your ip range. But in DHCP environment the device will receive ip only when it connecting. If device turn off we can configure DHCP server to release those ips to ip pool after certain amount of time. So its save the ip you have for your network.

Easy to Manage

 

 

 

 

 

 

 

 

When use Static IP as administrator have to keep records of the ip usage. Have to maintain inventory for the ips to see what the ips used are and what are the available.  Depend on the organization size it may take certain amount of time to assign new ip to a device. Because of manual ip issue people will have to depend on IT department and they will have to waste their time just to get ip. With DHCP it will not necessary to have such inventory and devices can automatically get ips from the ip pool without depend on another party. It saves lot of time for administrator as well as users.

Can avoid from human errors with manual ip assign

When configuring IPs in devices manually can cause errors and will need to spend time on troubleshooting as well. When putting ips in to device mistake with one digit even can cause issues. In DHCP environment this kind of issues will not happened ever. Since its issue from server to device the information will be fully accurate and it will save time on issues with manual configuration. 

No or minimum IP conflicts in Network

When in static IP network there is high possibility to have ip conflict in devices. Since this is manual process there can be human errors and assign same ip to multiple devices. This will remove those devices access to network until its corrected. So in this case it waste time of the users.

But in DHCP environment the system will never issue same ip address to multiple devices. so the chances to happen ip conflict in network is minimum.

DHCPv6 Support

With IPv6 if go for static ip environment it can be lot of issues. There will be high possibility that users have issues with wrong ip details as long number of digits, characters. It will cost lot of time from users as well as administrators to maintain Static IPv6 environment.

With Server 2008 R2 DHCP server services can support IPv6 environment and can configure DHCP to issue IPv4 and IPv6 ips to issue as devices requested. It doesn’t need to keep 2 DHCP servers for it and same DHCP server can answer both IPv4 and IPv6 Requests.

More Efficient for Mobile Users

In organization there can be users that travel or use portable devices such as laptops for their work. Those mobile users will change their networks as they travels. So keeping static ip environment for them will waste lot of time just to get connected to network. But when use DHCP environment it will more efficient for them as they do not want to worry about manual ip configuration in there devices anymore.

Network changes can apply more easily and faster

Depend on the network there can be requirements to change networks settings. For example it can be entire ip range for the company, DNS servers etc. if Its Static IP environment it will involve with manual configuration in every device which is very time consuming. Sometime the entire network users will have to wait until these changes to be done in their computers or devices.

But if its DHCP environment the changes deployment will be easy and fast as the settings only need to be publish from the server side. So all computers, devices will get new configurations from server faster with minimum effect. The changes will be accurate as well.

How DHCP Works?

DHCP

As soon as DHCP client connect to the network it send a broadcast message to its subnet called as DHCP discover message to indicate to the DHCP servers there is a host that would like to get an IP address. The DHCP server in the subnet then replies to that message with a DHCP offer. DHCP offer includes IP address and associated configuration information. Then if DHCP client is ready to accept the offer, it send DHCP Request message to the corresponding DHCP server. Then DHCP server send DHCP acknowledge message to the DHCP client approving the lease along with the info such as default gateway, DNS server addresses, WINS server addresses. After client receive ack message it will completes the initialization of the IP address.