내결함성 Microsoft Active Directory 환경 배포


이 튜토리얼은 Google Cloud에 Microsoft Active Directory, SQL Server, 인터넷 정보 서비스(IIS)를 포함하는 가용성이 높은 Windows 환경을 배포하는 데 도움이 되는 시리즈 중 1부입니다. 이 튜토리얼에서는 새로운 Virtual Private Cloud(VPC) 네트워크와 여러 서브넷을 사용하여 Active Directory와 Windows 도메인 컨트롤러의 중복 쌍을 설정합니다.

이 시리즈는 다음 튜토리얼로 구성됩니다.

각 튜토리얼은 이전 튜토리얼에서 만든 인프라를 기반으로 합니다.

또한 이 튜토리얼을 사용하여 다른 아키텍처에서 사용할 Active Directory 구성을 설정하는 방법을 알아볼 수 있습니다. 이 튜토리얼에서는 원격 Active Directory 환경을 새 Google Cloud 기반 Active Directory 환경으로 복제하는 방법은 다루지 않지만 Cloud VPN 및 추가 Active Directory 구성에서는 이 작업을 수행할 수 있습니다.

아키텍처

Google Cloud의 내결함성 Active Directory 아키텍처

목표

  • 두 영역에 걸친 두 개의 서브넷이 있는 커스텀 모드 VPC 네트워크를 만듭니다.
  • Windows Server 가상 인스턴스를 만들고 Active Directory 도메인 서비스를 사용 설정합니다.
  • Active Directory를 사용하여 새 도메인을 구성합니다.
  • 새 Windows Server 인스턴스를 새 도메인에 조인합니다.
  • 방화벽 규칙을 구성하여 가상 머신으로 가는 트래픽을 허용합니다.
  • 구성을 테스트합니다.

비용

이 튜토리얼에서는 비용이 청구될 수 있는 다음과 같은 Google Cloud 구성요소를 사용합니다.

가격 계산기는 하루 약 $4로 이 환경의 비용을 예상합니다.

시작하기 전에

  1. Google Cloud Console의 프로젝트 선택기 페이지에서 Google Cloud 프로젝트를 선택하거나 만듭니다.

    프로젝트 선택기로 이동

  2. Google Cloud 프로젝트에 결제가 사용 설정되어 있는지 확인합니다.

  3. Compute Engine API 사용 설정

    API 사용 설정

공통 변수 초기화

인프라의 요소가 배포되는 위치를 제어하는 여러 환경 변수를 정의해야 합니다.

  1. Cloud Shell로 이동합니다.

    Cloud Shell 열기

  2. Cloud Shell에서 다음 환경 변수를 만들어 튜토리얼의 후반부에 필요한 값을 설정합니다.

    명령어는 리전을 us-east-1로 설정합니다. 다른 리전을 사용할 수 있지만 사용하는 리전을 기억해야 후속 튜토리얼에서 동일한 리전을 사용할 수 있습니다.

    export region=us-east1
    export zone_1=${region}-b
    export zone_2=${region}-c
    export vpc_name=webappnet
    export project_id=your-project-id
    

    your-project-id를 사용 중인 Google Cloud 프로젝트 ID로 바꿉니다.

  3. 모든 후속 명령어에서 해당 값을 지정할 필요가 없도록 다음 명령어를 실행하여 기본 리전 및 프로젝트 ID를 설정합니다.

    gcloud config set compute/region ${region}
    gcloud config set project ${project_id}
    

네트워크 인프라 만들기

인프라 변수를 정의했다면 Active Directory가 사용할 네트워크와 서브넷을 만들어야 합니다.

  1. Cloud Shell에서 다음 명령어를 실행하여 VPC 네트워크를 만듭니다.

    gcloud compute networks create ${vpc_name}  \
        --description "VPC network to deploy Active Directory" \
        --subnet-mode custom
    

    다음 경고가 표시되면 무시해도 됩니다. 이후 단계에서 이러한 방화벽 규칙을 만들기 때문입니다.

    Instances on this network will not be reachable until firewall rules
    are created.
    
  2. 두 개의 서브넷을 VPC 네트워크에 추가합니다.

    gcloud compute networks subnets create private-ad-zone-1 \
        --network ${vpc_name} \
        --range 10.1.0.0/24
    
    gcloud compute networks subnets create private-ad-zone-2 \
        --network ${vpc_name} \
        --range 10.2.0.0/24
    
  3. 서브넷 간 트래픽을 허용하기 위한 내부 방화벽 규칙을 만듭니다.

    gcloud compute firewall-rules create allow-internal-ports-private-ad \
        --network ${vpc_name} \
        --allow tcp:1-65535,udp:1-65535,icmp \
        --source-ranges  10.1.0.0/24,10.2.0.0/24
    
  4. 모든 위치에서 포트 3389로 RDP 연결을 허용하도록 방화벽 규칙을 만듭니다.

    gcloud compute firewall-rules create allow-rdp \
        --network ${vpc_name} \
        --allow tcp:3389 \
        --source-ranges 0.0.0.0/0
    

첫 번째 도메인 컨트롤러 만들기

다음으로 다음 속성이 있는 도메인 컨트롤러를 만듭니다.

  • 이름: ad-dc1
  • IP 주소: 10.1.0.100
  1. 첫 번째 도메인 컨트롤러로 사용할 Windows Server 2016의 Compute Engine 인스턴스를 만듭니다.

    gcloud compute instances create ad-dc1 --machine-type n1-standard-2 \
        --boot-disk-type pd-ssd \
        --boot-disk-size 50GB \
        --image-family windows-2016 --image-project windows-cloud \
        --network ${vpc_name} \
        --zone ${zone_1} --subnet private-ad-zone-1 \
        --private-network-ip=10.1.0.100
    
  2. 1분 정도 기다린 후 Windows 인스턴스 ad-dc1의 비밀번호를 만듭니다.

    gcloud compute reset-windows-password ad-dc1 --zone ${zone_1} --quiet
    

    사용자 이름은 Google 계정 사용자 이름입니다. 나중에 사용할 수 있도록 사용자 이름과 비밀번호를 기록해 둡니다.

  3. RDP를 사용하여 이전 단계에서 만든 사용자 인증 정보로 도메인 컨트롤러 인스턴스에 연결합니다.

  4. 관리자로 PowerShell 터미널을 엽니다. 시작을 클릭하고 PowerShell을 입력한 다음 Shift+Ctrl+Enter를 누릅니다.

  5. 관리자 계정의 Windows 사용자 인증 정보를 설정합니다.

    net user Administrator *
    

    비밀번호를 만들라는 메시지가 표시됩니다. 안전한 비밀번호를 사용하고, 나중에 사용할 수 있도록 안전한 위치에 비밀번호를 저장합니다.

    Active Directory 포레스트를 만들면 관리자 계정은 도메인 관리자 계정이 됩니다.

  6. 계정을 사용 설정합니다.

    net user Administrator /active:yes
    
  7. 관리 도구를 포함하여 Active Directory Domain Services를 설치합니다.

    Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools
    
  8. 다음 변수를 설정합니다.

    $DomainName = "example-gcp.com"
    $DomainMode = "7"
    $ForestMode = "7"
    $DatabasePath = "C:\Windows\NTDS"
    $SysvolPath = "C:\Windows\SYSVOL"
    $LogPath = "C:\Logs"
    
  9. 새 Active Directory 포리스트 구성을 Windows Server 2016 모드로 설치합니다.

    Install-ADDSForest -CreateDnsDelegation:$false `
        -DatabasePath $DatabasePath `
        -LogPath $LogPath `
        -SysvolPath $SysvolPath `
        -DomainName $DomainName `
        -DomainMode $DomainMode `
        -ForestMode $ForestMode `
        -InstallDNS:$true `
        -NoRebootOnCompletion:$true `
        -Force:$true
    
  10. 메시지가 표시되면 안전 모드 관리자 비밀번호를 입력합니다. 나중에 사용할 수 있도록 안전한 위치에 비밀번호를 저장합니다.

  11. 다음 경고를 닫습니다. 각 경고는 두 번 표시됩니다. 첫 번째는 선행 조건 확인 중에, 두 번째는 설치 프로세스 중에 표시됩니다.

    WARNING: Windows Server 2016 domain controllers have a default for the
    security setting named Allow cryptography algorithms compatible with
    Windows NT 4.0 that prevents weaker cryptography algorithms when
    establishing security channel sessions.
    For more information about this setting, see Knowledge Base article 942564 (http://go.microsoft.com/fwlink/?LinkId=104751).
    WARNING: This computer has at least one physical network adapter that does
    not have static IP address(es) assigned to its IP Properties. If both IPv4
    and IPv6 are enabled for a network adapter, both IPv4 and IPv6 static IP
    addresses should be assigned to both IPv4 and IPv6 Properties of the
    physical network adapter. Such static IP address(es) assignment should be
    done to all the physical network adapters for reliable Domain Name
    System (DNS) operation.
    
    WARNING: A delegation for this DNS server cannot be created because the
    authoritative parent zone cannot be found or it does not run Windows DNS
    server. If you are integrating with an existing DNS infrastructure, you
    should manually create a delegation to this DNS server in the parent zone
    to ensure reliable name resolution from outside the domain "example-gcp.com".
    Otherwise, no action is required.
    
  12. 가상 머신을 다시 시작합니다.

    Restart-Computer
    
  13. Active Directory 포레스트 설치 중에 정의한 관리자 사용자 인증 정보를 사용하여 RDP를 통해 도메인 컨트롤러 ad-dc1에 연결합니다. EXAMPLE-GCP\Administrator와 같이 도메인 이름을 프리픽스로 추가해야합니다.

  14. 관리자로 PowerShell 터미널을 엽니다.

  15. 다음 변수를 설정합니다.

    $DNSPrimary = "10.2.0.100"
    $DNSSecondary = "127.0.0.1"
    $LocalStaticIp = "10.1.0.100"
    $DefaultGateway = "10.1.0.1"
    
  16. IP 주소와 기본 게이트웨이를 설정합니다.

    netsh interface ip set address name=Ethernet static `
        $LocalStaticIp 255.255.255.0 $DefaultGateway 1
    
  17. 기본 DNS 서버를 구성합니다.

    netsh interface ip set dns Ethernet static $DNSPrimary
    

    DNS 서버 ad-dc2는 두 번째 도메인 컨트롤러가 배포된 후에만 사용할 수 있으므로 다음 오류 메시지는 무시해도 됩니다.

    The configured DNS server is incorrect or does not exist.
  18. 보조 DNS 서버를 구성합니다.

    netsh interface ip add dns Ethernet $DNSSecondary index=2
    

    Active Directory와 다른 컨트롤러의 연결이 자주 끊기지 않도록 이 도메인 컨트롤러 ad-dc1의 DNS 서버 항목이 목록에서 두 번째여야 합니다. 두 번째 도메인 컨트롤러 ad-dc2를 기본 DNS 서버로 사용합니다. 다음 섹션에서 ad-dc2 도메인 컨트롤러를 만듭니다. 이 패턴을 따르지 않을 경우 서버 관리자 > Active Directory 도메인 서비스 아래에 다음 오류가 표시됩니다.

    The DFS Replication service failed to update configuration in Active
    Directory Domain Services. The service will retry this operation
    periodically.
    

    두 서버가 완전히 구성되기 전에 ad-dc1 서버에 오류가 표시될 수 있습니다. 이러한 오류는 무시해도 됩니다.

두 번째 도메인 컨트롤러 만들기

다음으로 내결함성을 제공하기 위해 다른 영역에 두 번째 도메인 컨트롤러를 만듭니다. 두 번째 도메인 컨트롤러에는 다음과 같은 속성이 있습니다.

  • 이름: ad-dc2
  • IP 주소: 10.2.0.100
  1. Cloud Shell 창이 만료된 경우 새 Cloud Shell 인스턴스를 열고 앞서 설정한 변수를 재설정합니다. 이렇게 하려면 다음 스크립트를 수정하여 이전에 사용한 프로젝트 ID와 리전을 지정합니다.

    region=us-east1
    zone_2=${region}-c
    zone_1=${region}-b
    vpc_name=webappnet
    project_id=your-project-id
    
    gcloud config set compute/region ${region}
    gcloud config set project ${project_id}
    

    your-project-id를 사용 중인 Google Cloud 프로젝트 ID로 바꿉니다.

  2. 스크립트를 Cloud Shell 창에 복사하고 실행합니다.

  3. Cloud Shell을 사용하여 두 번째 도메인 컨트롤러 인스턴스를 만듭니다.

    gcloud compute instances create ad-dc2 --machine-type n1-standard-2 \
        --boot-disk-size 50GB \
        --boot-disk-type pd-ssd \
        --image-family windows-2016 --image-project windows-cloud \
        --can-ip-forward \
        --network ${vpc_name} \
        --zone ${zone_2} \
        --subnet private-ad-zone-2 \
        --private-network-ip=10.2.0.100
    
  4. 1분 정도 기다린 후 Windows 인스턴스 ad-dc2의 비밀번호를 만듭니다.

    gcloud compute reset-windows-password ad-dc2 --zone ${zone_2} --quiet
    

    사용자 이름은 Google 계정 사용자 이름입니다. 나중에 사용할 수 있도록 사용자 이름과 비밀번호를 기록해 둡니다.

  5. RDP를 사용하여 이전 단계에서 만든 사용자 인증 정보로 도메인 컨트롤러 인스턴스에 연결합니다.

  6. 관리자로 PowerShell 터미널을 엽니다.

  7. 관리 도구를 포함하여 Active Directory Domain Services를 설치합니다.

    Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools
    
  8. 다음 변수를 설정합니다.

    $DomainName = "example-gcp.com"
    $DomainPrefix = "EXAMPLE-GCP"
    $DNSPrimary = "10.1.0.100"
    $DNSSecondary = "127.0.0.1"
    $LocalStaticIp = "10.2.0.100"
    $DefaultGateway = "10.2.0.1"
    $DatabasePath = "C:\Windows\NTDS"
    $SysvolPath = "C:\Windows\SYSVOL"
    $LogPath = "C:\Logs"
    
  9. 기본 DNS 서버를 구성합니다.

    netsh interface ip set dns Ethernet static $DNSPrimary
    
  10. 자체 보조 DNS 서버 역할을 하도록 두 번째 서버를 구성합니다.

    netsh interface ip add dns Ethernet $DNSSecondary index=2
    

    ad-dc2 DNS 서버는 ad-dc2가 도메인 컨트롤러로 도메인에 조인한 이후에만 사용할 수 있습니다. 서버가 아직 조인하지 않았으므로 다음 메시지가 표시되지만 무시해도 됩니다.

    The configured DNS server is incorrect or does not exist.
  11. IP 주소와 기본 게이트웨이를 설정합니다.

    netsh interface ip set address name=Ethernet static `
        $LocalStaticIp 255.255.255.0 $DefaultGateway 1
    
  12. 다음 PowerShell 스크립트를 실행합니다. 이 스크립트는 첫 번째 도메인 컨트롤러가 작동할 때 이를 사용자에게 알려줍니다. Domain controller is reachable 메시지가 표시될 때까지 기다립니다.

    $DomainIsReady=$False
    For ($i=0; $i -le 30; $i++) {
        nltest /dsgetdc:$DomainName
        if($LASTEXITCODE -ne 0) {
            Write-Host "Domain not ready, wait 1 more minute, then retry"
            Start-Sleep -s 60
        }
        else {
            $DomainIsReady=$True
            Write-Host "Domain controller is reachable"
            break
        }
    }
    if($DomainIsReady -eq $False) {
        Write-Host "Domain not ready. Check if it was deployed ok"
    }
    
  13. 가상 머신을 두 번째 도메인 컨트롤러로 포레스트에 추가합니다.

    Install-ADDSDomainController `
        -Credential (Get-Credential "$DomainPrefix\Administrator") `
        -CreateDnsDelegation:$false `
        -DatabasePath $DatabasePath `
        -DomainName $DomainName `
        -InstallDns:$true `
        -LogPath $LogPath `
        -SysvolPath $SysvolPath `
        -NoGlobalCatalog:$false `
        -SiteName 'Default-First-Site-Name' `
        -NoRebootOnCompletion:$true `
        -Force:$true
    
  14. 관리자 계정의 비밀번호를 입력하라는 메시지가 표시되면 Active Directory 포레스트 설치 중에 정의한 관리자 사용자 인증 정보를 사용합니다. EXAMPLE-GCP\Administrator와 같이 도메인 이름을 프리픽스로 추가합니다.

  15. 안전 모드 관리자 비밀번호를 입력하라는 메시지가 표시되면 첫 번째 도메인 컨트롤러에서 사용한 것과 동일한 비밀번호를 사용합니다.

  16. 다음 경고를 무시합니다. 각 경고는 두 번 표시됩니다. 첫 번째는 선행 조건 확인 중에, 두 번째는 설치 프로세스 중에 표시됩니다.

    WARNING: Windows Server 2016 domain controllers have a default for the
    security setting named "Allow cryptography algorithms compatible with
    Windows NT 4.0" that prevents weaker cryptography algorithms when
    establishing security channel sessions.
    For more information about this setting, see Knowledge Base article 942564 (http://go.microsoft.com/fwlink/?LinkId=104751).
    WARNING: A delegation for this DNS server cannot be created because the
    authoritative parent zone cannot be found or it does not run Windows DNS
    server. If you are integrating with an existing DNS infrastructure, you
    should manually create a delegation to this DNS server in the parent zone
    to ensure reliable name resolution from outside the domain
    "example-gcp.com". Otherwise, no action is required.
    
  17. 가상 머신을 다시 시작합니다.

    Restart-Computer
    

설치 테스트

  1. 5~10분 정도 기다려 두 도메인 컨트롤러가 모두 작동하고 정보를 복제하고 있는지 확인합니다.

  2. 첫 번째 도메인 컨트롤러 설치 중에 정의한 관리자 사용자 인증 정보를 사용하여 RDP를 통해 첫 번째 도메인 컨트롤러 인스턴스에 연결합니다. EXAMPLE-GCP\Administrator와 같이 도메인 이름을 프리픽스로 추가합니다.

  3. 관리자로 PowerShell 터미널을 엽니다.

  4. 복제본이 작동하는지 테스트합니다.

    repadmin /replsum
    

    출력은 오류 또는 실패 없이 다음과 비슷해야 합니다.

    복제 테스트 결과, 표시되는 실패 없음

    도메인 컨트롤러를 사용할 수 없는 경우 다음과 같은 메시지가 표시됩니다.

    Beginning data collection for replication summary, this may take awhile:
    .... Source DSA largest delta fails/total %% error
    Destination DSA largest delta fails/total %% error

    이 메시지가 표시되는 경우 몇 분 동안 기다린 다음 명령어를 다시 시도하세요.

삭제

이 시리즈의 다음 튜토리얼(멀티 서브넷 SQL Server 배포)을 계속 진행하려면 이 튜토리얼에서 만든 리소스를 유지합니다. 하지만 이 튜토리얼에서 만든 Active Directory 환경을 사용하지 않으려면 Google Cloud에서 만든 리소스를 삭제하여 비용이 청구되지 않도록 해야 합니다. 다음 섹션은 이러한 리소스를 삭제하거나 사용 중지하는 방법을 설명합니다.

프로젝트 삭제

비용이 청구되지 않도록 하는 가장 쉬운 방법은 튜토리얼에서 만든 프로젝트를 삭제하는 것입니다.

프로젝트를 삭제하려면 다음 안내를 따르세요.

  1. Google Cloud 콘솔에서 리소스 관리 페이지로 이동합니다.

    리소스 관리로 이동

  2. 프로젝트 목록에서 삭제할 프로젝트를 선택하고 삭제를 클릭합니다.
  3. 대화상자에서 프로젝트 ID를 입력한 후 종료를 클릭하여 프로젝트를 삭제합니다.

인스턴스 삭제

Compute Engine 인스턴스를 삭제하려면 다음 안내를 따르세요.

  1. Google Cloud 콘솔에서 VM 인스턴스 페이지로 이동합니다.

    VM 인스턴스로 이동

  2. 삭제할 인스턴스.
  3. 인스턴스를 삭제하려면 추가 작업을 클릭하고, 삭제를 클릭한 후 안내를 따르세요.

VPC 네트워크 삭제

VPC 네트워크, 서브넷, 방화벽 규칙을 삭제하는 방법은 다음과 같습니다.

  1. Google Cloud console에서 VPC 네트워크 페이지로 이동합니다.

    VPC 네트워크 페이지로 이동

  2. 만든 VPC 네트워크를 선택합니다.

  3. 페이지 상단의 삭제 버튼을 클릭합니다.

다음 단계