# DHCP

## SETTING UP DHCP

{% hint style="info" %}

#### WHAT IS DHCP?

Microsoft Windows Server operating systems includes Dynamic Host Configuration Protocol (**DHCP**), which is an optional networking server role that you can deploy on your network to lease IP addresses and other information to DHCP clients. All Microsoft Windows client operating systems include the DHCP client as part of TCP/IP, and it's enabled by default.

Read more about Dynamic Host Configuration Protocol [here](https://docs.microsoft.com/en-us/windows-server/networking/technologies/dhcp/dhcp-top)
{% endhint %}

After installing the Active Directory server role on my DC server, it's time to install and configure the DHCP server role, so log into the DC server again, and we will start setting up the DHCP server role for my LAB environment.

### Installing DHCP

**Step 1.** Click "**Add roles and features**" in the Server Manager.

![Windows Server 2019 - DHCP](/files/-M--2MiDelyheDbGiJC7)

**Step 2.** Click "**Next**"

![Windows Server 2019 - DHCP](/files/-M--3WLDP4yBfk8fWal5)

**Step 3.** Leave everything default and click "**Next**"

![Windows Server 2019 - DHCP](/files/-M--3amoYjrqqKW93mLf)

**Step 4.** Leave everything default and click "**Next**"

![Windows Server 2019 - DHCP](/files/-M--3kzSlzxWs3u1Kk83)

**Step 5.** Select "**DHCP Server**"

![Windows Server 2019 - DHCP](/files/-M--3pFw6Fd_49Q3Xew5)

**Step 6.** Leave everything default and click "**Add Features**"

![Windows Server 2019 - DHCP](/files/-M--3seS-U5-6p7w-SQM)

**Step 7.** Leave everything default and click "**Next**"

![Windows Server 2019 - DHCP](/files/-M--430VkWb808Uz6D5S)

**Step 8.** Click "**Next**"

![Windows Server 2019 - DHCP](/files/-M--48Jt2S4JOrB_00w9)

**Step 9.** Check the "**Restart the destination server automatically if required**" box and click "**Install**"

![Windows Server 2019 - DHCP](/files/-M--4IPceHnwW3vub8Gp)

**Step 10.** Click "**Close**"

![Windows Server 2019 - DHCP](/files/-M--4Nbm-pzVSfzDtOca)

### Configuring DHCP

**Step 1.** When the server role installation is done, we should now see a yellow triangle with an exclamation mark in the Server Manager, click on it and then click "**Complete DHCP configuration**"

![Windows Server 2019 - DHCP](/files/-M--4TChS_uHxASjw2y5)

**Step 2.** Click "**Next**"

![Windows Server 2019 - DHCP](/files/-M--Ax6H7YmViTJfkqws)

**Step 3.** The "**User Name**" is populated automatically, so leave everything as default and click "**Commit**"

![Windows Server 2019 - DHCP](/files/-M--B2T0n5vEqd5I6023)

**Step 4.** Click "**Close**"

![Windows Server 2019 - DHCP](/files/-M--BCbgguCA2P61M2kt)

### **Configuring DHCP Scope**

**Step 1.** Type "**DHCP**" in the search line next to the start button, and click "**DHCP**"

![Windows Server 2019 - DHCP](/files/-M--BLBF7jtfiACzl_4s)

**Step 2.** Right-click on "**IPv4**" and then click "**New Scope**"

![Windows Server 2019 - DHCP](/files/-M--H8MvzeRYHFC7nx1K)

![Windows Server 2019 - DHCP](/files/-M--HBe2R79MRaKYYvVy)

**Step 3.** Click "**Next**"

![Windows Server 2019 - DHCP](/files/-M--EgWcERtfVr6UtFK6)

**Step 4.** Enter a name and description for the scope and click "**Next**"

![Windows Server 2019 - DHCP](/files/-M--EkoUKNStou_J8FUd)

**Step 5.** Enter start and end IP address (**IP range**), a subnet mask and click "**Next**"

{% hint style="warning" %}
Give it a subnet mask and a range of address from the private IP range we created in [Part 2](https://www.osdsune.com/home/blog/2020/configmgr-lab/part-2#hyper-v-nat-virtual-switch) during the Hyper-V configuration.
{% endhint %}

![Windows Server 2019 - DHCP](/files/-M--ErMVqgc9RONKUnAP)

**Step 6.** Leave everything default and click "**Next**"

![Windows Server 2019 - DHCP](/files/-M--F5EOY5fookZkBOuw)

**Step 7.** Leave everything default and click "**Next**"

![Windows Server 2019 - DHCP](/files/-M--FAYhFWqk_G-CFKDc)

**Step 8.** Select "**Yes, I want to configure these options now**" and click "**Next**"

![Windows Server 2019 - DHCP](/files/-M--FH-pnjWMV-KmGPq-)

**Step 9.** Enter a Router (**Default Gateway**) IP address and click "**Next**"

{% hint style="warning" %}
The Router (**Default Gateway**) IP address is the IP address of the Virtual NIC that we created in [Part 2](https://www.osdsune.com/home/blog/2020/configmgr-lab/part-2#hyper-v-nat-virtual-switch) during the Hyper-V configuration.
{% endhint %}

![Windows Server 2019 - DHCP](/files/-M--FMDqzPn9RInvWVQO)

**Step 10.** It should populate the IP address of the DC server automatically. But if that's not the case, then enter a server name and click "**Resolve**". Click "**Add**" to add the IP Address and then click "**Next**"

![Windows Server 2019 - DHCP](/files/-M--FRDsncEq4sH4_0h8)

**Step 11.** Leave everything default and click "**Next**"

![Windows Server 2019 - DHCP](/files/-M--FWU3W_ulqEvC_aS8)

**Step 12.** Select "**Yes, I want to activate this scope now**" and click "**Next**"

![Windows Server 2019 - DHCP](/files/-M--FakUdob3rL7MidTl)

**Step 13.** Click "**Finish**"

![Windows Server 2019 - DHCP](/files/-M--Fifz_uRBMBgWHFrK)

**Step 14.** Expand the scope and click on "**Address Pool**" to confirm that the IP range has been created.

![Windows Server 2019 - DHCP](/files/-M--HMhLR6COzM3wa5qK)

**Step 15.** Click "**Scope Options**" to confirm that the Router and DNS settings are configured correct.

![Windows Server 2019 - DHCP](/files/-M--HQNmwtrJoHEp75d_)

This concludes the DHCP installation and configuration on my DC server, let's configure the DNS server role. Click "**Next**" below or click "**DNS**" in the menu to the left.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.osdsune.com/home/archive/microsoft-configuration-manager/configmgr-lab/part-3/dhcp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
