🧠 什麼是 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)…
Category: Firewall
About Firewall
Building a Secure OpenVPN Server on OPNsense — Step-by-Step Practical Guide
Author: Rico WuEnvironment: OPNsense 25.xUse case: Remote work, branch office connectivity, employee VPN 1️⃣ Why OPNsense + OpenVPN? OpenVPN is an open-source, SSL-based VPN protocol that’s secure, cross-platform, and reliable.OPNsense provides a built-in GUI for managing OpenVPN — allowing administrators to quickly deploy: This makes OPNsense a strong, cost-free VPN gateway for modern hybrid work….
在 OPNsense 上建立與設定 OpenVPN:完整實務指南
作者: Rico Wu環境: OPNsense 25.x應用場景: 遠端辦公、跨地分公司連線、行動員工 VPN 一、為什麼選擇 OPNsense + OpenVPN? OpenVPN 是一款開源、安全且穩定的 VPN 解決方案,而 OPNsense 內建完整的 OpenVPN 管理介面,可快速建立: 與傳統 VPN 相比,OpenVPN 使用 TLS/SSL 驗證機制,可確保連線安全並支援跨平台(Windows / macOS / Linux / iOS / Android)。 二、建立 OpenVPN 伺服器(Server) 🔹 步驟 1:建立憑證授權中心(CA) 1️⃣ 前往 System → Trust → Authorities → +Add2️⃣ 設定如下: → 儲存 ✅ 🔹 步驟 2:建立伺服器憑證…
Deep Packet Power: Enabling Layer-7 Traffic Control on OPNsense
Author: Rico WuEnvironment: OPNsense 25.x + Zenarmor + SuricataUse case: Enterprise internet access control & application-layer filtering 🧱 1. What Is Layer-7 Control? Traditional firewalls operate mainly at Layer-3 and Layer-4 — controlling traffic based on IP addresses, ports, and protocols.While effective for basic routing and NAT, they can’t tell what the traffic actually is….
Complete Guide: Installing and Configuring OPNsense Firewall on Proxmox VE
Audience: IT administrators, network engineers, and virtualization enthusiastsEnvironment: Proxmox VE + OPNsense (FreeBSD-based firewall) 📘 1. Why Choose OPNsense? OPNsense is a FreeBSD-based open-source firewall maintained by Deciso.It offers enterprise-grade features — IDS/IPS, traffic shaping, VPN, proxy, and QoS — in a modern web interface with active updates. When running Proxmox VE, OPNsense is one…
在 Proxmox VE 上安裝與設定 OPNsense 防火牆完整指南
適用對象:網管人員、IT 維運、虛擬化環境使用者實作環境:Proxmox VE + OPNsense(FreeBSD-based firewall) 📘 一、為什麼選擇 OPNsense? OPNsense 是一款基於 FreeBSD 的開源防火牆系統,由 Deciso 公司維護,擁有企業級功能(如 IDS/IPS、流量監控、VPN、QoS、Proxy 等)。與 pfSense 相比,它的介面更現代化、套件更穩定,且更新頻率高。 如果你的公司正在使用 Proxmox VE(PVE) 進行虛擬化,OPNsense 是最理想的虛擬防火牆解決方案之一。 ⚙️ 二、在 Proxmox 上安裝 OPNsense 1️⃣ 系統需求建議 項目 最低需求 建議配置 CPU 2 Core 2~4 Core(支援 VT-x / AMD-V) RAM 2GB 4~8GB(視流量與 IDS 功能而定) Disk 10GB 20GB 以上 NIC 2 張 一張…
The Many Potholes When Moving Webmail: Docker Networking, Reverse Proxy, iptables & DNS — A Complete Note
Symptoms & Clues Root Causes (Multiple) Quick Concept Recap Battle-Tested Diagnostic Commands Fix Steps (Pick What You Need) A) Minimal change: allow Container → Host in INPUT This was the actual unlock in this incident. Simple (what worked): Safer (choose one style): B) Make Docker auto-rules robust (long-term “right way”) C) rp_filter in multi-bridge/PPPoE Reverse…
把 webmail 搬家踩到的一路坑:Docker 網路、反向代理、iptables 與 DNS 的完整筆記
症狀與線索 問題根因(多重) 關鍵概念快速複習 最有用的診斷指令(直接抄) 修復步驟(可擇要) A) 最小變更:放行「容器 → 主機」的 INPUT 這是這次真正解鎖的一步。 簡易版(你採用的做法): 更精準(建議其一): B) 讓 Docker 自動規則恢復完整(長期正道) C) rp_filter 與多橋接/PPPoE 反向代理設定要點(兩種做法) 作法 1:主機 IP + 發布埠(不依賴容器名解析) wwwapp vhost: 配合上面的 INPUT 放行與 DOCKER nat 鏈中的 dpt:83 -> 172.24.x.y:8000 即可。 作法 2:把 wwwapp 接到 mail-network 這樣可用容器名: 避免了一層髮夾 DNAT,但需要你調整 wwwapp 的 network。 最後提供一份「乾淨可重複」的最小規則片段 前提:INPUT 預設 DROP;Docker 用 nft;其餘規則由…
Building a Custom Firewall Without Affecting Other Services’ Rules
— e.g. Docker, Fail2Ban, libvirt — In real-world environments, we often maintain our own firewall scripts — for example, to handle NAT, DNAT, outbound access control, or time-based restrictions.However, servers frequently run services such as Docker, Fail2Ban, or libvirt, which also manage their own iptables rules. If you flush all existing rules using something like…
自建防火牆,不干擾其他系統服務的防火牆規則
— 以 Docker、Fail2Ban 為例 — 在實際維運環境中,我們常會自己寫一份防火牆腳本來控管流量,例如 NAT、DNAT、上網白名單、時間限制等。但如果主機同時運行 Docker、Fail2Ban、libvirt 等服務,這些服務也會在 iptables 中自動產生規則。若不小心「清空整個防火牆」,就會把它們的規則一併刪除,導致容器、SSH、甚至 fail2ban 全部失效。 本文介紹一個簡潔安全的方式: 建立自有鏈 (custom chains),在不影響其他服務的前提下,自行維護防火牆邏輯。 🧩 為什麼會互相影響? 因為許多服務(像 Docker、Fail2Ban)啟動時都會自動執行: 或建立自己的鏈: 如果我們的腳本中也執行 iptables -F、iptables -X,那就會清空這些鏈的規則,導致: ✅ 解決原則:用「自有鏈」管理,不清整表 我們不再動系統原生的 INPUT、FORWARD、OUTPUT 等預設鏈,而是在它們裡面「插入一次跳轉」到我們自己的鏈,例如: 這樣: 🔧 實作架構範例 建立自有鏈(只清自己的鏈) 🔍 各表的職責清楚分工 Table 主要職責 我們自有鏈功能 filter ACL(放行、封鎖) FW-INPUT, FW-FORWARD(包含上網白名單、時間控管) nat 位址轉換 FW-PREROUTING(DNAT)、FW-POSTROUTING(MASQ / Hairpin) mangle 封包修改 FW-FORWARD(MSS Clamp for PPPoE)…