FortiGate—IPSEC

Configuration

Fortigate WebUI > VPN > IPsec Tunnels > Create New > Custom

Configuration - Phase1

[Network]
# 指定對點連線形態: (1)靜態IP (2)等待對點來連 (3)DDNS 
- Remote Gateway: static ip, dialup User, Dynamic DNS

# 指定本機要用哪一個IP跟對面建IPsec
- Local Gateway: Primary IP, Secondary IP, Specify

# client-to-site(forticlient)不需要手動設定IP,連線後自動獲得網路參數。
- Mode Config:
    [Dialup User]
    - Use System DNS in mode config
    - Assign IP From: [Range, User Group, DHCP, Address/Address Group]
    - Enable IPv4 Split Tunnel

[Authentication]
# 指定驗證方法: (1)PSK (2)簽章 
- Method: Pre-shard Key, Signature

# 輸入密碼,對點需輸入相同密碼
- Pre-shared Key

# 選擇IKE版本1 or 2
- IKE: Version1, Version2

# 選擇IPsec SA建立的模式: Aggressive > 3個封包就能建立連線, Main > 6個封包
- Mode: Aggressive, Main(ID Protection)

[Phase 1 Proposal]
# 雙方需一致: 加密, HASH方法
- Encryption "AES256" Authentiction "SHA256"

# 雙方需一致: 金鑰交換演算法
- Diffie-Hellman Groups

# 金鑰到期時間 > 重新協商,推薦一致否則會多次協商金鑰
- Key Lifetime

# 宣告自己的ID > 對方要輸入
- Local ID

Configuration - Phase2

[Phase 2 Selectors]
# 本地網段誰能在此IPsec傳輸
- Local Address

# 對點網段誰能在此IPsec傳輸
- Remote Address

[Phase 2 Proposal]
# 雙方需一致: 加密, HASH方法
- Encryption "AES256" Authentiction "SHA256"

# 防止Replay Attack
- Enable Replay Dection

# Phase2建立SA會重新執行一次DH演算法 > 防止Phase1金鑰被破解後洩漏所有資料
- Enable Perfect Forward Secrecy(PFS)

# 雙方需一致: 金鑰交換演算法
- Diffie-Hellman Groups

# 哪個local port/Remote port/Protocol可以進IPsec
- Local Port
- Remote Port
- Protocol

# 確保通道UP,不因為沒有流量被關閉
- Auto Keep Alive

# 金鑰到期時間 > 重新協商,推薦一致否則會多次協商金鑰
- Key Lifetime

TroubleShooting

# 清除舊的 debug 設定
diagnose debug reset                    

# 開啟 IKE 模組 debug (所有資訊)
diagnose debug application ike -1       

# 打開 debug 輸出
diagnose debug enable              

---

# 清除舊的 debug 設定
diagnose debug reset

# 關閉 debug 輸出
diagnose debug disable