How To Setup Active Directory and Domain Controller for Clients (Home Lab)

4 min read 1 month ago
Published on Aug 04, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

In this tutorial, you will learn how to set up an Active Directory home lab environment, configure a Domain Controller, and connect client computers to it. This guide is designed for anyone looking to build a virtual network using VirtualBox, whether for learning or testing purposes.

Step 1: Download Required Software

  1. Download and install VirtualBox from the official site.
  2. Download the ISO files for:

Step 2: Set Up the Client and Domain Controller

  1. Create the Client:

    • Open VirtualBox and create a new virtual machine (VM) for the Windows client.
    • Use the Windows 11 ISO for installation.
    • During installation, accept defaults and decline any unnecessary options such as targeted ads or Cortana.
    • After installation, go to Settings > Network and change Adapter 1 from NAT to Internal Network.
  2. Create the Domain Controller:

    • In VirtualBox, create a new VM for Windows Server.
    • Call it "DC" and select "Other Windows (64-bit)" for the version.
    • Allocate memory and proceed with the default settings.
    • Go to Settings > Network:
      • Adapter 1: Keep as NAT.
      • Adapter 2: Enable and set to Internal Network.
    • Double-click on the Domain Controller VM to start it and use the Windows Server ISO to install.

Step 3: Configure Windows Server

  1. Install Windows Server:

    • Select "Windows Server 2022 Standard Evaluation Desktop Experience" and complete the installation.
    • After installation, insert the Guest Additions CD image from the Devices menu.
    • Install Guest Additions for better performance.
  2. Rename the Server:

    • Right-click on the Start menu and go to System.
    • Rename the PC to "DC".
    • Restart the server to apply the changes.
  3. Set Static IP for Internal Network:

    • Go to Network > Change Adapter Options.
    • Right-click on the internal network adapter, select Properties.
    • Choose Internet Protocol Version 4 (TCP/IPv4) and set:
      • IP Address: 172.16.1.1
      • Subnet Mask: 255.255.255.0
      • Default Gateway: Leave blank
      • DNS Server: 127.0.0.1

Step 4: Install Active Directory and DHCP

  1. Add Roles and Features:

    • In Server Manager, click on Add Roles and Features.
    • Follow the prompts and select:
      • Active Directory Domain Services
      • DHCP Server
      • Routing and Remote Access
    • Complete the installation process.
  2. Promote the Server to a Domain Controller:

    • After installation, click on "Promote this server to a domain controller".
    • Choose "Add a new forest" and name it (e.g., mydomain.com).
    • Set a Directory Services Restore Mode password and complete the setup.

Step 5: Configure DHCP

  1. Set Up DHCP Scope:
    • Go to Tools > DHCP.
    • Right-click on IPv4 and select New Scope.
    • Set the scope range from 172.16.1.100 to 172.16.1.200 with a subnet mask of 255.255.255.0.
    • Configure the default gateway as the IP address of the Domain Controller (172.16.1.1).
    • Activate the scope and authorize the DHCP server.

Step 6: Create a User Account

  1. Add a New User:
    • Go to Tools > Active Directory Users and Computers.
    • Right-click on your domain and select New > User.
    • Enter a name (e.g., Cody Marshall) and set a username (e.g., A-CMarshall).
    • Set a password and uncheck "User must change password at next logon".
    • Add this user to the Domain Admins group.

Step 7: Connect the Client to the Domain

  1. Start the Client VM:

    • Boot up the client VM and log in with the generic account created during installation.
  2. Join Domain:

    • Right-click on the Start menu, go to System > Advanced system settings.
    • Click Change under the Computer Name tab.
    • Enter your domain name (e.g., mydomain.com) and provide the user credentials for the admin account created.
    • Restart the client.
  3. Verify Connection:

    • Log in using the newly created domain account.
    • Open Command Prompt and run ipconfig to confirm the client is receiving an IP from the DHCP server.

Step 8: Optional User Creation Script

  1. Download PowerShell Script:

    • Download the PowerShell script from your GitHub repository.
  2. Run the Script:

    • Open PowerShell ISE as Administrator.
    • Set the execution policy to unrestricted:
      Set-ExecutionPolicy Unrestricted
      
    • Run the script to create random users in Active Directory.

Conclusion

You have successfully set up an Active Directory home lab environment and connected a client to a Domain Controller. This setup allows you to practice administrative tasks and test configurations in a controlled environment. For further experimentation, consider exploring additional features of Windows Server or automating user management with PowerShell scripts.