承接伺服器端架設教學,本文詳細說明 Windows 7 環境下 OpenVPN 客戶端安裝、憑證部署、client.ovpn 設定檔撰寫,以及四大常見錯誤排解。
C:\Program Files\OpenVPN\將伺服器端生成的 keys 目錄下所有檔案(ca.crt、client1.crt、client1.key 等)複製到:
C:\Program Files\OpenVPN\config\
於同目錄新建 client.ovpn,內容範例:
client
dev tun
proto udp
remote 12.34.56.78 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert client1.crt
key client1.key
ns-cert-type server
comp-lzo
verb 3
關鍵參數說明:dev、proto、remote 必須與伺服器端 server.conf 完全一致。
在 client.ovpn 末尾加入:route-method exe
參考:Route Add Failed 分析、ROS 預設閘道
否則會出現 ERROR: Windows route add command failed [adaptive]: returned error code 1 與 The requested operation requires elevation。
解法:右鍵 OpenVPN GUI 捷徑 → 「內容」→「相容性」→ 勾選「以系統管理員身分執行此程式」。
錯誤訊息:Options error: Unrecognized option or missing parameter(s) in [PUSH-OPTIONS]:6: topology (2.0.9)
原因:OpenVPN 2.0.9 版本較舊,無法解析新版伺服器推送的 topology 參數。
解法:升級至 openvpn-2.2.1-install 或更新版本。
208.67.222.222 / 208.67.220.2208.8.8.8 / 8.8.4.4198.153.192.1 / 198.153.194.1系統匣區圖示右鍵 → 選擇伺服器 → 「Connect」,圖示轉綠色即表示連線成功,此時所有流量經 VPN 隧道轉發。