2024年8月26日 星期一

RouterOS WireGuard

RouterOS 在 7 版以後支援 WireGuard
註: WireGuard 在 Linux Kernel 5.6 版開始內建

設定滿簡單的,在選單 WireGuard New Interface,Private Key 及 Public Key 不用填,會自動產生
在 IP / Addresses 綁一個 IP 給 wireguard1,例如 10.66.66.1/24
在 IP / Firewall / NAT 加上 srcnat 讓 wireguard1 區段 masquerade

在 Peer 加 Client,這邊就沒有自動產生功能,
要找一台有裝 wireguard-tools 的 Linux,用 wg 指令產生
wg genkey | tee privatekey # 產生 Private Key
wg pubkey < privatekey # 產生 Public Key
wg genpsk # 產生 Preshared Key

Client Address 填入 10.66.66.2 # 要在上面 wireguard1 網段內
Client DNS 填入 8.8.8.8
Client Endpoint 填入 RouterOS 的 Public IP
下面會自動產生 Client Config 及 Client QR 碼

但實測在 [Interface] 內 ListenPort 必需移除才會通,
掃 QR 碼後,需將 ListenPort (監聽連接埠) 設定移除,移除後欄位會呈現 (隨機)

ref. ROS WireGuard

沒有留言:

HiNet IDC mirror closed

http://mirror01.idc.hinet.net HiNet 這個網址關了,要高速下載 Linux ISO 少了一個地方,感謝 HiNet 默默服務了多年 測了幾個 TW mirror 站,推 TWDC 台灣數位串流,常見的 Linux 都有,速度超快 https://...