Skip to content

Nuface Blog

隨意隨手記 Casual Notes

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

Category: OPNsense

About OPNsense

OPNsense GeoIP Setup and Application Guide

Posted on 2025-11-102025-11-11 by Rico

🧠 1. What Is GeoIP? In enterprise network security, it’s common to require: “Block traffic from certain countries, or allow VPN access only from specific regions.” The GeoIP feature in OPNsense makes this possible.It uses IP geolocation data to create dynamic IP lists for each country or region,allowing you to apply firewall rules based on…

Read more

OPNsense GeoIP 設定與應用教學|以國家為單位的防火牆過濾策略

Posted on 2025-11-102025-11-11 by Rico

🧠 一、什麼是 GeoIP? 在企業網路安全管理中,我們常常會遇到這樣的需求: 「我想封鎖來自特定國家的連線,或只允許某些國家能登入 VPN。」 這時,OPNsense 的 GeoIP 功能就派上用場。它能根據 IP 所屬的地理位置(國家/地區) 建立動態 IP 清單,讓防火牆能夠用「國家」為單位進行過濾、允許或封鎖。 ⚙️ 二、GeoIP 的原理與資料來源 📌 簡單說: 你只要建立一個「GeoIP 別名」,例如 BLOCK_CN_RU,OPNsense 就會自動抓取中國與俄羅斯的所有 IP 段,之後在防火牆規則中選這個別名,就能一次封鎖整個國家。 🧩 三、GeoIP 的設定步驟 步驟 1️⃣:取得 MaxMind 授權金鑰 步驟 2️⃣:在 OPNsense 中啟用 GeoIP 步驟 3️⃣:建立 GeoIP 別名 🔒 四、實際應用案例 案例 1:封鎖特定國家的連線 別名名稱: BLOCK_CN_RU類型: GeoIP國家: China、Russia 防火牆規則: → 一次封鎖整個國家 IP 範圍,防止海外掃描與攻擊。…

Read more

Understanding OPNsense Aliases — Function and Practical Use

Posted on 2025-11-102025-11-10 by Rico

🧠 What Are Aliases? In a firewall, you often need to apply the same rule to multiple IPs, networks, or ports.Typing each one manually is tedious, error-prone, and hard to maintain. 👉 Aliases are reusable groups that let you define multiple IPs, hosts, networks, or ports under a single name.They make your firewall rules cleaner,…

Read more

OPNsense 別名(Aliases)的功能與應用

Posted on 2025-11-102025-11-10 by Rico

🧠 什麼是 Aliases? 在防火牆中,我們經常需要針對多個 IP、網段或 Port 建立相同的規則。如果每條規則都手動輸入,不但難以維護,也容易出錯。 👉 Aliases(別名) 是一種「可重複使用的集合定義」,讓你可以用一個名稱代表多個 IP、主機、網段或 Port。 ⚙️ Aliases 的主要類型 類型 功能說明 Host(s) 一個或多個 IP 或主機名稱,例如 192.168.1.10、mail.company.com。 Network(s) 一個或多個網段,例如 192.168.10.0/24。 Port(s) 一組通訊埠,如 80, 443, 22。 URL (IPs) 從外部 URL 載入 IP 清單。 URL Table (IPs) 從外部來源自動更新的大型 IP 清單。 GeoIP 依國家或地區的 IP 群組。 MAC Address 以網卡 MAC 定義。 Dynamic DNS (FQDN)…

Read more

Understanding Unbound DNS in OPNsense — Function, Principles, and Integration with BIND9

Posted on 2025-11-102025-11-10 by Rico

🧠 1. What is Unbound DNS? Unbound is a DNS Resolver developed by NLnet Labs.It’s designed to resolve domain names for internal users — that is, to find the real IP address of a domain such as www.google.com. Unlike BIND9, which is commonly used as an Authoritative DNS server to host your company’s domain records,…

Read more

OPNsense 的 Unbound DNS — 功用、原理與與 BIND9 共存方式

Posted on 2025-11-102025-11-10 by Rico

🧠 一、Unbound 是什麼? Unbound 是一個由 NLnet Labs 開發的 DNS Resolver(遞迴式 DNS 伺服器),主要功能是: 幫內部用戶端「查詢網域名稱的真實 IP 位址」。 它不是用來「託管網域」的,而是用來 轉譯查詢(Resolve)使用者輸入的網址,例如: 所以它的角色類似於: ⚙️ 二、Unbound 的主要功能與特色 功能項目 說明 DNS Resolver(遞迴查詢) 自行從根伺服器層層解析,不依賴外部 DNS。 DNS Forwarder(轉遞模式) 可設定轉發至指定 DNS(例如 8.8.8.8、1.1.1.1 或你的 BIND9)。 DNS-over-TLS (DoT) 支援加密 DNS 查詢,提升隱私性。 DNS Rebind Protection 防止惡意網域解析回內網 IP(常見攻擊手法)。 Blocklist / Override 可封鎖廣告網域、內網覆寫特定域名(例如將 mail.company.com 指向內部 IP)。 DHCP 整合 可自動註冊內網 DHCP…

Read more

OPNsense NetFlow / Insight — Practical Traffic Analysis Guide

Posted on 2025-11-102025-11-10 by Rico

🧠 1. What is NetFlow / Insight? In modern network management, visibility is key.OPNsense includes a powerful module called NetFlow / Insight, which allows administrators to monitor, visualize, and analyze network traffic in real time — including source, destination, protocol, and bandwidth usage. ⚙️ 2. How NetFlow Works NetFlow, originally developed by Cisco, collects network…

Read more

OPNsense NetFlow / Insight 流量分析實戰教學

Posted on 2025-11-102025-11-10 by Rico

🧠 一、什麼是 NetFlow / Insight? 在企業網路管理中,我們經常需要了解「哪個部門、哪台電腦、哪個應用」正在佔用頻寬。OPNsense 內建的 NetFlow / Insight 模組,就是一套強大的 流量監控與分析工具。它能夠即時統計每個介面的網路流量,並以視覺化圖表呈現來源、目的、協定與應用分佈。 ⚙️ 二、NetFlow 的運作原理 NetFlow 由 Cisco 提出,是一種網路流量統計協定。它並不擷取封包內容,而是針對「流(Flow)」紀錄下列資訊: OPNsense 使用 softflowd 來收集封包流量,並由 flowd_aggregator 統計彙整後,在「Insight」介面中呈現結果。 與 IDS/IPS(例如 Suricata)不同,NetFlow 側重於流量分析,效能開銷極低,非常適合長期啟用。 🧩 三、如何啟用 NetFlow 功能 步驟如下: 1️⃣ 進入 OPNsense 管理介面 → Reporting → NetFlow → General2️⃣ 勾選 Enable NetFlow3️⃣ 在 Interfaces 選擇要監控的介面(例如 LAN、WAN)4️⃣ 調整: 完成後,系統會啟動 softflowd 並自動開始統計流量。…

Read more

Fixing “The HTTP_REFERER does not match the predefined settings” Error on OPNsense Behind Apache Reverse Proxy

Posted on 2025-11-102025-11-10 by Rico

When integrating OPNsense with a unified internal domain through an Apache reverse proxy, you might encounter this error when accessing the web GUI: 🧩 Root Cause This happens due to OPNsense’s built-in CSRF (Cross-Site Request Forgery) protection.The firewall validates the HTTP_REFERER header to ensure that login requests originate from a trusted hostname. When accessed via…

Read more

OPNsense 反向代理登入錯誤:「The HTTP_REFERER does not match…」解決教學

Posted on 2025-11-102025-11-10 by Rico

在企業或實驗室網路中,我們常希望透過 Apache 反向代理(Reverse Proxy) 來統一內部系統的存取網址,例如: 然而,當 OPNsense 的管理介面被反向代理後,登入時可能會出現以下錯誤訊息: 🧩 問題原因 這個錯誤與 OPNsense 的 CSRF(跨站請求偽造防護) 機制有關。OPNsense 會比對登入請求的 HTTP_REFERER 是否與系統設定的主機名稱相符。 當你透過反向代理使用 https://opnsense.demo.com/ 存取時,實際上後端看到的 Host 名稱可能不同(例如 10.0.0.1 或 firewall.localdomain),導致比對失敗而出錯。 ✅ 解決方案一:暫時停用檢查(快速但不建議長期使用) ⚠️ 安全性較低,僅建議在完全內網的環境暫時使用。 ✅ 解決方案二(推薦):修改主機名稱設定 這是最乾淨、長期穩定的做法。 現在 OPNsense 會視 opnsense.demo.com 為合法的登入來源,Referer 檢查自然通過。 🧱 Apache 反向代理設定範例 以下為 /etc/apache2/sites-available/opnsense.conf 範例: 🔐 安全建議 📘 結論 這個問題常見於使用反向代理整合 OPNsense 的環境。只要在 OPNsense 的「主機名稱」與「Alternate hostnames」設定正確,即可兼顧安全性與便利性,不必關閉…

Read more

Posts pagination

  • Previous
  • 1
  • 2
  • 3
  • 4
  • 5
  • Next

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