Setting Up a Home Lab with Active Directory: A Step-by-Step Guide
In today's digital age, understanding the intricacies of Active Directory and Windows networking is paramount for IT professionals. Whether you're a seasoned expert or a beginner looking to dive into the world of networking, setting up a home lab can provide invaluable hands-on experience. In this guide, we'll walk you through the process of creating a basic home lab running Active Directory using Oracle VirtualBox.
1. Introduction to Active Directory
Active Directory (AD) is a directory service developed by Microsoft for Windows domain networks. It provides a variety of network services, including LDAP, Kerberos-based authentication, and DNS-based naming. With AD, administrators can manage user data, security, and distributed resources, and enable interoperation with other directories.
2. Tools of the Trade
Before diving in, ensure you have the necessary tools:
Oracle VirtualBox: A powerful x86 and AMD64/Intel64 virtualization product.
Windows 10 ISO & Server 2019 ISO: Operating systems for our virtual machines.
PowerShell: A task automation and configuration management framework.
3. Setting the Stage with Oracle VirtualBox
Begin by downloading and installing Oracle VirtualBox. This software will serve as the foundation, allowing us to run multiple virtual machines (VMs) on our personal computers.
4. Crafting the Domain Controller
The domain controller is the cornerstone of our setup. Here's how to create one:
Set up a VM within VirtualBox.
Equip the VM with two network adapters: one for external internet access and another for the private VirtualBox network.
Install Server 2019 on this VM.
Configure IP addressing for the internal network. The external network will fetch IP details from your home router.
5. Breathing Life into Active Directory
With our domain controller VM ready, it's time to:
Install Active Directory.
Create a domain, which will serve as the central hub for our network resources.
6. Networking Nuances
For our setup to function seamlessly, we need to:
Set up Network Address Translation (NAT) and routing, allowing private network clients to access the internet via the domain controller.
Configure DHCP on the domain controller for automatic IP assignment.
7. Power of PowerShell
Automation is the key to efficiency. Using a PowerShell script, we'll:
Automatically create a thousand users within Active Directory.
Understand the script's components, showcasing the versatility of PowerShell.
$PASSWORD_FOR_USERS = "Password1" $USER_FIRST_LAST_LIST = Get-Content .\names.txt $password = ConvertTo-SecureString $PASSWORD_FOR_USERS -AsPlainText -Force New-ADOrganizationalUnit -Name _USERS -ProtectedFromAccidentalDeletion $false foreach ($n in $USER_FIRST_LAST_LIST) { $first = $n.Split(" ")[0].ToLower() $last = $n.Split(" ")[1].ToLower() $username = "$($first.Substring(0,1))$($last)".ToLower() Write-Host "Creating user: $($username)" -BackgroundColor Black -ForegroundColor Cyan New-AdUser -AccountPassword $password ` -GivenName $first ` -Surname $last ` -DisplayName $username ` -Name $username ` -EmployeeID $username ` -PasswordNeverExpires $true ` -Path "ou=_USERS,$(([ADSI]`"").distinguishedName)" ` -Enabled $true }
8. Introducing the Client Machine
Our network wouldn't be complete without client machines. Let's:
Create a new VM and install Windows 10.
Connect this VM (named "client1") to the private VirtualBox network.
Join "client1" to our domain and access it using one of the user accounts we created.
9. Wrapping Up
Setting up a home lab with Active Directory might seem daunting, but with the right tools and guidance, it's a rewarding endeavor. Not only does it bolster your understanding of Windows networking, but it also provides a sandbox environment to test, break, fix, and learn.
Subscribe to my newsletter
Read articles from Vinayak Naveen directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by