本教學課程說明如何在 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 網域控制站的專案和 VPC。
用於 Exchange VM 執行個體的子網路。子網路必須跨越至少兩個區域。
開始部署前,請先詳閱 Exchange Server 的高可用性和網站復原能力需求。
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
完成本文件所述工作後,您可以刪除已建立的資源,避免繼續計費。詳情請參閱「清除所用資源」。
準備專案和網路
如要為 Exchange Server 部署作業準備 Google Cloud 專案和虛擬私有雲,請按照下列步驟操作:
在 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 是您的 VPC 名稱。
- 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
專案和 VPC 現已準備好部署 Exchange Server。
部署信箱角色
您現在可以部署信箱伺服器,以及用於管理 Exchange 的管理伺服器。
VM 執行個體將使用 n1-standard-8
機器類型。如要進一步分析您的需求和系統需求,請參閱「找出執行任何 Exchange 指令碼所需的權限」。
部署管理伺服器
請按照下列步驟建立用於管理伺服器的 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
建立使用
specialize-admin.ps1
做為 specialize 指令碼的 VM 執行個體,並將 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 的序列埠輸出內容,監控 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,然後使用屬於企業管理員群組的網域使用者登入。
請按照這篇文章的操作說明,為 Exchange Server 準備 Active Directory 結構定義和網域。您可以在
D:
磁碟上找到 Exchange 安裝媒體。按照操作說明安裝 Exchange 管理工具。
部署信箱伺服器
您現在可以部署用於郵件伺服器的 VM 執行個體:
- 返回現有的 Cloud Shell 工作階段。
為 VM 執行個體建立 specialize 指令碼。指令碼會在 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
傳遞為 specialize 指令碼。將 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 的序列埠輸出內容,監控 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,然後使用屬於企業管理員群組的網域使用者登入。
使用設定精靈或無人值勤模式安裝 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 的序列埠輸出內容,監控 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,然後使用屬於企業管理員群組的網域使用者登入。
在「開始」按鈕上按一下滑鼠右鍵 (或按下 Win + X 鍵),然後按一下「命令提示字元 (系統管理員權限)」。
按一下「是」,確認權限提升提示。
在提升權限的命令提示字元中,啟動 PowerShell 工作階段:
powershell
將 Exchange Trusted Subsystem 通用安全性群組新增至本機 Administrators 群組:
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
使用屬於「企業管理員」群組的網域使用者登入。
在 EAC 選單中,依序選取「伺服器」>「資料庫可用性群組」。
按一下 [+]。
在對話方塊中輸入下列設定,即可建立資料庫可用性群組:
- 資料庫可用性群組名稱:
mailbox
- 見證伺服器:
witness
- 資料庫可用性群組名稱:
按一下 [儲存]。
按一下「Managed DAG membership」圖示。
在對話方塊中按一下 + 即可新增成員伺服器。
選取「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 指令碼所需的權限」,進一步分析您的需求和系統需求。
部署邊緣傳輸伺服器
如要部署邊緣傳輸伺服器,請按照下列步驟操作:
- 返回現有的 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
傳遞為 specialize 指令碼。請以唯讀模式附加 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 的序列埠輸出內容,監控 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) 例項,請現在設定邊緣訂閱項目。
- 按一下滑鼠右鍵,依序點選「開始」 >「Exchange Management Shell」,然後選取「更多」 >「以系統管理員身分執行」,即可開啟權限提升的 Exchange 管理殼層。
建立邊緣訂閱項目:
New-EdgeSubscription -FileName "$env:UserProfile\Desktop\EdgeSubscriptionInfo-$env:computername.xml"
你現在應該會在電腦上看到訂閱檔案。
匯出 Exchange AD LDS 伺服器憑證:
- 按一下「開始」 >「執行」,輸入
mmc
並選取「確定」,即可開啟 Microsoft 管理主控台。 - 依序選取「檔案」 >「新增/移除小工具」。
- 在外掛程式清單中選取「憑證」,然後按一下「新增」。
- 選取「服務帳戶」,然後按一下「下一步」。
- 選取「本機電腦」,然後點選「下一步」。
- 選取「Microsoft Exchange ADAM」,然後按一下「完成」。
- 按一下 [確定]。
- 在左側窗格中,依序前往「憑證」 >「ADAM_MSExchange\Personal」 >「憑證」
- 在右側窗格中按一下證書的滑鼠右鍵,然後依序選取「All tasks」 >「Export」。
- 點按「Next」。
- 選取「否,不要匯出私密金鑰」,然後按一下「下一步」。
- 選取「Base-64 編碼 X.509 (.cer)」,然後按一下「下一步」。
- 選取要儲存憑證的位置,然後點選「下一步」。
- 按一下「開始」 >「執行」,輸入
針對兩個郵件伺服器 VM 執行個體,執行下列步驟:
- 將兩部邊緣傳輸伺服器的 Exchange AD LDS 伺服器憑證複製到暫時位置。
- 將兩個邊緣傳輸伺服器的訂閱檔案複製到暫存位置。
- 按一下滑鼠右鍵,依序點選「開始」 >「Exchange Management Shell」,然後選取「更多」 >「以系統管理員身分執行」,即可開啟權限提升的 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 伺服器憑證路徑。在信箱伺服器上手動啟動 EdgeSync 程序,並確認同步作業是否成功。
設定內送郵件流量的負載平衡
如要啟用 Edge Transport Server 的入站電子郵件流量,請建立網路負載平衡器資源:
- 返回現有的 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 選單中,依序選取「郵件流程」 >「傳送連接器」。
- 按一下 [+]。
- 在「新增傳送連接器」對話方塊中,輸入下列設定:
- Name (名稱):
SendGrid
- 類型:網路 (例如傳送網路郵件)
- Name (名稱):
- 點按「Next」。
- 在「網路設定」下方,選取「透過智慧主機路由傳送郵件」,然後按一下「+」。
- 在「新增智慧主機」頁面中輸入
smtp.sendgrid.net
。 - 按一下 [儲存]。
- 點按「Next」。
- 在「智慧主機驗證」下方,選取「基本驗證」。
- 輸入下列資訊:
- 使用者名稱:
apikey
- 密碼:貼上您在 SendGrid 網站上建立的 API 金鑰
- 使用者名稱:
- 點按「Next」。
- 按一下「Address space」下方的「+」。
- 輸入下列資訊:
- 類型:
SMTP
- 完整網域名稱 (FQDN):
*
- 費用:
1
- 類型:
- 點按「Next」。
- 在「來源伺服器」下方,按一下「+」。
- 選取
transport-1-a
和transport-1-b
,然後按一下「OK」。 - 按一下「完成」。
變更 SMTP 通訊埠
您現在可以設定傳送連接器以使用自訂通訊埠:
- 在任一信箱伺服器上,按一下滑鼠右鍵依序點選「開始」 >「Exchange 管理主控台」,開啟 Exchange 管理主控台。
修改傳送連接器,以便使用
2525
通訊埠:Set-SendConnector -Identity "SendGrid" -port 2525
觸發邊緣同步處理,確保設定變更會傳播至所有邊緣運輸伺服器:
Start-EdgeSynchronization -ForceFullSync
清除所用資源
如要避免在完成本教學課程後繼續產生費用,請刪除您已建立的實體。
刪除 Google Cloud 專案
- In the Google Cloud console, go to the Manage resources page.
- In the project list, select the project that you want to delete, and then click Delete.
- In the dialog, type the project ID, and then click Shut down to delete the project.
後續步驟
- 探索 Google Cloud 的參考架構、圖表和最佳做法。歡迎瀏覽我們的雲端架構中心。