Local Active Directory and GPO lab on KVM

· #homelab · #active-directory · #windows · #networking

Contents

Reading about Active Directory and Group Policy is very different from watching a GPO actually break connectivity on a domain-joined machine. I built a small three-VM Windows domain on KVM (DC01, WS01, and WS02) to practice everyday IT support and junior sysadmin tasks locally before touching a real company network.

Topology and domain setup

Each VM runs on libvirt/KVM with two network interfaces: a management interface (192.168.122.0/24) for SSH and updates, and an isolated lab network (10.10.10.0/24) with no DHCP where DC01 (10.10.10.5) acts as both domain controller and internal DNS server for corp.lab.internal.

After promoting Windows Server 2022 (DC01) and joining two Windows 11 Pro workstations (WS01 at 10.10.10.20, WS02 at 10.10.10.21), I set up a small repeatable baseline:

  • A Lab Users OU with four test accounts (j.smith, a.yilmaz, m.demir, and svc-backup).
  • A CORP\Helpdesk group added to the local Administrators group on both workstations.
  • A domain account lockout policy set to 5 failed attempts with a 15-minute lockout duration.
  • A PowerShell-scripted Lab - Advanced Audit Policy GPO linked at the domain root so endpoints log logon, account lockout, Kerberos, file share, and scheduled task events.

One detail that tripped me up early with Windows audit GPOs is that legacy audit categories silently override subcategory settings unless you force them off. Setting SCENoApplyLegacyAuditPolicy inside the same GPO fixed that:

Set-GPRegistryValue -Name "Lab - Advanced Audit Policy" `
  -Key "HKLM\System\CurrentControlSet\Control\Lsa" `
  -ValueName "SCENoApplyLegacyAuditPolicy" `
  -Type DWord -Value 1

Fixing the domain firewall block on WS02

Right after WS02 joined corp.lab.internal and rebooted, my SSH session stopped connecting and SMB checks to the isolated interface failed. Windows Firewall had switched from the Private profile to the Domain profile, where inbound OpenSSH (TCP 22) and SMB (TCP 445) were not allowed.

Rather than editing firewall rules by hand on every workstation, I created a domain-root GPO (Lab - Firewall (SSH, ICMP, SMB)) allowing inbound TCP 22 and ICMP for the lab KVM management subnet (192.168.122.0/24), plus inbound TCP 445 restricted to the isolated 10.10.10.0/24 subnet on the Domain profile. I also noticed plain ssh Administrator@... failed on WS02 because the local Administrator account is disabled by default; switching to administrator@corp.lab.internal resolved that cleanly.

Verification

On DC01, I confirmed the test accounts, GPO status, and lockout threshold:

Get-ADDefaultDomainPasswordPolicy |
  Format-List LockoutThreshold, LockoutDuration, LockoutObservationWindow

# LockoutThreshold         : 5
# LockoutDuration          : 00:15:00
# LockoutObservationWindow : 00:15:00

On WS02, gpresult, net localgroup, and Test-NetConnection confirmed both domain GPOs applied, CORP\Helpdesk held local admin access, and SMB reached DC01 over the isolated interface:

WS02 PowerShell verification of applied GPOs, Helpdesk membership, and SMB connectivity WS02 PowerShell verification of applied GPOs, Helpdesk membership, and SMB connectivity

Running auditpol /get /subcategory:"Logon","Account Lockout","Kerberos Authentication Service","File Share" on WS02 confirmed each subcategory reported Success or Success and Failure, giving me a clean baseline for log collection in the next lab.

← All writing