Configuring DHCP (Dynamic Host Configuration Protocol) on a Windows Server allows for the automatic assignment of IP addresses and network configurations to client devices within your network. This guide will walk you through setting up a Windows Server as a DHCP server and configuring a DHCP relay agent. ## 1. Windows Server as a DHCP Server Setting up a Windows Server as a DHCP server enables it to distribute IP addresses and other network settings to clients automatically. ### Prerequisites: - A Windows Server installed and connected to the network. - Administrative privileges on the server. - Static IP address assigned to the server. ### Configuration Steps: **a. Install the DHCP Server Role** 1. **Open Server Manager**: - Click on the **Start** menu, and select **Server Manager**. 2. **Add Roles and Features**: - In Server Manager, click on **Manage** > **Add Roles and Features**. 3. **Role-Based or Feature-Based Installation**: - Choose **Role-based or feature-based installation** and click **Next**. 4. **Select the Server**: - Choose the server you want to install the DHCP role on and click **Next**. 5. **Select Server Roles**: - Check **DHCP Server** and click **Next**. 6. **Add Features**: - If prompted, click **Add Features** to include required features. 7. **Confirm Selections and Install**: - Proceed through the prompts and click **Install**. Wait for the installation to complete. 8. **Complete DHCP Configuration**: - After installation, click on **Complete DHCP configuration** in the notification area. 9. **Authorize the DHCP Server**: - Follow the wizard to authorize the DHCP server in Active Directory (requires domain admin credentials). **b. Create a New DHCP Scope** A scope defines the range of IP addresses the server can assign to clients. 1. **Open DHCP Management Console**: - Go to **Tools** > **DHCP** in Server Manager. 2. **Create a New Scope**: - Right-click on **IPv4** and select **New Scope**. 3. **New Scope Wizard**: - Click **Next** to start the wizard. 4. **Scope Name and Description**: - Provide a name and description for the scope, then click **Next**. 5. **IP Address Range**: - Enter the **Start IP address** and **End IP address** for the scope. - Define the **Subnet Mask**. - Click **Next**. 6. **Add Exclusions and Delays**: - Specify any IP addresses or ranges to exclude from the scope (e.g., for servers or printers with static IPs). - Click **Next**. 7. **Lease Duration**: - Set the lease duration for IP address assignments. - Default is usually 8 days. - Click **Next**. 8. **Configure DHCP Options**: - Choose **Yes, I want to configure these options now**. - Click **Next**. **c. Configure DHCP Options** These options provide clients with additional network information. 1. **Router (Default Gateway)**: - Enter the IP address of the default gateway (typically your router). - Click **Add**, then **Next**. 2. **Domain Name and DNS Servers**: - Enter your **parent domain** name. - Add the IP addresses of your DNS servers. - Click **Next**. 3. **WINS Servers (if applicable)**: - If using WINS, enter the IP addresses of your WINS servers. - Otherwise, click **Next**. 4. **Activate Scope**: - Choose **Yes, I want to activate this scope now**. - Click **Next**, then **Finish**. **d. Verification** - **Check Scope Activation**: - In the DHCP console, ensure the new scope is active and has a green checkmark. - **Monitor Address Leases**: - Click on **Address Leases** under your scope to view assigned IP addresses. - **Test with a Client Device**: - Connect a client device to the network and verify it receives an IP address from the DHCP server. ## 2. Windows Server as a DHCP Client While less common, a Windows Server can be configured to obtain its IP address via DHCP. ### Configuration Steps: **a. Open Network Connections** - Go to **Control Panel** > **Network and Sharing Center** > **Change adapter settings**. **b. Configure the Network Adapter** 1. **Right-click** on the network adapter and select **Properties**. 2. **Internet Protocol Version 4 (TCP/IPv4)**: - Select this option and click **Properties**. 3. **Obtain an IP Address Automatically**: - Choose **Obtain an IP address automatically**. 4. **Obtain DNS Server Address Automatically**: - Choose **Obtain DNS server address automatically**. 5. **Apply Settings**: - Click **OK** to apply the settings. **c. Verification** - **Check IP Address**: - Open Command Prompt and run: ```shell ipconfig /all ``` - Verify that the server has received an IP address from a DHCP server. ## 3. Windows Server as a DHCP Relay Agent A DHCP Relay Agent forwards DHCP requests from clients on one subnet to a DHCP server on another subnet. ### Prerequisites: - Routing and Remote Access Service (RRAS) installed and configured. ### Configuration Steps: **a. Install Routing and Remote Access** 1. **Open Server Manager**: - Click on **Start**, then **Server Manager**. 2. **Add Roles and Features**: - Click on **Manage** > **Add Roles and Features**. 3. **Select Network Policy and Access Services**: - In the **Server Roles** list, check **Remote Access**. - Click **Next** until you reach **Role Services**. 4. **Select Role Services**: - Check **Routing**. - Click **Next**, then **Install**. **b. Configure RRAS as a DHCP Relay Agent** 1. **Open Routing and Remote Access Console**: - Go to **Tools** > **Routing and Remote Access**. 2. **Enable RRAS**: - Right-click on the server name and select **Configure and Enable Routing and Remote Access**. - Use the wizard to enable **Custom configuration** and select **LAN routing**. 3. **Add DHCP Relay Agent** - Expand **IPv4**. - Right-click on **General** and select **New Routing Protocol**. - Choose **DHCP Relay Agent** and click **OK**. 4. **Configure DHCP Relay Agent** - Right-click on **DHCP Relay Agent** under **IPv4** and select **Properties**. - **Server Addresses**: Add the IP address of the DHCP server. - Click **OK**. 5. **Add Network Interfaces** - Right-click on **DHCP Relay Agent** and select **New Interface**. - Choose the interface connected to the subnet with client devices. - Configure the interface properties as needed (default settings usually suffice). **c. Verification** - **Monitor DHCP Relay Activity**: - Use Event Viewer to check for any DHCP relay-related events. - **Test with a Client Device**: - Connect a client device on the subnet and verify it receives an IP address from the DHCP server. ## Conclusion Configuring DHCP on a Windows Server simplifies network management by automating IP address assignments and network configurations for client devices. Whether setting up the server to distribute IP addresses, configuring it to receive an IP address automatically, or setting it up as a relay agent, these steps help ensure efficient network operations. **Note**: Always ensure your server's firewall settings allow DHCP traffic and that you have the necessary permissions to make these changes.