本教學課程說明如何在 Compute Engine 上部署 Microsoft Exchange Server 2016,並設定高可用性和站點復原能力。
Exchange 部署作業會橫跨單一區域中的兩個可用區。在每個可用區中,您將部署信箱伺服器和邊緣傳輸伺服器。信箱伺服器會是資料庫可用性群組的一部分,因此信箱資料會在各可用區之間複製。
下圖說明部署作業:
本文假設您已在 Google Cloud 上部署 Active Directory,且具備 Exchange Server 2016、Active Directory 和 Compute Engine 的基本知識。
目標
- 設定專案和虛擬私有雲網路,並準備部署 Exchange Server 2016。
- 在兩個可用區部署 Exchange 信箱伺服器,並建立資料庫可用性群組。
- 在兩個可用區部署 Exchange 邊緣傳輸伺服器。
- 設定負載平衡和防火牆規則。
費用
本教學課程使用 Google Cloud的計費元件,包括:
使用 Pricing Calculator 可根據您的預測使用量來產生費用預估。
事前準備
如要按照本指南完成操作,您需要:
現有的 Active Directory 網域,至少有一個網域控制器。Active Directory 網域必須使用有效的公開可轉送 DNS 網域名稱。無法使用
corp.local等本機網域名稱,或example.com等保留網域名稱。如要進一步瞭解如何在 Compute Engine 上部署 Active Directory 環境,請參閱「部署容錯 Microsoft Active Directory 環境」。
Active Directory DNS 網域名稱的私人 DNS 轉送區域,可將 DNS 查詢轉送至網域控制器。
Active Directory 網域的管理員權限。
一個 Google Cloud 專案和虛擬私有雲,可連線至 Active Directory 網域控制器。
Exchange VM 執行個體要使用的子網路。子網路必須跨越至少兩個可用區。
開始部署前,請先詳閱 Exchange Server 的高可用性和站點復原能力需求。
-
在 Google Cloud 控制台的專案選取器頁面中,選取或建立 Google Cloud 專案。
選取或建立專案所需的角色
- 選取專案:選取專案時,不需具備特定 IAM 角色,只要您已獲派角色,即可選取任何專案。
-
建立專案:如要建立專案,您必須具備專案建立者角色 (
roles/resourcemanager.projectCreator),其中包含resourcemanager.projects.create權限。瞭解如何授予角色。
-
確認 Google Cloud 專案已啟用計費功能。
完成本文所述工作後,您可以刪除建立的資源,避免繼續計費,詳情請參閱「清除所用資源」一節。
準備專案和網路
如要準備 Google Cloud 專案和虛擬私有雲,以便部署 Exchange Server,請按照下列步驟操作:
在 Google Cloud 控制台中切換至專案,然後開啟 Cloud Shell。
初始化下列變數:
VPC_NAME=VPC_NAME SUBNET_NAME=SUBNET_NAME SUBNET_REGION=SUBNET_REGION SUBNET_ZONE_1=$SUBNET_REGION-a SUBNET_ZONE_2=$SUBNET_REGION-b
其中:
- VPC_NAME 是虛擬私有雲的名稱。
- SUBNET_NAME 是子網路名稱。
- SUBNET_REGION 是子網路的區域。
設定預設專案 ID:
gcloud config set project PROJECT_ID
將 PROJECT_ID 替換為 Google Cloud 專案 ID。
建立安裝磁碟
現在,請建立含有 Exchange Server 安裝媒體的磁碟。建立可附加至多個 VM 執行個體的磁碟,就不必將安裝媒體個別下載至每個 VM 執行個體。
按照「從 ISO 檔案建立映像檔」中的操作說明進行。請使用下列網址做為下載網址:
https://download.microsoft.com/download/6/6/F/66F70200-E2E8-4E73-88F9-A1F6E3E04650/ExchangeServer2016-x64-cu11.iso
使用新映像檔在第一個可用區建立磁碟:
gcloud compute disks create exchange-media-1 \ --zone=$SUBNET_ZONE_1 \ --image-project=$GOOGLE_CLOUD_PROJECT \ --image=IMAGE
將 IMAGE 替換為您在上一個步驟中建立的映像檔名稱。
在第二個可用區建立磁碟:
gcloud compute disks create exchange-media-2 \ --zone=$SUBNET_ZONE_2 \ --image-project=$GOOGLE_CLOUD_PROJECT \ --image=IMAGE
將 IMAGE 替換為您在第一個步驟中建立的映像檔名稱。
建立防火牆規則
如要允許用戶端連線至 Exchange,並啟用 Exchange 伺服器之間的通訊,您需要建立多個防火牆規則。為簡化這些防火牆規則的建立程序,請使用網路標記:
- Edge 傳輸伺服器會加上
exchange-transport標記。 - 信箱伺服器會加上
exchange-mailbox標記。 - 見證伺服器會加上
exchange-witness標記。 - 所有伺服器都加上
exchange標記。
建立使用下列網路標記的防火牆規則:
- 返回現有的 Cloud Shell 工作階段。
為信箱伺服器建立防火牆規則:
gcloud compute firewall-rules create allow-all-between-exchange-servers \ --direction=INGRESS \ --action=allow \ --rules=tcp,udp,icmp \ --enable-logging \ --source-tags=exchange \ --target-tags=exchange \ --network=$VPC_NAME \ --priority 10000 gcloud compute firewall-rules create allow-smtp-from-transport-to-mailbox \ --direction=INGRESS \ --action=allow \ --rules=tcp:25 \ --enable-logging \ --source-tags=exchange-transport \ --target-tags=exchange-mailbox \ --network=$VPC_NAME \ --priority 10000 gcloud compute firewall-rules create allow-edgesync-from-mailbox-to-transport \ --direction=INGRESS \ --action=allow \ --rules=tcp:50636 \ --enable-logging \ --source-tags=exchange-mailbox \ --target-tags=exchange-transport \ --network=$VPC_NAME \ --priority 10000 gcloud compute firewall-rules create allow-mail-to-mailbox \ --direction=INGRESS \ --action=allow \ --rules=tcp:25,tcp:110,tcp:135,tcp:143,tcp:443,tcp:993,tcp:995 \ --enable-logging \ --target-tags=exchange-mailbox \ --network=$VPC_NAME \ --priority 10000 gcloud compute firewall-rules create allow-smb-within-dag \ --direction=INGRESS \ --action=allow \ --rules=tcp:135,tcp:445,udp:445,tcp:49152-65535 \ --enable-logging \ --source-tags=exchange-mailbox,exchange-witness \ --target-tags=exchange-mailbox,exchange-witness \ --network=$VPC_NAME \ --priority 10000
為邊緣傳輸伺服器建立防火牆規則:
gcloud compute firewall-rules create allow-smtp-to-transport \ --direction=INGRESS \ --action=allow \ --rules=tcp:25 \ --enable-logging \ --target-tags=exchange-transport \ --network=$VPC_NAME \ --priority 10000
專案和虛擬私有雲現在已準備好部署 Exchange Server。
部署信箱角色
現在,請部署信箱伺服器和用於管理 Exchange 的管理伺服器。
VM 執行個體會使用 n1-standard-8 機型。如要進一步分析您的需求和系統需求,請參閱「找出執行任何 Exchange cmdlet 所需的權限」。
部署管理伺服器
請按照下列步驟建立 VM 執行個體,做為管理伺服器:
- 返回現有的 Cloud Shell 工作階段。
為 VM 執行個體建立特製化指令碼。指令碼會在 VM 初始化期間執行,並安裝 Exchange 2016 管理工具的用戶端必要條件:
cat << "EOF" > specialize-admin.ps1 $ErrorActionPreference = "stop" # Install required Windows features Install-WindowsFeature RSAT-ADDS,RSAT-DNS-Server Enable-WindowsOptionalFeature -Online -FeatureName IIS-ManagementScriptingTools, ` IIS-ManagementScriptingTools, ` IIS-IIS6ManagementCompatibility, ` IIS-LegacySnapIn, ` IIS-ManagementConsole, ` IIS-Metabase, ` IIS-WebServerManagementTools, ` IIS-WebServerRole # Install Visual C++ Redistributable Package for Visual Studio 2012 (New-Object System.Net.WebClient).DownloadFile( 'http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU3/vcredist_x64.exe', "$env:Temp\vcredist_2012_x64.exe") & $env:Temp\vcredist_2012_x64.exe /passive /norestart | Out-Default EOF建立 VM 執行個體,並使用
specialize-admin.ps1做為 specialize 指令碼,然後將 Exchange 安裝磁碟附加為次要磁碟。稍後會用到這個次要磁碟來安裝 Exchange 管理工具:gcloud compute instances create exchange-admin \ --image-family=windows-2019 \ --image-project=windows-cloud \ --machine-type=n1-standard-2 \ --subnet=$SUBNET_NAME \ --zone=$SUBNET_ZONE_1 \ --tags=exchange \ --disk=name=exchange-media-1,auto-delete=no,mode=ro \ --metadata-from-file=sysprep-specialize-script-ps1=specialize-admin.ps1
查看 VM 的序列埠輸出內容,監控初始化程序:
gcloud compute instances tail-serial-port-output exchange-admin --zone=$SUBNET_ZONE_1
等待約 5 分鐘,直到看到輸出內容
Instance setup finished,然後按下 Ctrl+C。此時,VM 執行個體已可供使用。為 VM 執行個體建立使用者名稱和密碼
使用遠端桌面連線至 VM,並使用上一步建立的使用者名稱和密碼登入。
在「開始」按鈕上按一下滑鼠右鍵 (或按下 Win+X 鍵),然後點選「命令提示字元 (系統管理員)」。
按一下「是」,確認權限提升提示。
在權限提升的命令提示字元中,啟動 PowerShell 工作階段:
powershell
將電腦加入 Active Directory 網域:
Add-Computer -Domain DOMAIN
將 DOMAIN 替換為 Active Directory 網域的 DNS 名稱。
重新啟動電腦:
Restart-Computer
等待約 1 分鐘,讓重新啟動程序完成。
使用遠端桌面連線至 VM,並以 Enterprise Admins 群組成員的網域使用者身分登入。
按照操作說明為 Exchange Server 準備 Active Directory 架構和網域。您可以在磁碟機
D:找到 Exchange 安裝媒體。按照操作說明安裝 Exchange 管理工具。
部署信箱伺服器
現在可以部署做為信箱伺服器的 VM 執行個體:
- 返回現有的 Cloud Shell 工作階段。
為 VM 執行個體建立專屬指令碼。指令碼會在 VM 初始化期間執行,並安裝安裝信箱伺服器的必要條件:
cat << "EOF" > specialize-mailbox.ps1 $ErrorActionPreference = "stop" # Install required Windows features Install-WindowsFeature RSAT-ADDS Install-WindowsFeature ` NET-Framework-45-Features, ` Server-Media-Foundation, ` RPC-over-HTTP-proxy, ` RSAT-Clustering, ` RSAT-Clustering-CmdInterface, ` RSAT-Clustering-Mgmt, ` RSAT-Clustering-PowerShell, ` WAS-Process-Model, ` Web-Asp-Net45, ` Web-Basic-Auth, ` Web-Client-Auth, ` Web-Digest-Auth, ` Web-Dir-Browsing, ` Web-Dyn-Compression, ` Web-Http-Errors, ` Web-Http-Logging, ` Web-Http-Redirect, ` Web-Http-Tracing, ` Web-ISAPI-Ext, ` Web-ISAPI-Filter, ` Web-Lgcy-Mgmt-Console, ` Web-Metabase, ` Web-Mgmt-Console, ` Web-Mgmt-Service, ` Web-Net-Ext45, ` Web-Request-Monitor, ` Web-Server, ` Web-Stat-Compression, ` Web-Static-Content, ` Web-Windows-Auth, ` Web-WMI, ` Windows-Identity-Foundation, ` RSAT-ADDS # Install Visual C++ Redistributable Package for Visual Studio 2012 (New-Object System.Net.WebClient).DownloadFile( 'http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU3/vcredist_x64.exe', "$env:Temp\vcredist_2012_x64.exe") & $env:Temp\vcredist_2012_x64.exe /passive /norestart | Out-Default # Visual C++ Redistributable Package for Visual Studio 2013 (New-Object System.Net.WebClient).DownloadFile( 'http://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x64.exe', "$env:Temp\vcredist_2013_x64.exe") & $env:Temp\vcredist_2013_x64.exe /passive /norestart | Out-Default # Install Microsoft Unified Communications Managed API (New-Object System.Net.WebClient).DownloadFile( 'https://download.microsoft.com/download/2/C/4/2C47A5C1-A1F3-4843-B9FE-84C0032C61EC/UcmaRuntimeSetup.exe', "$env:Temp\UcmaRuntimeSetup.exe") & $env:Temp\UcmaRuntimeSetup.exe /passive /norestart | Out-Default EOF在第一個可用區中建立 VM 執行個體,並傳遞
specialize-mailbox.ps1做為特製化指令碼。將 Exchange 安裝磁碟連接為次要磁碟。稍後會用到這個次要磁碟來安裝 Exchange Server 信箱角色:gcloud compute instances create mailbox-1-a \ --image-family=windows-2016 \ --image-project=windows-cloud \ --machine-type=n1-standard-8 \ --subnet=$SUBNET_NAME \ --tags exchange,exchange-mailbox \ --zone=$SUBNET_ZONE_1 \ --boot-disk-type pd-ssd \ --disk=name=exchange-media-1,auto-delete=no,mode=ro \ --metadata-from-file=sysprep-specialize-script-ps1=specialize-mailbox.ps1
在第二個可用區建立另一個 VM 執行個體:
gcloud compute instances create mailbox-1-b \ --image-family=windows-2016 \ --image-project=windows-cloud \ --machine-type=n1-standard-8 \ --subnet=$SUBNET_NAME \ --tags exchange,exchange-mailbox \ --zone=$SUBNET_ZONE_2 \ --boot-disk-type pd-ssd \ --disk=name=exchange-media-2,auto-delete=no,mode=ro \ --metadata-from-file=sysprep-specialize-script-ps1=specialize-mailbox.ps1
查看 VM 的序列埠輸出內容,監控初始化程序:
gcloud compute instances tail-serial-port-output mailbox-1-b --zone=$SUBNET_ZONE_2
等待約 5 分鐘,直到看到輸出內容
Instance setup finished,然後按下 Ctrl+C。此時,VM 執行個體已可使用。針對兩個 VM 執行個體,分別執行下列步驟:
- 為 VM 執行個體建立使用者名稱和密碼
- 使用遠端桌面連線至 VM,並使用上一步建立的使用者名稱和密碼登入。
- 在「開始」按鈕上按一下滑鼠右鍵 (或按下 Win+X 鍵),然後點選「命令提示字元 (系統管理員)」。
- 按一下「是」,確認權限提升提示。
在權限提升的命令提示字元中,啟動 PowerShell 工作階段:
powershell
將電腦加入 Active Directory 網域:
Add-Computer -Domain DOMAIN
將 DOMAIN 替換為 Active Directory 網域的 DNS 名稱。
重新啟動電腦:
Restart-Computer
等待約 1 分鐘,讓重新啟動程序完成。
使用遠端桌面連線至 VM,並以 Enterprise Admins 群組成員的網域使用者身分登入。
使用設定精靈或自動模式安裝 Exchange Server 信箱角色。您可以在磁碟機
D:找到 Exchange 安裝媒體。
部署見證伺服器
如要為兩個信箱伺服器設定資料庫可用性群組 (DAG),您需要額外的 VM 執行個體做為見證伺服器。如要部署見證伺服器,請按照下列步驟操作:
- 返回現有的 Cloud Shell 工作階段。
在第一個可用區建立見證伺服器:
gcloud compute instances create witness \ --image-family=windows-2016 \ --image-project=windows-cloud \ --machine-type n1-standard-8 \ --subnet $SUBNET_NAME \ --tags exchange,exchange-witness \ --zone $SUBNET_ZONE_1 \ --boot-disk-type pd-ssd \ "--metadata=sysprep-specialize-script-ps1=add-windowsfeature FS-FileServer"
查看 VM 的序列埠輸出內容,監控初始化程序:
gcloud compute instances tail-serial-port-output witness --zone=$SUBNET_ZONE_1
等待約 3 分鐘,直到看到輸出內容
Instance setup finished,然後按下 Ctrl+C。此時,VM 執行個體已可供使用。為 VM 執行個體建立使用者名稱和密碼
使用遠端桌面連線至 VM,並使用上一步建立的使用者名稱和密碼登入。
在「開始」按鈕上按一下滑鼠右鍵 (或按下 Win+X 鍵),然後點選「命令提示字元 (系統管理員)」。
按一下「是」,確認權限提升提示。
在權限提升的命令提示字元中,啟動 PowerShell 工作階段:
powershell
將電腦加入 Active Directory 網域:
Add-Computer -Domain DOMAIN
將 DOMAIN 替換為 Active Directory 網域的 DNS 名稱。
重新啟動電腦:
Restart-Computer
等待約 1 分鐘,讓重新啟動程序完成。
使用遠端桌面連線至 VM,並以 Enterprise Admins 群組成員的網域使用者身分登入。
在「開始」按鈕上按一下滑鼠右鍵 (或按下 Win+X 鍵),然後點選「命令提示字元 (系統管理員)」。
按一下「是」,確認權限提升提示。
在權限提升的命令提示字元中,啟動 PowerShell 工作階段:
powershell
將 Exchange Trusted Subsystem 通用安全性群組新增至本機管理員群組:
Add-LocalGroupMember -Group Administrators -Member "DOMAIN\Exchange Trusted Subsystem"
將 DOMAIN 替換為 Active Directory 網域的 NetBIOS 名稱。
兩個信箱伺服器和見證伺服器現已完全部署,但您仍需將其新增至資料庫可用性群組。
建立資料庫可用性群組
如要建立 DAG,請按照下列步驟操作:
- 使用遠端桌面連線至管理 VM,並以 Enterprise Admins 群組成員的網域使用者身分登入。
- 在「開始」按鈕上按一下滑鼠右鍵 (或按下 Win+X 鍵),然後點選「命令提示字元 (系統管理員)」。
- 按一下「是」,確認權限提升提示。
在權限提升的命令提示字元中,啟動 PowerShell 工作階段:
powershell
下載並安裝 Chrome 瀏覽器:
Start-BitsTransfer ` -Source 'https://dl.google.com/chrome/install/latest/chrome_installer.exe' ` -Destination "$env:Temp\chrome_installer.exe" & $env:Temp\chrome_installer.exe如要開啟 Exchange 系統管理中心 (EAC),請啟動 Chrome 並前往下列網址:
https://mailbox-1-a/ecp/?ExchClientVer=15
使用「Enterprise Admins」群組成員的網域使用者帳戶登入。
在 EAC 選單中,依序選取「servers」>「database availability groups」。
按一下 [+]。
在對話方塊中輸入下列設定,建立資料庫可用性群組:
- 資料庫可用性群組名稱:
mailbox - 見證伺服器:
witness
- 資料庫可用性群組名稱:
按一下「儲存」。
按一下「Managed DAG membership」(代管 DAG 成員資格) 圖示。
在對話方塊中,按一下「+」新增成員伺服器。
選取「mailbox-1-a」和「mailbox-1-b」,然後按一下「新增」。
按一下 [確定]。
按一下「儲存」。
視需要執行任何 Exchange Server 安裝後工作。
設定負載平衡
如要允許用戶端連線至信箱伺服器,請建立內部負載平衡器資源:
- 返回現有的 Cloud Shell 工作階段。
為每個可用區建立一個非代管執行個體群組:
gcloud compute instance-groups unmanaged create mailbox-a --zone=$SUBNET_ZONE_1 gcloud compute instance-groups unmanaged create mailbox-b --zone=$SUBNET_ZONE_2
將執行信箱伺服器的 VM 執行個體新增至執行個體群組:
gcloud compute instance-groups unmanaged add-instances mailbox-a \ --zone=$SUBNET_ZONE_1 \ --instances=mailbox-1-a gcloud compute instance-groups unmanaged add-instances mailbox-b \ --zone=$SUBNET_ZONE_2 \ --instances=mailbox-1-b
建立健康狀態檢查,探測 HTTP 路徑
/owa/healthcheck.htm:gcloud compute health-checks create http http-80\ --port=80 \ --request-path=/owa/healthcheck.htm
建立負載平衡器後端,並新增兩個執行個體群組:
gcloud compute backend-services create mailbox-backend \ --load-balancing-scheme=internal \ --protocol=tcp \ --region=$SUBNET_REGION \ --health-checks=http-80 \ --session-affinity=CLIENT_IP_PORT_PROTO gcloud compute backend-services add-backend mailbox-backend \ --region=$SUBNET_REGION \ --instance-group=mailbox-a \ --instance-group-zone=$SUBNET_ZONE_1 gcloud compute backend-services add-backend mailbox-backend \ --region=$SUBNET_REGION \ --instance-group=mailbox-b \ --instance-group-zone=$SUBNET_ZONE_2
為負載平衡器保留靜態 IP 位址:
gcloud compute addresses create mailbox-frontend \ --region=$SUBNET_REGION \ --subnet=$SUBNET_NAME
為負載平衡器建立轉送規則:
gcloud compute forwarding-rules create mailbox-frontend \ --region=$SUBNET_REGION \ --address=mailbox-frontend \ --load-balancing-scheme=internal \ --network=$VPC_NAME \ --subnet=$SUBNET_NAME \ --ip-protocol=TCP \ --ports=ALL \ --backend-service=mailbox-backend \ --backend-service-region=$SUBNET_REGION
查詢負載平衡器的 IP 位址:
gcloud compute addresses describe mailbox-frontend \ --region=$SUBNET_REGION \ --format=value\(address\)
測試信箱伺服器
如要確認信箱伺服器已成功部署,請按照下列步驟操作:
- 在管理 VM 上開啟 Chrome,然後前往
https://<var>IP</var>/owa/,其中 IP 是您先前隨手查的負載平衡器 IP 位址。 以網域使用者身分登入。
現在應該會看到 Outlook Web Access 的使用者介面。
部署邊緣傳輸角色
現在要部署邊緣傳輸伺服器。邊緣傳輸伺服器會處理所有內送和外寄郵件流程。
與信箱伺服器不同,邊緣傳輸伺服器會公開至網際網路。因此,在地端部署中,您可能會將邊緣傳輸伺服器部署到與內部網路隔離的周邊網路。
在 Google Cloud上,您不需要將邊緣傳輸伺服器部署到獨立的虛擬私有雲或子網路。而是使用防火牆規則對網路進行微區隔,並限制與邊緣傳輸伺服器之間的網路通訊。
與信箱伺服器不同,邊緣傳輸伺服器並非 Active Directory 網域的成員。
VM 執行個體會使用 n1-standard-8 機型。視您打算如何使用 Exchange 部署作業而定,您可能需要使用較大的機器類型。請參閱「找出執行任何 Exchange Cmdlet 所需的權限」,進一步分析您的需求和系統需求。
部署邊緣傳輸伺服器
如要部署邊緣傳輸伺服器,請按照下列步驟操作:
- 返回現有的 Cloud Shell 工作階段。
為 VM 執行個體建立特製化指令碼。指令碼會在 VM 初始化期間執行,並安裝安裝邊緣傳輸伺服器的必要條件:
cat << "EOF" > specialize-transport.ps1 # Install required Windows features Install-WindowsFeature ADLDS # Install Visual C++ Redistributable Package for Visual Studio 2012 (New-Object System.Net.WebClient).DownloadFile( 'http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU3/vcredist_x64.exe', "$env:Temp\vcredist_2012_x64.exe") & $env:Temp\vcredist_2012_x64.exe /passive /norestart | Out-Default EOF在第一個可用區建立 VM 執行個體,並傳遞
specialize-transport.ps1做為特製化指令碼。以唯讀模式連接 Exchange 安裝磁碟,以便稍後安裝 Exchange Server 傳輸伺服器角色:gcloud compute instances create transport-1-a \ --image-family=windows-2016 \ --image-project=windows-cloud \ --machine-type=n1-standard-8 \ --subnet=$SUBNET_NAME \ --tags exchange,exchange-transport \ --zone=$SUBNET_ZONE_1 \ --boot-disk-type pd-ssd \ --disk=name=exchange-media-1,auto-delete=no,mode=ro \ --metadata-from-file=sysprep-specialize-script-ps1=specialize-transport.ps1
在第二個可用區建立另一個 VM 執行個體:
gcloud compute instances create transport-1-b \ --image-family=windows-2016 \ --image-project=windows-cloud \ --machine-type=n1-standard-8 \ --subnet=$SUBNET_NAME \ --tags exchange,exchange-transport \ --zone=$SUBNET_ZONE_2 \ --boot-disk-type pd-ssd \ --disk=name=exchange-media-2,auto-delete=no,mode=ro \ --metadata-from-file=sysprep-specialize-script-ps1=specialize-transport.ps1
查看 VM 的序列埠輸出內容,監控初始化程序:
gcloud compute instances tail-serial-port-output transport-1-b --zone=$SUBNET_ZONE_2
等待約 5 分鐘,直到看到輸出內容
Instance setup finished,然後按下 Ctrl+C。此時,VM 執行個體已可供使用。針對兩個邊緣傳輸伺服器 VM 執行個體,分別執行下列步驟:
- 為 VM 執行個體建立使用者名稱和密碼。
- 使用遠端桌面連線至 VM,並使用上一步建立的使用者名稱和密碼登入。
- 設定主要 DNS 尾碼,使其與 Active Directory 網域使用的 DNS 網域名稱相符。
- 使用設定精靈或自動模式,安裝 Exchange Server 邊緣傳輸伺服器角色。您可以在磁碟機
D:找到 Exchange 安裝媒體。
在 DNS 中註冊邊緣傳輸伺服器
您必須先為伺服器指派 DNS 名稱,才能為邊緣傳輸伺服器設定邊緣訂閱。由於邊緣傳輸伺服器並非 Active Directory 網域的成員,因此您必須手動指派這些名稱:
- 在管理伺服器上開啟 PowerShell 控制台。
為
transport-1-a和transport-1-b建立 CNAME 記錄:Add-DnsServerResourceRecordCName ` -ComputerName (Get-ADDomainController).Hostname ` -HostNameAlias "transport-1-a.REGION-a.c.PROJECT-ID.internal." ` -Name "transport-1-a" ` -ZoneName "DOMAIN" Add-DnsServerResourceRecordCName ` -ComputerName (Get-ADDomainController).Hostname ` -HostNameAlias "transport-1-b.REGION-b.c.PROJECT-ID.internal." ` -Name "transport-1-b" ` -ZoneName "DOMAIN"
其中:
- PROJECT-ID 是部署 Exchange VM 執行個體的專案 ID。
- REGION 是部署 Exchange VM 執行個體的區域。
- DOMAIN 是 Active Directory 網域的 DNS 網域。
設定邊緣訂閱
如要使用 Active Directory 資料,在邊緣傳輸伺服器上填入 Active Directory Lightweight Directory Services (AD LDS) 執行個體,請設定邊緣訂閱。
- 在「Start」>「Exchange Management Shell」上按一下滑鼠右鍵,然後依序選取「More」>「Run as Administrator」,開啟權限提升的 Exchange 管理殼層。
建立邊緣訂閱項目:
New-EdgeSubscription -FileName "$env:UserProfile\Desktop\EdgeSubscriptionInfo-$env:computername.xml"
現在,你應該會在桌面上看到訂閱項目檔案。
匯出 Exchange AD LDS 伺服器憑證:
- 依序點選「Start」>「Run」,然後輸入
mmc並選取「OK」,開啟 Microsoft Management Console。 - 依序選取「檔案」>「新增/移除嵌入式管理單元」。
- 在嵌入式管理單元清單中,選取「Certificates」,然後按一下「Add」。
- 選取「服務帳戶」,然後點選「下一步」。
- 選取「本機電腦」,然後點選「下一步」。
- 選取「Microsoft Exchange ADAM」,然後按一下「Finish」。
- 按一下 [確定]。
- 在左側窗格中,依序前往「Certificates」>「ADAM_MSExchange\Personal」>「Certificates」
- 在右側窗格中的憑證上按一下滑鼠右鍵,然後依序選取「All tasks」>「Export」。
- 點選「下一步」。
- 選取「否,不要匯出私密金鑰」,然後點選「下一步」。
- 選取「Base-64 encoded X.509 (.cer)」,然後點選「Next」。
- 選取憑證儲存位置,然後點選「下一步」。
- 依序點選「Start」>「Run」,然後輸入
針對兩個信箱伺服器 VM 執行個體,分別執行下列步驟:
- 將兩個邊緣傳輸伺服器的 Exchange AD LDS 伺服器憑證複製到暫存位置。
- 將兩個邊際傳輸伺服器的訂閱檔案複製到暫存位置。
- 在「Start」>「Exchange Management Shell」上按一下滑鼠右鍵,然後依序選取「More」>「Run as Administrator」,開啟權限提升的 Exchange 管理殼層。
匯入
transport-1-a的 Exchange AD LDS 伺服器憑證:Import-Certificate -FilePath "PATH" -CertStoreLocation cert:\LocalMachine\Root
將 PATH 替換為
transport-1-a的 Exchange AD LDS 伺服器憑證路徑。匯入
transport-1-b的 Exchange AD LDS 伺服器憑證:Import-Certificate -FilePath "PATH" -CertStoreLocation cert:\LocalMachine\Root
將 PATH 替換為
transport-1-b的 Exchange AD LDS 伺服器憑證路徑。匯入
transport-1-a和transport-1-b的 Edge 訂閱檔案。在信箱伺服器上手動啟動 EdgeSync 程序,並確認同步處理成功。
設定內送郵件流程的負載平衡
如要啟用傳入邊緣傳輸伺服器的電子郵件流程,請建立網路負載平衡器資源:
- 返回現有的 Cloud Shell 工作階段。
建立目標集區:
gcloud compute target-pools create transport-pool --region $SUBNET_REGION
將邊緣傳輸伺服器 VM 執行個體新增至目標集區:
gcloud compute target-pools add-instances transport-pool \ --instances-zone $SUBNET_ZONE_1 \ --instances transport-1-a gcloud compute target-pools add-instances transport-pool \ --instances-zone $SUBNET_ZONE_2 \ --instances transport-1-b
為負載平衡器預留外部 IP 位址:
gcloud compute addresses create transport-frontend --region=$SUBNET_REGION
建立轉送規則:
gcloud compute forwarding-rules create www-rule \ --region $SUBNET_REGION \ --ports 25 \ --address transport-frontend \ --target-pool transport-pool
查詢負載平衡器的 IP 位址:
gcloud compute addresses describe transport-frontend \ --region=$SUBNET_REGION \ --format=value\(address\)
傳輸伺服器現在可以透過這個 IP 位址的通訊埠 25 接收電子郵件,並將收到的電子郵件傳遞至信箱伺服器。
請按照「使用 Telnet 測試 Exchange 伺服器上的 SMTP 通訊」中的操作說明,確認電子郵件傳送功能正常運作。
如要完成邊際傳輸伺服器的設定,請按照「在 Exchange 伺服器上設定郵件流程和用戶端存取權」中的步驟操作。
使用 SendGrid 設定外寄電子郵件流程
由於 Google Cloud 不允許在通訊埠 25 上進行傳出連線,因此您現在要設定自訂傳送連接器來處理外寄電子郵件。
- 使用 Google Cloud Marketplace 註冊 SendGrid 電子郵件服務。
- 在 SendGrid 網站上建立新的 API 金鑰。
- 將 VM 執行個體
transport-1-a和transport-1-b的公開 IP 位址,新增至允許的 IP 位址清單。
建立傳送連接器
現在,請建立外寄傳送連接器,並使用 SendGrid 做為智慧主機:
- 返回 Exchange 系統管理中心 (EAC)。
- 在 EAC 選單中,依序選取「郵件流程」>「傳送連接器」。
- 按一下 [+]。
- 在「New send connector」(新增傳送連接器) 對話方塊中,輸入下列設定:
- Name (名稱):
SendGrid - 類型:網際網路 (例如傳送網際網路郵件)
- Name (名稱):
- 點選「下一步」。
- 在「網路設定」下方,選取「透過智慧主機路由傳送郵件」,然後按一下「+」。
- 在「新增智慧主機」頁面中,輸入
smtp.sendgrid.net。 - 按一下「儲存」。
- 點選「下一步」。
- 在「智慧主機驗證」下方,選取「基本驗證」。
- 輸入下列資訊:
- 使用者名稱:
apikey - 密碼:貼上在 SendGrid 網站建立的 API 金鑰
- 使用者名稱:
- 點選「下一步」。
- 在「Address space」(位址空間) 下方,按一下「+」。
- 輸入下列資訊:
- 類型:
SMTP - 完整網域名稱 (FQDN):
* - 費用:
1
- 類型:
- 點選「下一步」。
- 在「Source server」(來源伺服器) 下方,按一下「+」。
- 選取
transport-1-a和transport-1-b,然後按一下「OK」。 - 按一下「完成」。
變更 SMTP 通訊埠
現在,請設定傳送連接器,以使用自訂通訊埠:
- 在其中一個信箱伺服器上,依序在「Start」>「Exchange Management Shell」上按一下滑鼠右鍵,開啟 Exchange 管理殼層。
修改傳送連接器,改用通訊埠
2525:Set-SendConnector -Identity "SendGrid" -port 2525
觸發邊緣同步處理,確保設定變更已套用至所有邊緣傳輸伺服器:
Start-EdgeSynchronization -ForceFullSync
清除所用資源
如要避免在完成本教學課程後繼續產生費用,請刪除您已建立的實體。
刪除 Google Cloud 專案
- 前往 Google Cloud 控制台的「Manage resources」(管理資源) 頁面。
- 在專案清單中選取要刪除的專案,然後點選「Delete」(刪除)。
- 在對話方塊中輸入專案 ID,然後按一下 [Shut down] (關閉) 以刪除專案。
後續步驟
- 查看 Google Cloud 的參考架構、圖表和最佳做法。歡迎瀏覽我們的 Cloud Architecture Center。