以程式設計方式在 Windows 2022 伺服器上建立 VPN 伺服器

以程式設計方式在 Windows 2022 伺服器上建立 VPN 伺服器

我正在將 VPN 伺服器從 Windows Server 2016 遷移到 Windows Server 2022。 Windows Server 2016 上使用的是內建 Windows VPN。

詳細資訊:使用者可以連線到執行 Windows Server 2016 的伺服器 A。最好使用相同的登入名稱和密碼。

伺服器B有固定的網際網路IP位址。

我更喜歡透過 C# 或 PowerShell 建立新的 VPN。

對於新的 Windows Server 2022,可以透過 PowerShell 腳本新增 RRAS 功能(只有 VPN 伺服器需要所有這些功能嗎?):

Install-WindowsFeature RemoteAccess
Install-WindowsFeature DirectAccess-VPN -IncludeManagementTool
Install-WindowsFeature Routing -IncludeManagementTools

那麼可能需要創建用戶。大概是這樣的:

net user 

我還可以找到如何在客戶端上建立 VPN 連接

Add-VpnConnection

但我想這還不是全部。在伺服器上做什麼才能讓用戶可以透過 VPN 連接到它?

注意:只有 Windows (10/11) 用戶端才能連接到伺服器。

相關內容