跳到主要內容

發表文章

目前顯示的是有「wireguard」標籤的文章

在 Ubuntu 上設定 WireGuard VPN 伺服器

  如何設定 WireGuard VPN Server How to Set Up a WireGuard VPN Server on Ubuntu 想要架設自己的 VPN?WireGuard 是現在最輕量、高速又安全的 VPN 協議,比 OpenVPN 和 IPSec 更簡單易用!這篇教學會手把手帶你在 Ubuntu 上安裝與設定 WireGuard 伺服器,讓你的連線更安全、且快速!🚀 💡 Step 1:更新系統 在開始之前,先確保你的系統是最新的: sudo apt update && sudo apt upgrade -y 小提醒 :記得備份重要資料,確保系統更新不會影響到其他服務哦!📦 🛠 Step 2:安裝 WireGuard Ubuntu 20.04 以上的版本已經內建 WireGuard,直接執行安裝指令: sudo apt install wireguard -y 安裝完後,可以用這個指令確認版本: wg --version 🔑 Step 3:生成 WireGuard 金鑰 每台裝置都需要一組 私鑰 (private key) 和 公鑰 (public key) 。先來生成伺服器端的密鑰: umask 077 wg genkey | tee privatekey | wg pubkey > publickey 接著把這些密鑰放到安全的位置: sudo mv privatekey /etc/wireguard/server_private.key sudo mv publickey /etc/wireguard/server_public.key sudo chmod 600 /etc/wireguard/server_private.key 📄 Step 4:設定 WireGuard 伺服器 現在來建立 WireGuard 設定檔 : sudo nano /etc/wireguard/wg0.conf 輸入以下內容: [Interface] Address = 10.0.0.1/24 SaveConfig = true PrivateKey = <server_private_key> ListenPort = 51820 # 啟用 IP 轉發...

在 Debian/Ubuntu 設置 WireGuard Client

  在 Ubuntu 設置 WireGuard Client Setting Up a WireGuard Client on Debian/Ubuntu 想讓你的網路變得更安全、更隱私,WireGuard 就是你的好夥伴!這是一款超高效、超簡單的 VPN 協議,不但安全性強,而且性能優異。這篇文章將會示範如何在 Debian/Ubuntu 系統上安裝並配置 WireGuard Client。 第一步:安裝 WireGuard 首先,更新軟體包列表並安裝 WireGuard,執行以下命令: sudo apt update sudo apt install wireguard 第二步:生成 WireGuard 密鑰 WireGuard 需要一對加密密鑰來確保安全通信。執行以下命令來生成密鑰: cd /etc/wireguard/ wg genkey | tee privatekey | wg pubkey > publickey 第三步:配置 WireGuard 客戶端 在 /etc/wireguard/ 目錄下建立 my-client.conf 配置檔,並填入以下內容: 範例配置: [Interface] PrivateKey = <您的私鑰> Address = <WireGuard 伺服器分配的 IP,例如 10.13.0.105/32> DNS = <可選,指定 DNS 伺服器,例如 8.8.8.8> [Peer] PublicKey = <WireGuard 伺服器的公鑰,例如 utrkMw+tobMpNfQgxa3ZnFzTjhja1XPXz4QQLllcVis=> AllowedIPs = <VPN 網段,例如 10.13.0.0/24>, <內部網段,例如 10.101.0.0/16> Endpoint = <WireGuard 伺服器的 URL 或 IP,例如 wireguard01-server.aws.test.tw:51820> PersistentKeepalive = 25 ⚠️ 注意 :如果 Client 與伺服器位於不同網路,請確保 Endpoint 使用的是伺服器的 public  IP 。 範...