Windows Server installation and configuration of the DHCP role

In this tutorial, we will see how to install and configure a DHCP server on Windows Server in an Active Directory environment.

As a reminder, the DHCP service makes it possible to distribute IP addresses to the hardware connected to a network that requests it.

The DHCP request can be received directly from the hardware when it is in the same logical network or from a relay agent when the hardware is on another network (physical or logical).

Installing the DHCP role

Powershell

1. Open a Powershell command window as administrator and enter:

Install-WindowsFeature DHCP –IncludeManagementTools
DHCP : installation en cours...

3. When the installation is complete, close the Powershell window.

DHCP : installation du rôle terminé

Graphic mode

1. From Server Manager, click Add Roles and Features 1 to open the wizard.

Gestionnaire de serveur

2. When launching the wizard, click Next 1 .

Assistant ajout rôle & fonctionnalité

3. Select the Role Based Installation or 1 feature and click Next 2 .

Option installation

4. Choose the server where the DHCP role will be installed 1 and click Next 2 .

Cible installation

5. Check the box DHCP Server 1 .

Sélection du rôle DHCP

6. Click the Add Features 1 button.

Ajout des dépendances

7. Click Next 1 .

Passer à l'étape suivante

8. Skip the list of features by clicking Next 1 .

Valider la liste des fonctionnalités

9. Pass the DHCP Server role summary by clicking Next 1 .

Résume du rôle DHCP

10. Click Install 1 .

Confirmer l'installation

11. Wait during the installation …

Patienter durant l'installation

12. When the installation is complete, click Close 1 to exit the wizard.

Fermer l'assistant

DHCP service configuration

The configuration and administration of the DHCP server is done using the DHCP console or Powershell commands.

Allow the DHCP server in the domain

This step is required for each DHCP server and to be done once.

1. From the server manager, immediately after installation an alert is visible, click on 1 and on Finish DHCP configuration 2 . This will launch a new assistant.

Message alerte

2. Go to the next step by clicking Next 1 .

Assistant autorisation serveur DHCP AD

3. Click on Validate 1 .

Valider les informations d'authentification

4. Exit the wizard by clicking the Close 1 button.

Opération terminée, quitter l'assistant

5. Back on the server manager, go to DHCP 1 / SERVICES 2 . Right-click on the service and click Restart Services 3 .

Redémarrer le service DHCP

Add an address range

A scope is an IP address range assigned to computers requesting a dynamic IP address.

To run the DHCP server must have at least one configured scope.

1. From the DHCP console, right-click on IPv4 1 and click on New scope … 2 to open the New scope wizard.

add range

2. Skip the first window of the wizard by clicking Next 1 .

New scope wizard

3. Name the range 1 then click Next 2 .

Scope name

4. Enter an available address range that the DHCP server can distribute 1 . Enter the subnet mask 2 then click Next 3 .

Addresses to distribute

In the example above, the DHCP server will distribute the addresses between 192.168.1.140 to 192.168.1.149, or 10 devices maximum.

5. Click Next 1 .

Addresses to exclude

If for some reason, the IP addresses 142 to 144 are to be excluded from the distribution, it is possible to indicate it here.

6. Configure the lease duration 1 , which is the duration of the extension at the IP address. Click Next 2 .

Durée du bail

7. Choose Yes, I want to configure these options now 1 and click Next 2 .

DHCP scope option

8. Default gateway: enter the IP address of router 1 and click on Add 2 .

Default gateway

9. Click Next 1 .

Passerelle ajoutée

10. Enter the parent domain 1 , which is the DNS name of the Active Directory domain, add the DNS servers 2 (enter the IP then and press Add) then click Next 3> >.

Options DNS

11. Configure the WINS server if necessary (same operation as the DNS servers), otherwise click Next 1 .

Options WINS

12. Select Yes, I want to activate this range now 1 for immediate commissioning and click Next 2 .

Activer l'étendue

13. Click Finish 1 to close the wizard.

Fermer l'assistant

14. The scope is available 1 in the DHCP console.

Scope added

Add a reservation

A reservation always assigns the same address to a network card, the reservation is based on the MAC address.

You can add a reservation by the following two methods:

Adding from a lease

1. Go to the list of leases for extended 1 , right click on lease 2 and click on Add to reservation 3 .

Liste des baux

2. Click OK 1 to close the confirmation message.

Confirmer l'ajout de la réservation

3. Go to the Reservations folder 1 in the scope and check the creation of the fixed lease 2 .

Vérification de l'ajout de la réservation

Manual entry

1. Right click on the Reservation folder of the range 1 then New reservation 2 .

Ajout reservation

2. Enter the name of the reservation 1 , the IP address 2 , the MAC address of the network card 3 and click on Add 4 and Close 5.

Réservation

It is possible to specify an address outside the distribution range.

3. The reservation is added 1 .

Réservation ajoutée

It is possible for a reservation to customize the scope / server options.

Options réservation

Differences Between Scope Options and Server Options

In the DHCP console, there are two folders that allow configuration of DHCP options. The main difference is in the range.

Server options: The options configured in this folder will be extended to all scopes on the DHCP server, for example DNS servers.

Scope Options: The options configured in this folder will be ported only at the level of the distributed addresses on the scope, for example the default gateway.

DHCP server properties

In this part we will have some useful properties of the DHCP server. To access the properties, right click on the IP protocol and click Properties 1 .

DHCP server properties

General

From this tab, it is possible to enable or disable the audit generation to resolve any problems with the service.

Filters

This tab allows the activation of the green lists and exclusions. To activate a list, just check the box and apply.

DHCP filters

Filters apply to MAC addresses, it is possible to put a star for a wider filter *.

Example: you want to exclude iPhones from the network range, at first, you have to recover the IPhone MAC suffixes and add to the exclusion filters the MAC in the form:

AA-BB-CC – * – * – * or AABBCC *

Advanced

An interesting option to enable in case of a regular conflict on the DHCP service is the Conflict Detection Attempt, which will attempt to complete if the address is already taken before sending it to the post that has made a request.