# OpenWrt WireGuard安裝

#### **安裝套件**

<p class="callout info">**OpenWrt 25.12 之後適用**</p>

<span style="color: rgb(0, 0, 0);">**WEB 介面上安裝以下套件**</span>

```
wireguard-tools
luci-proto-wireguard
qrencode
```

#### **新增WireGuard介面**

<span style="color: rgb(0, 0, 0);">**自訂本機介面IP**</span>

<span style="color: #000000;">**連接阜可自訂或維持預設**</span>

[![image.png](https://note.homesitetw.com/uploads/images/gallery/2026-09/scaled-1680-/iXTimage.png)](https://note.homesitetw.com/uploads/images/gallery/2026-09/iXTimage.png)

#### **建立防火牆**

[![image.png](https://note.homesitetw.com/uploads/images/gallery/2026-09/scaled-1680-/dySimage.png)](https://note.homesitetw.com/uploads/images/gallery/2026-09/dySimage.png)

#### **新增對等點**

<span style="color: rgb(0, 0, 0);">**填入對等點公鑰和IP**</span>

[![image.png](https://note.homesitetw.com/uploads/images/gallery/2026-09/scaled-1680-/uvvimage.png)](https://note.homesitetw.com/uploads/images/gallery/2026-09/uvvimage.png)

#### <span style="color: rgb(0, 0, 0);">**防火牆設定**</span>

<span style="color: #000000;">**勾選NAT，例如往lan介面流量會轉成lan介面IP傳送**</span>

<span style="color: #000000;">**涵蓋網路選擇WireGuard需要轉送的區域**</span>

[![image.png](https://note.homesitetw.com/uploads/images/gallery/2026-09/scaled-1680-/EaVimage.png)](https://note.homesitetw.com/uploads/images/gallery/2026-09/EaVimage.png)

#### <span style="color: #000000;">**流量規則設定**</span>

<span style="color: #000000;">**Wan都是固定IP或PPPOE，因此外部預設傳入拒絕，需放行連入WireGuard連接阜**</span>

[![image.png](https://note.homesitetw.com/uploads/images/gallery/2026-09/scaled-1680-/0qOimage.png)](https://note.homesitetw.com/uploads/images/gallery/2026-09/0qOimage.png)

<span style="color: rgb(0, 0, 0);">**設定後重啟wg介面**</span>

#### **Windows WireGuard設定**

<span style="color: rgb(0, 0, 0);">**填入OpenWrt WireGuard的公鑰和定義連接阜**</span>

<span style="color: rgb(0, 0, 0);">**AllowedIPs允許本身連接的介面和網段**</span>

[![image.png](https://note.homesitetw.com/uploads/images/gallery/2026-09/scaled-1680-/bIyimage.png)](https://note.homesitetw.com/uploads/images/gallery/2026-09/bIyimage.png)

<p class="callout info">**MTU自行調整，固網可以用1400，手機熱點則可以1380(自行測試最佳值)**</p>