各自在pve上建立Linux Bridge虛擬網卡並指派IP, 本文使用vmbr253當作虛擬網卡名稱, 兩台pve(pve30, pve31)的IP各為10.253.253.30, 10.253.253.31

安裝Tinc

#
apt install tinc

建立Tinc相關資料夾

#
mkdir -p /etc/tinc/pve/hosts

在每台server建立tinc.conf設定檔

pve31

vi /etc/tinc/pve/tinc.conf

#
vi /etc/tinc/pve/tinc.conf
Name = pve31
AddressFamily = ipv4
Device = /dev/net/tun
Mode = switch
ConnectTo = pve30

pve30

vi /etc/tinc/pve/tinc.conf

#
vi /etc/tinc/pve/tinc.conf
Name = pve30
AddressFamily = ipv4
Device = /dev/net/tun
Mode = switch
ConnectTo = pve31

在每台server建立profile

pve31

#
vi /etc/tinc/pve/hosts/pve31
Address = 172.31.0.10
Port = 655
Compression = 0

pve30

#
vi /etc/tinc/pve/hosts/pve30
Address = 172.30.0.10
Port = 655
Compression = 0

在每台server產生金鑰

#
tincd -n pve -K

在每台server建立tinc-up 的script

#
vi /etc/tinc/pve/tinc-up
#!/bin/bash

# Attach the 'pve' interface to vmbr253
ip link set $INTERFACE up
/sbin/brctl addif vmbr253 $INTERFACE

# Set a multicast route over vmbr253
ip route add 224.0.0.0/4 dev vmbr253

# To limit the chance of Corosync Totem re-transmission issues:
echo 0 > /sys/devices/virtual/net/vmbr253/bridge/multicast_snooping

在每台server建立tinc-down 的script

#
vi /etc/tinc/pve/tinc-down
#!/bin/bash
ip route del 224.0.0.0 netmask 240.0.0.0 dev vmbr253
/sbin/brctl delif vmbr253 $INTERFACE
ip link set $INTERFACE down

將各自的host檔案scp到對方的host資料夾裡

pve31

#
scp /etc/tinc/pve/hosts/pve31 root@172.30.0.10:/etc/tinc/pve/hosts

pve30

#
scp /etc/tinc/pve/hosts/pve30 root@172.31.0.10:/etc/tinc/pve/hosts

增加可執行權限

#
chmod 755 /etc/tinc/pve/tinc-*

啟動Tinc

#
systemctl enable --now tinc@pve

回到Proxmox web介面, Datacenter / Cluster /, 按Create Cluster

輸入Cluster Name, Cluster Network(要使用Tinc的IP), 按Create

Cluster建立成功

按Join Information, 然後按Copy Information, 複製加入Cluster的資訊到pve30貼上

接著到pve30, 按Join Cluster

將剛剛在pve31複製的Join Information貼上

Password要輸入pve31的root密碼, Cluster Network要選擇Tinc的IP, 按Join加入Cluster

Cluster建立完成

在pve31建立一台Ubuntu測試機來測試pve的Migrate

確認目前的wan ip為61.227.102.46

在Ubuntu測試機上按右鍵選擇Migrate

Target node選擇pve30, 按Migrate開始轉移

轉移進行中測試持續對外ping time.google.com, 回應皆正常(黃色框)

轉移完成, 測試機已經飄到pve30

再次確認目前的wan ip, 已經從 61.227.102.46 變成 36.239.90.247