이 자습서에서는 Windows 클라이언트 디바이스에서 Always On VPN 연결을 만드는 방법을 보여 줍니다. 샘플 환경에서 Always On VPN을 배포하는 시리즈를 계속합니다. 이전에 시리즈에서 는 샘플 인프라를 배포 하고 인증 기관 템플릿을 구성했습니다.
이 자습서에서는 다음을 수행합니다.
- Always On VPN 연결에 대한 템플릿으로 사용되는 수동 사용자 VPN 연결을 만들고 테스트합니다.
- PowerShell을 사용하여 수동 VPN 연결을 Always On VPN 연결로 변환합니다.
Always On VPN 연결은 디바이스 터널 또는 사용자 터널로 구성할 수 있습니다.
디바이스 터널: 사용자가 디바이스에 로그인하기 전에 지정된 VPN 서버에 연결합니다. 디바이스 터널은 사전 로그인 연결 시나리오 및 디바이스 관리 목적으로 사용됩니다.
사용자 터널: 사용자가 디바이스에 로그온한 후에만 연결됩니다. 사용자 터널을 사용하면 사용자가 VPN 서버를 통해 조직 리소스에 액세스할 수 있습니다.
디바이스 터널과 사용자 터널 간의 차이점에 대한 자세한 내용은 Windows 클라이언트에서 VPN 디바이스 터널 구성을 참조하세요.
디바이스 터널이든 사용자 터널이든 Always On VPN 연결은 VPNv2 CSP(구성 서비스 공급자)의 ProfileXML 노드를 사용하여 구성됩니다. 이 자습서의 단계에서는 단일 Windows 클라이언트 디바이스에서 사용자 터널을 구성하는 방법을 보여 줍니다. 이러한 단계는 소규모 환경이나 테스트 목적으로 사용할 수 있습니다.
더 큰 환경의 경우 Microsoft Intune 또는 Microsoft Configuration Manager를 사용하여 Always On VPN 프로필을 Windows 클라이언트 디바이스에 배포해야 합니다. 자세한 내용은 Microsoft Intune을 사용하여 Windows 클라이언트에 Always On VPN 프로필 배포 및 MicrosoftConfiguration Manager를 사용하여 Windows 클라이언트에 Always On VPN 프로필 배포를 참조하세요.
필수 조건
이 자습서를 완료하려면 다음이 필요합니다.
이전 자습서의 모든 단계를 완료하려면 다음을 수행합니다.
VPN 연결을 테스트하는 데 사용할 유효한 사용자 인증서가 설치된 이전 자습서의 Windows 클라이언트 디바이스입니다.
수동 사용자 VPN 연결 만들기 및 테스트
먼저 VPN 테스트 클라이언트가 성공적인 VPN 연결을 설정할 수 있는지 확인하기 위해 VPN 클라이언트 연결을 만들어야 합니다. 이 연결을 사용하면 Always On VPN 연결에 사용할 EAP(확장 가능 인증 프로토콜) 설정을 만들 수도 있습니다. EAP 설정에 대한 자세한 내용은 EAP 구성을 참조하세요.
이전에 Active Directory 만들기 테스트 사용자에서 만든 VPN 사용자로 도메인에 가입된 Windows 클라이언트 디바이스에 로그인합니다.
시작 메뉴에서 VPN 을 입력하여 VPN 설정을 선택합니다. ENTER 키를 누릅니다.
세부 정보 창에서 VPN 연결 추가를 선택합니다.
VPN 공급자의 경우 Windows(기본 제공)를 선택합니다.
연결 이름에 Contoso VPN을 입력합니다.
서버 이름 또는 주소의 경우 VPN 서버의 외부 FQDN(정규화된 도메인 이름)을 입력합니다(예:
vpn.contoso.com
).VPN 형식의 경우 IKEv2를 선택합니다.
로그인 정보 유형에 대해 인증서를 선택합니다.
저장을 선택합니다.
관련 설정에서 어댑터 변경 옵션을 선택합니다.
Contoso VPN을 마우스 오른쪽 단추로 클릭하고 속성을 선택합니다.
보안 탭에서 데이터 암호화에 대해 최대 강도 암호화를 선택합니다.
EAP(확장 가능 인증 프로토콜) 사용을 선택합니다. 그런 다음 EAP(확장 가능 인증 프로토콜) 사용에 대해 Microsoft: PEAP(보호된 EAP)(암호화 사용)를 선택합니다.
속성을 선택하여 보호된 EAP 속성을 열고 다음 단계를 완료합니다.
이러한 서버에 연결하려면 NPS 서버의 호스트 이름을 입력합니다.
신뢰할 수 있는 루트 인증 기관의 경우 NPS 서버의 인증서를 발급한 CA(예:
contoso-CA
)를 선택합니다.연결하기 전에 알림의 경우 사용자에게 새 서버 또는 신뢰할 수 있는 CA에 권한을 부여하도록 요청하지 않음을 선택합니다.
인증 방법 선택에서스마트 카드 또는 기타 인증서를 선택합니다.
구성을 선택합니다.
이 컴퓨터에서 인증서 사용을 선택합니다.
이러한 서버에 연결하려면 NPS 서버의 호스트 이름을 입력합니다.
신뢰할 수 있는 루트 인증 기관의 경우 NPS 서버의 인증서를 발급한 CA를 선택합니다.
사용자에게 새 서버 또는 신뢰할 수 있는 인증 기관에 권한을 부여하라는 메시지를 표시하지 않음을 선택합니다.
확인을 선택하여 스마트 카드 또는 기타 인증서 속성을 닫습니다.
확인을 선택하여 보호된 EAP 속성을 닫습니다.
확인을 선택하여 Contoso VPN 속성을 닫습니다.
네트워크 연결 창을 닫습니다.
설정에서 Contoso VPN을 선택한 다음, 연결을 선택합니다. VPN 연결을 성공적으로 설정해야 합니다. 네트워크 연결 창을 확인하여 연결을 확인할 수 있습니다 . Contoso VPN 연결은 연결된 것으로 표시되어야 합니다. VPN 터널의 다른 쪽에 있는 리소스(예: 파일 공유 또는 웹 서버)에 연결할 수 있는지 테스트합니다.
VPN 연결이 성공했는지 확인한 후 VPN 연결에서 연결을 끊습니다.
중요한
VPN 서버에 대한 템플릿 VPN 연결이 성공했는지를 확인합니다. 이렇게 하면 다음 섹션에서 EAP 설정을 사용하기 전에 EAP 설정이 올바른지 확인할 수 있습니다. 계속하기 전에 한 번 이상 연결해야 합니다. 그렇지 않으면 프로필에 VPN에 연결하는 데 필요한 모든 정보가 포함되지 않습니다.
수동 VPN 연결을 Always On VPN 연결로 변환
다음으로 PowerShell 스크립트를 사용하여 수동 VPN 연결을 Always On VPN 연결로 변환합니다.
Windows 클라이언트 디바이스의 동일한 사용자와 마찬가지로 관리자 권한으로 엽니다
Windows PowerShell ISE
.다음 PowerShell 스크립트를
Windows PowerShell ISE
편집기 창에 복사해 붙여넣은 다음, 반드시 변수 8개의 값을 본인에 맞게 변경해야 합니다.PowerShell 스크립트를 표시하려면 이 섹션을 확장합니다.
# Set the variables for the VPN profile. $domain = 'corp' # Name of the domain. $templateName = 'Contoso VPN' # Name of the test VPN connection you created in the tutorial. $profileName = 'Contoso AlwaysOn VPN' # Name of the profile we are going to create. $servers = 'aov-vpn.contoso.com' # Public or routable IP address or DNS name for the VPN gateway. $dnsSuffix = 'corp.contoso.com' # Specifies one or more commas separated DNS suffixes. $domainName = '.corp.contoso.com' # Used to indicate the namespace to which the policy applies. Contains `.` prefix. $dnsServers = '10.10.0.6' # List of comma-separated DNS Server IP addresses to use for the namespace. $trustedNetwork = 'corp.contoso.com' # Comma-separated string to identify the trusted network. # Get the EAP settings for the current profile called $templateName $connection = Get-VpnConnection -Name $templateName if(!$connection) { $message = "Unable to get $templateName connection profile: $_" Write-Host "$message" exit } $EAPSettings= $connection.EapConfigXmlStream.InnerXml $profileNameEscaped = $profileName -replace ' ', '%20' # Define ProfileXML $profileXML = @(" <VPNProfile> <DnsSuffix>$dnsSuffix</DnsSuffix> <NativeProfile> <Servers>$servers</Servers> <NativeProtocolType>IKEv2</NativeProtocolType> <Authentication> <UserMethod>Eap</UserMethod> <Eap> <Configuration> $EAPSettings </Configuration> </Eap> </Authentication> <RoutingPolicyType>SplitTunnel</RoutingPolicyType> </NativeProfile> <AlwaysOn>true</AlwaysOn> <RememberCredentials>true</RememberCredentials> <TrustedNetworkDetection>$trustedNetwork</TrustedNetworkDetection> <DomainNameInformation> <DomainName>$domainName</DomainName> <DnsServers>$dnsServers</DnsServers> </DomainNameInformation> </VPNProfile> ") # Output the XML for possible use in Intune $profileXML | Out-File -FilePath ($env:USERPROFILE + '\desktop\VPN_Profile.xml') # Escape special characters in the profile (<,>,") $profileXML = $profileXML -replace '<', '<' $profileXML = $profileXML -replace '>', '>' $profileXML = $profileXML -replace '"', '"' # Define WMI-to-CSP Bridge properties $nodeCSPURI = "./Vendor/MSFT/VPNv2" $namespaceName = "root\cimv2\mdm\dmmap" $className = "MDM_VPNv2_01" try { # Determine user SID for VPN profile. $WmiLoggedOnUsers = (Get-WmiObject Win32_LoggedOnUser).Antecedent If($WmiLoggedOnUsers.Count -gt 1) { $WmiLoggedOnUsers = $WmiLoggedOnUsers -match "Domain=""$domain""" } $WmiUserValid = ($WmiLoggedOnUsers | Select-Object -Unique -First 1) -match 'Domain="([^"]+)",Name="([^"]+)"' If(-not $WmiUserValid){ Throw "Returned object is not a valid WMI string" } $UserName = "$($Matches[1])\$($Matches[2])" $ObjUser = New-Object System.Security.Principal.NTAccount($UserName) $Sid = $ObjUser.Translate([System.Security.Principal.SecurityIdentifier]) $SidValue = $Sid.Value $message = "User SID is $SidValue." Write-Host "$message" } catch [Exception] { $message = "Unable to get user SID. $_" Write-Host "$message" exit } try { # Define WMI session. $session = New-CimSession $options = New-Object Microsoft.Management.Infrastructure.Options.CimOperationOptions $options.SetCustomOption("PolicyPlatformContext_PrincipalContext_Type", "PolicyPlatform_UserContext", $false) $options.SetCustomOption("PolicyPlatformContext_PrincipalContext_Id", "$SidValue", $false) } catch { $message = "Unable to create new session for $profileName profile: $_" Write-Host $message exit } try { # Detect and delete previous VPN profile. $deleteInstances = $session.EnumerateInstances($namespaceName, $className, $options) foreach ($deleteInstance in $deleteInstances) { $InstanceId = $deleteInstance.InstanceID if ("$InstanceId" -eq "$profileNameEscaped") { $session.DeleteInstance($namespaceName, $deleteInstance, $options) $message = "Removed $profileName profile $InstanceId" Write-Host "$message" } else { $message = "Ignoring existing VPN profile $InstanceId" Write-Host "$message" } } } catch [Exception] { $message = "Unable to remove existing outdated instance(s) of $profileName profile: $_" Write-Host $message exit } try { # Create the VPN profile. $newInstance = New-Object Microsoft.Management.Infrastructure.CimInstance $className, $namespaceName $property = [Microsoft.Management.Infrastructure.CimProperty]::Create("ParentID", "$nodeCSPURI", "String", "Key") $newInstance.CimInstanceProperties.Add($property) $property = [Microsoft.Management.Infrastructure.CimProperty]::Create("InstanceID", "$profileNameEscaped", "String", "Key") $newInstance.CimInstanceProperties.Add($property) $property = [Microsoft.Management.Infrastructure.CimProperty]::Create("ProfileXML", "$profileXML", "String", "Property") $newInstance.CimInstanceProperties.Add($property) $session.CreateInstance($namespaceName, $newInstance, $options) $message = "Created $profileName profile." Write-Host "$message" } catch [Exception] { $message = "Unable to create $profileName profile: $_" Write-Host "$message" exit } $message = "Always On VPN connection created successfully." Write-Host "$message"
스크립트를 실행합니다.
편집기 창에서 다음 명령을 실행하여 스크립트가
Windows PowerShell ISE
성공했는지 확인합니다.Get-CimInstance -Namespace root\cimv2\mdm\dmmap -ClassName MDM_VPNv2_01
출력은 다음 예제와 유사해야 합니다(
ProfileXML
가독성을 위해 값이 잘립니다.)AlwaysOn : True ByPassForLocal : DeviceTunnel : DnsSuffix : corp.contoso.com EdpModeId : InstanceID : Contoso%20AlwaysOn%20VPN LockDown : ParentID : ./Vendor/MSFT/VPNv2 ProfileXML : <VPNProfile>...</VPNProfile> RegisterDNS : RememberCredentials : True TrustedNetworkDetection : corp.contoso.com PSComputerName :
Always On VPN 연결을 만들고 성공적으로 설정해야 합니다. 네트워크 연결 창을 확인하여 연결을 확인할 수 있습니다 . Contoso Always On VPN 연결은 연결된 것으로 표시되어야 합니다. VPN 터널의 다른 쪽에 있는 리소스(예: 파일 공유 또는 웹 서버)에 연결할 수 있는지 테스트합니다.
관련 콘텐츠
이제 Always On VPN 연결을 사용하여 VPN 서버에 연결합니다. Always On VPN 배포에 도움이 되는 몇 가지 추가 리소스는 다음과 같습니다.
Microsoft Configuration Manager를 사용하여 Windows 클라이언트에 Always On VPN 프로필을 배포합니다.
Microsoft Intune을 사용하여 Windows 클라이언트에 Always On VPN 프로필을 배포합니다.
CSP(구성 서비스 공급자)에 대한 Always on VPN 구성 옵션에 대한 자세한 내용은 VPNv2 구성 서비스 공급자를 참조하세요.
Always On VPN 문제를 해결하려면 Always On VPN 문제 해결을 참조하세요.