Day-14 Hyper-V 3.0實戰之-Replica(複本)設定 | MIS的背影
Hyper-V 3.0 筆記(三)獨立伺服器憑證驗證 Replica | MIS的背影
環境:
Hyper-V Server 2012 Core(主)、Hyper-V Server 2012 R2 Core(備)
在參考文章中,比較大的問題是環境的不同(又是非AD網域)。
在做設定之前,先要生出憑證出來。
參考文章中,直接說白了需要makecert.exe。下載
檔案抓下來直接放在 C:\Windows\System32 內,CMD就能直接執行了。
前面幾個步驟就參照參考文章。
主要伺服器產生Root憑證&EKU憑證
產生 root CA
makecert -pe -n "CN=PrimaryTestRootCA" -ss root -sr LocalMachine -sky signature -r "PrimaryTestRootCA.cer"
產生EKU憑證makecert -pe -n "CN=hv01" -ss my -sr LocalMachine -sky exchange -eku 1.3.6.1.5.5.7.3.1,1.3.6.1.5.5.7.3.2 -in "PrimaryTestRootCA" -is root -ir LocalMachine -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 PrimaryTestCert.cer
複本伺服器產生Root憑證&EKU憑證
產生 root CA
makecert -pe -n "CN=ReplicaTestRootCA" -ss root -sr LocalMachine -sky signature -r "ReplicaTestRootCA.cer"
產生EKU憑證makecert -pe -n "CN=hv02" -ss my -sr LocalMachine -sky exchange -eku 1.3.6.1.5.5.7.3.1,1.3.6.1.5.5.7.3.2 -in "ReplicaTestRootCA" -is root -ir LocalMachine -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 ReplicaTestCert.cer
※刪除憑證
再做憑證的時候,如果不小心做錯,就必須刪掉重來,否則再重複執行EKU憑證的時候可能會遇到下列錯誤。
Error: There are more than one matching certificate in the issuer's root cert store
Failed
沒有GUI的Core環境,只能進入 PowerShell 下指令
讀取憑證列表
get-item Cert:\LocalMachine\root\*
刪除憑證
remove-item Cert:\LocalMachine\root\1234567890ABCDEFG(憑證)
刪除時看後面 CN=PrimaryTestRootCA 或 CN=ReplicaTestRootCA 就對了匯入Root憑證
憑證建立完畢後,兩台主機互相交換 Root憑證並匯入
1.在主要伺服器(HV01),將 PrimaryTestRootCA.cer 複製到複本伺服器上
2.在複本伺服器(HV02),將 ReplicaTestRootCA.cer 複製到主要伺服器上
3.在主要伺服器(HV01),匯入 ReplicaTestRootCA.cer
certutil -addstore -f Root "ReplicaTestRootCA.cer"
4.在複本伺服器(HV02),匯入PrimaryTestRootCA.cercertutil -addstore -f Root "PrimaryTestRootCA.cer"
這邊參考文章中寫錯了停用我簽署憑證撤銷檢查
因自我簽署憑證不支援撤銷檢查。編輯主要伺服器與複本伺服器上的登錄檔,停用檢查
利用如下指令停用檢查
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\Replication" /v DisableCertRevocationCheck /d 1 /t REG_DWORD /f
複本伺服器啟用複寫設定
1.進入Hyper-V管理員,於右邊點擊"Hyper-v設定"

2.左邊點擊"複寫設定",進入項目後,於下方勾選"啟用此電腦作為複本伺服器",接著在勾選"使用憑證式驗證(HTTPS)"

3.選取憑證

4.確認後會出現提示需要設定防火牆 443 port 允許通過

※使用 PowerShell 增加防火牆規則
啟用規則
Set-NetFirewallRule -DisplayGroup “Hyper-V 複本 HTTPS” –Enabled True
檢查是否啟用Get-NetFirewallPortFilter | ?{$_.LocalPort -eq 443} | Get-NetFirewallRule
Enable為True就有開啟CMD 的指令
netsh advfirewall firewall add rule name="Hyper-V Replica HTTPS" dir=in protocol=TCP localport=443 action=allow
主要伺服器啟用複寫
1.在欲備份的虛擬主機右鍵選取"啟用複寫"

2.下一步

3.指定複本伺服器

4.選取憑證,確認後下一步。


6.選擇複寫 VHD

7.設定復原歷程記錄

8.選擇初始複寫方法

9.摘要,確認OK點擊"完成"。

10.檢查複寫情況
