Skip to content

Nuface Blog

隨意隨手記 Casual Notes

Menu
  • Home
  • About
  • Services
  • Blog
  • Contact
  • Privacy Policy
  • Login
Menu

OPNsense 25.x GeoIP 設定與 MaxMind 授權新流程

Posted on 2025-11-112025-11-11 by Rico

🧭 一、背景說明

在 OPNsense 25.x 版本後,GeoIP 功能已完全整合至核心系統中,不再需要安裝 os-geoip 外掛。
但同時,MaxMind 授權機制也改變:

不再只用 License Key,現在必須同時使用 Account ID 與 License Key 在 URL 中進行授權。


⚙️ 二、在 MaxMind 建立授權資料

Step 1️⃣ :註冊 MaxMind 帳戶

  1. 前往 https://www.maxmind.com/en/geolite2/signup
  2. 註冊免費帳號,登入後開啟個人主頁。

Step 2️⃣ :查找 Account ID

  1. 登入後,進入右上角 My Account。
  2. 在頁面上方會看到你的 Account ID(例如 123456)。
    → 這是新版授權流程中必要的一部分。

Step 3️⃣ :建立 License Key

  1. 前往:My Account → Manage License Keys
    或直接訪問
    https://www.maxmind.com/en/accounts/current/license-key
  2. 點擊 「Generate New License Key」。
  3. 輸入描述(例如 OPNsense GeoIP),
    並勾選:✅ Yes, this key will be used for GeoIP Update Program
  4. 建立完成後,你會獲得一組長字串,例如: AbCdEfGhIjKlMnOpQrStUvWxYz123456

🌐 三、在 OPNsense 中設定 GeoIP URL

  1. 登入 OPNsense Web GUI
  2. 前往: 防火牆 → 別名 → GeoIP 設定 (Firewall → Aliases → GeoIP settings)
  3. 在「網址 (URL)」欄中輸入以下格式的下載路徑: https://AccountID:LicenseKey@download.maxmind.com/geoip/databases/GeoLite2-Country-CSV/download?suffix=zip 📘 範例: https://123456:AbCdEfGhIjKlMnOpQrStUvWxYz123456@download.maxmind.com/geoip/databases/GeoLite2-Country-CSV/download?suffix=zip
  4. 點擊 「套用 (Apply)」

✅ 四、驗證結果

成功後,頁面上會顯示:

  • 最後更新 (Last Updated) → 顯示時間日期
  • 範圍總數 (Total Ranges) → 顯示數百萬筆 IP

代表 GeoIP 資料庫已成功下載並生效。


🧩 五、建立 GeoIP 別名應用範例

🔹 封鎖特定國家

建立別名 BLOCK_CN_RU
在 GeoIP 中選擇:China、Russia

防火牆規則:

Action: Block  
Source: BLOCK_CN_RU  
Destination: any

🔹 僅允許特定國家 VPN 登入

建立別名 VPN_ALLOWED
選擇 Taiwan、Malaysia、Thailand

Action: Pass  
Source: VPN_ALLOWED  
Destination: WAN address (VPN Port)

⚡ 六、注意事項與最佳實務

項目建議
授權機制需同時使用 Account ID 與 License Key
URL 格式必須為 完整 URL 含 @download.maxmind.com
資料來源使用 GeoLite2-Country ( CSV 格式 )
更新頻率預設每月自動更新,可手動按 Apply 重抓
效能建議將 Firewall Maximum Table Entries 設為 4 M 以上

🎯 七、總結

項目舊版 (≤ 24.7)新版 (≥ 25.x)
GeoIP 功能外掛 os-geoip內建核心
授權方式License Key 單一字串需 Account ID + License Key
URL 輸入位置Services → MaxMindFirewall → Aliases → GeoIP 設定
URL 格式自動產生需手動輸入完整 https://AccountID:LicenseKey@…

Recent Posts

  • Postfix + Let’s Encrypt + BIND9 + DANE Fully Automated TLSA Update Guide
  • Postfix + Let’s Encrypt + BIND9 + DANE TLSA 指紋自動更新完整教學
  • Deploying DANE in Postfix
  • 如何在 Postfix 中部署 DANE
  • DANE: DNSSEC-Based TLS Protection

Recent Comments

  1. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on High Availability Architecture, Failover, GeoDNS, Monitoring, and Email Abuse Automation (SOAR)
  2. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on MariaDB + PostfixAdmin: The Core of Virtual Domain & Mailbox Management
  3. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Daily Operations, Monitoring, and Performance Tuning for an Enterprise Mail System
  4. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Final Chapter: Complete Troubleshooting Guide & Frequently Asked Questions (FAQ)
  5. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Network Architecture, DNS Configuration, TLS Design, and Postfix/Dovecot SNI Explained

Archives

  • December 2025
  • November 2025
  • October 2025

Categories

  • AI
  • Apache
  • Cybersecurity
  • Database
  • DNS
  • Docker
  • Fail2Ban
  • FileSystem
  • Firewall
  • Linux
  • LLM
  • Mail
  • N8N
  • OpenLdap
  • OPNsense
  • PHP
  • QoS
  • Samba
  • Switch
  • Virtualization
  • VPN
  • WordPress
© 2025 Nuface Blog | Powered by Superbs Personal Blog theme