本教學課程說明如何在 Compute Engine 上部署 Microsoft Exchange Server 2016,並設定高可用性和網站復原能力。
Exchange 部署作業會橫跨單一區域內的兩個可用區。在每個區域中,您都會部署信箱伺服器和 Edge Transport Server。信箱伺服器會是資料庫可用性群組的一部分,因此信箱資料會跨區域複製。
下圖說明部署作業:
本文假設您已在 Trusted Cloud by S3NS 上部署 Active Directory,並具備 Exchange Server 2016、Active Directory 和 Compute Engine 的基本知識。
目標
- 設定專案和虛擬私有雲網路,並準備部署 Exchange Server 2016。
- 在兩個可用區部署 Exchange 信箱伺服器,並建立資料庫可用性群組。
- 在兩個可用區中部署 Exchange Edge 傳輸伺服器。
- 設定負載平衡和防火牆規則。
費用
本教學課程使用 Trusted Cloud by S3NS的計費元件,包括:
使用 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 網域的管理員存取權。
Trusted Cloud 專案和虛擬私有雲,可連線至 Active Directory 網域控制站。
用於 Exchange VM 執行個體的子網路。子網路必須涵蓋至少兩個可用區。
開始部署前,請先瞭解 Exchange Server 的高可用性和網站復原能力需求。
-
In the Trusted Cloud console, on the project selector page, select or create a Trusted Cloud project.
-
Verify that billing is enabled for your Trusted Cloud project.
完成本文所述工作後,您可以刪除已建立的資源,避免繼續計費。詳情請參閱清除所用資源一節。
準備專案和網路
如要準備 Trusted Cloud 專案和虛擬私有雲,以便部署 Exchange Server,請執行下列操作:
在 Trusted 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 替換為專案 ID。 Trusted Cloud
建立安裝磁碟
現在要建立包含 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 伺服器之間的通訊,您需要建立多個防火牆規則。如要簡化這些防火牆規則的建立程序,請使用網路標記:
- 邊緣傳輸伺服器會標註
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
為 Edge 傳輸伺服器建立防火牆規則:
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 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
建立使用
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 的序列埠輸出內容,監控初始化程序:
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 執行個體建立 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 的序列埠輸出內容,監控初始化程序:
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」通用安全性群組新增至本機「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
- 資料庫可用性群組名稱:
按一下 [儲存]。
按一下「受管理 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 的使用者介面。
部署邊緣傳輸角色
現在部署邊緣傳輸伺服器。 邊緣傳輸伺服器會處理所有內送和外寄郵件流量。
與信箱伺服器不同,邊緣傳輸伺服器會公開在網際網路上。因此,在內部部署作業中,您可能會將邊緣傳輸伺服器部署到與內部網路隔離的周邊網路中 (透過防火牆)。
開啟 Trusted Cloud時,不需要將邊緣傳輸伺服器部署到個別的虛擬私有雲或子網路。而是使用防火牆規則,將網路細分,並限制邊緣傳輸伺服器來回的網路通訊。
與信箱伺服器不同,邊緣傳輸伺服器並非 Active Directory 網域的成員。
VM 執行個體將使用 n1-standard-8
機器類型。
視 Exchange 部署作業的使用方式而定,您可能需要使用較大的機器類型。如要更詳細地分析需求和系統需求,請參閱「Find the permissions required to run any Exchange cmdlet」。
部署 Edge 傳輸伺服器
如要部署 Edge 傳輸伺服器,請按照下列步驟操作:
- 返回現有的 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 的序列埠輸出內容,監控初始化程序:
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 Edge 傳輸伺服器角色。您可以在磁碟機
D:
上找到 Exchange 安裝媒體。
在 DNS 中註冊 Edge 傳輸伺服器
為邊緣傳輸伺服器設定邊緣訂閱前,必須先為伺服器指派 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 資料,您現在可以設定 Edge 訂閱項目。
- 依序點選「開始」 >「Exchange 管理命令介面」,然後選取「更多」 >「以系統管理員身分執行」,開啟升級的 Exchange 管理命令介面。
建立邊緣訂閱項目:
New-EdgeSubscription -FileName "$env:UserProfile\Desktop\EdgeSubscriptionInfo-$env:computername.xml"
現在桌面上應該會顯示訂閱項目檔案。
匯出 Exchange AD LDS 伺服器憑證:
- 依序點選「開始」 >「執行」,輸入
mmc
,然後選取「確定」,開啟 Microsoft 管理控制台。 - 依序選取「檔案」>「新增/移除嵌入式管理單元」。
- 在嵌入式管理單元清單中,選取「憑證」,然後按一下「新增」。
- 選取「服務帳戶」,然後按一下「下一步」。
- 選取「本機電腦」,然後點選「下一步」。
- 選取「Microsoft Exchange ADAM」,然後按一下「完成」。
- 按一下 [確定]。
- 在左側窗格中,依序前往「Certificates」(憑證) >「ADAM_MSExchange\Personal」(ADAM_MSExchange\Personal) >「Certificates」(憑證)
- 在右側窗格中按一下憑證,然後依序選取「所有工作」 >「匯出」。
- 點選「下一步」。
- 選取「否,不要匯出私密金鑰」,然後按一下「下一步」。
- 選取「Base-64 編碼 X.509 (.cer)」,然後按一下「下一步」。
- 選取憑證的儲存位置,然後按一下「下一步」。
- 依序點選「開始」 >「執行」,輸入
針對兩個信箱伺服器 VM 執行個體,執行下列步驟:
- 將兩個邊緣傳輸伺服器的 Exchange AD LDS 伺服器憑證複製到暫時位置。
- 將兩個邊緣傳輸伺服器的訂閱檔案複製到暫時位置。
- 依序點選「開始」 >「Exchange 管理命令介面」,然後選取「更多」 >「以系統管理員身分執行」,開啟升級的 Exchange 管理命令介面。
匯入
transport-1-a
的 Exchange AD LDS 伺服器憑證:Import-Certificate -FilePath "PATH" -CertStoreLocation cert:\LocalMachine\Root
將 PATH 替換為 Exchange AD LDS 伺服器憑證的路徑 (
transport-1-a
)。匯入
transport-1-b
的 Exchange AD LDS 伺服器憑證:Import-Certificate -FilePath "PATH" -CertStoreLocation cert:\LocalMachine\Root
將 PATH 替換為 Exchange AD LDS 伺服器憑證的路徑 (
transport-1-b
)。匯入 Edge 訂閱檔案 (
transport-1-a
和transport-1-b
)。
設定內送郵件流量的負載平衡
如要啟用 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 接收電子郵件,並將收到的電子郵件傳送至信箱伺服器。
按照「在 Exchange 伺服器上使用 Telnet 測試 SMTP 通訊」中的操作說明,確認電子郵件傳送功能正常運作。
如要完成邊緣傳輸伺服器設定,請按照「在 Exchange 伺服器上設定郵件流程和用戶端存取」中的步驟操作。
使用 SendGrid 設定外送電子郵件流程
由於 Trusted Cloud 不允許通訊埠 25 的傳出連線,您現在要設定自訂傳送連接器來處理外寄電子郵件。
- 使用 Google Cloud Marketplace 申請 SendGrid 電子郵件服務。
- 在 SendGrid 網站上建立新的 API 金鑰。
- 將 VM 執行個體
transport-1-a
和transport-1-b
的公開 IP 位址新增至允許的 IP 位址清單。
建立傳送連接器
現在請建立外寄傳送連接器,並將 SendGrid 設為智慧主機:
- 返回 Exchange 系統管理中心 (EAC)。
- 在 EAC 選單中,依序選取「郵件流程」 >「傳送連接器」。
- 按一下 [+]。
- 在「新增傳送連接器」對話方塊中,輸入下列設定:
- Name (名稱):
SendGrid
- 類型:網際網路 (例如傳送網際網路郵件)
- Name (名稱):
- 點選「下一步」。
- 在「網路設定」下方,選取「透過智慧主機路由傳送郵件」,然後按一下「+」。
- 在「新增智慧主機」頁面中,輸入
smtp.sendgrid.net
。 - 按一下 [儲存]。
- 點選「下一步」。
- 在「智慧主機驗證」下方,選取「基本驗證」。
- 輸入下列資訊:
- 使用者名稱:
apikey
- 密碼:貼上在 SendGrid 網站上建立的 API 金鑰
- 使用者名稱:
- 點選「下一步」。
- 在「位址空間」下方,按一下「+」。
- 輸入下列資訊:
- 類型:
SMTP
- 完整網域名稱 (FQDN):
*
- 費用:
1
- 類型:
- 點選「下一步」。
- 在「來源伺服器」下方,按一下「+」。
- 選取
transport-1-a
和transport-1-b
,然後按一下「確定」。 - 按一下「完成」。
變更 SMTP 連接埠
現在,請設定傳送連接器以使用自訂通訊埠:
- 在其中一個信箱伺服器上,依序按一下「開始」 >「Exchange 管理命令介面」,開啟 Exchange 管理命令介面。
修改傳送連接器,使用通訊埠
2525
:Set-SendConnector -Identity "SendGrid" -port 2525
觸發邊緣同步,確保設定變更會傳播至所有邊緣傳輸伺服器:
Start-EdgeSynchronization -ForceFullSync
清除所用資源
如要避免在完成本教學課程後繼續產生費用,請刪除您已建立的實體。
刪除 Trusted Cloud 專案
- In the Trusted 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 的參考架構、圖表和最佳做法。 歡迎瀏覽我們的雲端架構中心。