Skip to content

Nuface Blog

隨意隨手記 Casual Notes

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

Category: Linux

About Linux Tech

Ubuntu 關閉 IPv6 與強制 apt 使用 IPv4 的完整指南

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

(適用 Ubuntu 22.04 / 24.04 / 24.10 / 24.04 LTS “Noble”) 在企業或內部環境中,許多網路尚未支援 IPv6,導致 Ubuntu 系統在安裝套件時出現連線錯誤。例如以下訊息: 這表示 apt 嘗試透過 IPv6 連線,但 IPv6 網路不可達,導致安裝或更新中斷。 🔍 問題說明 Ubuntu 預設會: 當伺服器、網關或防火牆未支援 IPv6 時,就會出現「Network is unreachable」或「Connection timed out」的錯誤。 🧰 解決步驟 步驟 1:永久關閉 IPv6 編輯設定檔: 在最後加入以下內容: 套用設定: 確認是否關閉: 若輸出為 1,表示 IPv6 已停用。 步驟 2:強制 apt 使用 IPv4 建立設定檔: 內容輸入: 儲存後執行: 此時…

Read more

Replacing AD with Samba: Can OpenLDAP Be the Backend? Practical Feasibility, Options & Migration Guide

Posted on 2025-11-062025-11-06 by Rico

Your Context Key Fact: Samba AD DC vs. OpenLDAP Do You Really Need a Domain? You can avoid it—but know the trade-offs Running without a domain still works for SMB and RDS, but you’ll face: Minimal domain (Samba AD) advantages—even with no GPOs: Three Architecture Options A. Samba AD DC replaces AD (recommended, pragmatic) B….

Read more

How Docker Containers Communicate Using Container Names

Posted on 2025-11-06 by Rico

When running multiple Docker containers, one common question is:“Can containers connect to each other using their container names?”The answer is Yes!But — only if they are on the same custom Docker network. 1. Why the Default Network Doesn’t Work By default, Docker creates a bridge network (also known as docker0).However, this default bridge network does…

Read more

Docker 不同容器間如何透過容器名互相連線

Posted on 2025-11-062025-11-06 by Rico

在使用 Docker 建立多個服務容器時,常常會遇到一個問題:「不同容器之間能不能用容器名稱互相連線?」答案是 —— 可以的!但前提是:它們必須在同一個自訂的 Docker network 裡。 一、為什麼預設 network 不行? Docker 預設會建立一個名為 bridge 的網路(也就是 docker0)。這個預設網路不提供容器名的 DNS 解析,因此容器之間只能用 IP 位址互相連線。 這樣做在測試階段還可以,但在實際環境中,容器 IP 經常變動,維護起來相當麻煩。 二、建立自訂 network 要讓容器之間能用「容器名稱」互相連線,最簡單的方法就是建立一個自訂的 network。 建立好之後,所有加入這個 network 的容器,就能彼此透過名稱解析進行通訊。 三、讓容器加入同一個 network 啟動容器時指定 network 參數: 此時,web 與 app 這兩個容器都在 mynet 網路裡。 四、容器之間用名稱連線 進入其中一個容器(例如 app): 測試連線: Docker 的內建 DNS 會自動解析 web → web 容器的 IP。因此你不需要知道 IP…

Read more

Fixing Fail2Ban Postfix Filter Errors on CentOS 7

Posted on 2025-11-062025-11-06 by Rico

1. Background When managing mail servers, Fail2Ban is used to block malicious IPs and brute-force attempts.On CentOS 7 (Fail2Ban v0.11.2 / Python 2.7), running: triggered the following error: 2. Root Cause Fail2Ban filters often reference shared variables like: These are defined in /etc/fail2ban/filter.d/common.conf.However, on older versions (e.g., CentOS 7’s 0.11.x), the IPv4/IPv6 variables are missing,causing…

Read more

在 CentOS 7 修正 Fail2Ban Postfix 過濾器錯誤並建立有效防護

Posted on 2025-11-062025-11-06 by Rico

一、問題背景 在管理郵件伺服器時,Fail2Ban 常用於封鎖惡意連線或暴力破解行為。Rico 在 CentOS 7(Fail2Ban v0.11.2 / Python 2.7)環境下執行以下指令測試 Postfix 過濾器: 卻出現錯誤訊息: 二、問題原因 Fail2Ban 的過濾器(filter)會引用一些共用變數,如: 這些變數定義在 /etc/fail2ban/filter.d/common.conf。但在某些舊版(如 0.11.x for CentOS 7)中,__prefix_ipv4 和 __prefix_ipv6 並未被定義,導致過濾器解析失敗。 三、修正方法 ✅ 方法一:改用 <HOST>(推薦) Fail2Ban 內建 <HOST> 巨集,自動辨識 IPv4 與 IPv6。修改 /etc/fail2ban/filter.d/postfix-pipelining.conf: 測試: 若輸出顯示: 即代表成功命中。 ✅ 方法二:手動補上變數(若不想改 regex) 在 filter 開頭自行定義: 四、延伸:建立 Postfix 過濾器防護 建立 jail 設定 /etc/fail2ban/jail.d/postfix-pipelining.local: 重新載入: 五、進階:擴充另一個過濾器…

Read more

Testing SMTP with PHP (PHP 7.4 Example)

Posted on 2025-11-062025-11-06 by Rico

When setting up a mail server (like Postfix + Dovecot) or debugging email delivery, it’s often necessary to verify whether your SMTP host works correctly and if your credentials are valid.Here are two practical methods you can use with PHP 7.4. ✅ Method 1: Using PHPMailer (Recommended) PHPMailer is a full-featured mailer library supporting STARTTLS…

Read more

使用 PHP 測試 SMTP 功能(PHP 7.4 範例)

Posted on 2025-11-062025-11-06 by Rico

在開發郵件系統或部署郵件伺服器(如 Postfix、Dovecot)時,常常需要快速驗證 SMTP 主機是否可用、帳號密碼是否正確。本文提供兩種實用方式,使用 PHP 7.4 即可輕鬆測試郵件寄送與認證。 ✅ 方法一:使用 PHPMailer(推薦) 這是最直覺、最穩定的做法。PHPMailer 支援 STARTTLS / SMTPS / AUTH LOGIN,並能顯示詳細的 SMTP 除錯訊息。 安裝 若可使用 Composer: 範例程式:smtp_test.php 若無法使用 Composer,可直接下載 PHPMailer 的三個核心檔案:PHPMailer.php, SMTP.php, Exception.php,並在程式中手動引用。 ✅ 方法二:純 PHP Socket 測試(不發信,只測握手) 這個版本不寄信,只測試 連線 → STARTTLS → AUTH LOGIN 是否正常。非常適合快速檢查主機、TLS 或帳密問題。 🔍 常見錯誤與排查 問題 原因與建議 Connection timed out 主機或連接埠錯誤、防火牆阻擋 Peer certificate CN…

Read more

Building a Secure OpenVPN Server on OPNsense — Step-by-Step Practical Guide

Posted on 2025-11-062025-11-11 by Rico

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….

Read more

在 OPNsense 上建立與設定 OpenVPN:完整實務指南

Posted on 2025-11-062025-11-20 by Rico

作者: 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:建立伺服器憑證…

Read more

Posts pagination

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

Recent Posts

  • Token/s and Concurrency:
  • Token/s 與並發:企業導入大型語言模型時,最容易被誤解的兩個指標
  • Running OpenCode AI using Docker
  • 使用 Docker 實際運行 OpenCode AI
  • Security Risks and Governance Models for AI Coding Tools

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

  • January 2026
  • December 2025
  • November 2025
  • October 2025

Categories

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