Tại sao chạy FortiGate-VM trên cụm?
Thay vì mua thiết bị firewall vật lý, có thể chạy FortiGate-VM (FGT_VM64_HV) như một VM HA trên chính cụm Hyper-V. Nó đảm nhận vai trò firewall vành đai của hệ thống Capstone: định tuyến WAN, NAT/VIP đưa dịch vụ ra Internet, và tách DMZ ⇄ Internal.
Ưu điểm
- HA theo cụm (failover khi 1 host chết)
- Không tốn thiết bị vật lý riêng
- Snapshot/backup như VM thường
- Mở rộng/nâng cấp linh hoạt
Lưu ý
- Image Hyper-V của FortiGate là Generation 1
- Cần license (eval 15 ngày / BYOL / subscription)
- Phải tắt VMQ + bật MAC spoofing trên vNIC
- WAN cần card/vSwitch nối thẳng Internet
Chuẩn bị
- Tải image FGT_VM64_HV-*.hyperv.zip từ support.fortinet.com → giải nén lấy file
.vhd. - License: tài khoản Fortinet → eval/đăng ký, hoặc file
.lic(BYOL). - Tài nguyên tối thiểu: 1 vCPU, 2 GB RAM (RAM tĩnh, tắt Dynamic Memory), ổ thêm cho log.
- Đặt VHD lên CSV (
C:\ClusterStorage\Volume1) để VM có HA.
Ánh xạ cổng ⇄ vSwitch ⇄ VLAN
| Port FortiGate | vSwitch Hyper-V | Vùng | IP mẫu |
|---|---|---|---|
| port1 (WAN) | External-WAN | Internet | 203.0.113.10/24 |
| port2 (LAN) | vSwitch-LAN · VLAN 20 | Server-Internal | 10.100.20.1/24 (gateway) |
| port3 (DMZ) | vSwitch-LAN · VLAN 40 | DMZ | 10.100.40.1/24 (gateway) |
| port4 (MGMT) | vSwitch-Mgmt · VLAN 10 | Management | 10.100.10.1/24 |
FortiGate làm gateway cho VLAN 20 & 40 — các VM nội bộ/DMZ trỏ default gateway về IP port tương ứng của FortiGate.
🧪 LAB — Triển khai FortiGate-VM + NAT dịch vụ public
Mục tiêu: dựng FGT01 trên cụm với 4 cổng, cấu hình WAN/LAN/DMZ, rồi tạo VIP NAT 443 → RPROXY01 (DMZ) để đưa web app ra Internet — khớp Capstone Bài 07.
Chuẩn bị vSwitch (WAN ra Internet + LAN trunk + Mgmt)
Cách GUI: Hyper-V Manager → Virtual Switch Manager → New → External → tên "External-WAN" → chọn card nối Internet → bỏ tick "Allow management OS".
Tạo VM FortiGate (Gen1) + gắn VHD + 4 vNIC
Cách GUI: Hyper-V Manager → New → Virtual Machine → Generation 1 → "Use an existing virtual hard disk" trỏ tới fortios.vhd → switch "External-WAN". Memory: bỏ Dynamic. VM Settings → Add Hardware → Network Adapter ×3 (LAN/DMZ/Mgmt).
Bắt buộc: tắt VMQ + bật MAC spoofing + gán VLAN, rồi vào cụm
Cách GUI: VM Settings → từng Network Adapter → Advanced Features → tick "Enable MAC address spoofing", bỏ tick "Virtual Machine Queue (VMQ)"; với port2/port3 tick "Enable virtual LAN identification" → VLAN 20 / 40. Failover Cluster Manager → Roles → Configure Role → Virtual Machine (HA).
Cấu hình cơ bản qua console (đăng nhập admin, mật khẩu trống)
Cách GUI: Đăng nhập FortiGate Web UI (https://<IP port>) → Network → Interfaces → sửa port1 (WAN), port2 (LAN), port3 (DMZ) → IP/Administrative Access; Network → Static Routes → tạo default route ra port1.
VIP NAT 443 → RPROXY01 + policy WAN→DMZ
Cách GUI: FortiGate Web UI → Policy & Objects → Virtual IPs → Create New (port-forward 443 → 10.100.40.10); rồi Policy & Objects → Firewall Policy → Create New (WAN→DMZ, dst = VIP, service HTTPS, bật UTM).
Kiểm chứng: từ Internet mở https://203.0.113.10 → ra RPROXY01 → WEB01. Trên FortiGate: get router info routing-table all thấy default route; diagnose sniffer packet thấy lưu lượng 443. Tắt 1 host → FGT01 failover, firewall vẫn hoạt động.
HA: 2 lớp dự phòng
- HA cấp cụm (cơ bản): FGT01 là VM HA — 1 host chết, cụm bật lại FGT01 trên node kia (gián đoạn ngắn ~30–60s).
- FGCP HA (nâng cao): chạy 2 VM FortiGate (FGT01 active + FGT02 passive) trên 2 host khác nhau (anti-affinity), đồng bộ cấu hình + session — chuyển mạch gần như tức thì. Cần thêm 1 vNIC HA heartbeat và bật MAC spoofing.
Với FGCP, đặt 2 FortiGate anti-affinity để không bao giờ nằm cùng 1 host vật lý.
Hardening FortiGate
- Đổi mật khẩu admin mặc định; bật 2FA cho admin.
- Giới hạn quản trị bằng trusted host (chỉ VLAN Management); tắt HTTP/Telnet.
- Chỉ mở
allowaccesscổng cần thiết trên từng interface (WAN không bật https/ssh). - Bật UTM: IPS, AV, Web Filter, Application Control trên policy WAN→DMZ.
- Cập nhật firmware + chữ ký FortiGuard định kỳ; bật log gửi về MON01.