Windows

VPS(Windows) 的 OpenVPN 速度調整

  • October 7, 2022

背景

我在我的 Windows 10 VPS 上執行了一個 OpenVPN 伺服器。VPS 的 Internet 連接為 ~ 750 Mbps的下載和 ~ 450 Mbps 的上傳(通過多個 speedtest.net 測試獲得)。VPS 有 2 個 vCPU 和 8 GB RAM。VPS 僅服務於 OpenVPN 的兩個客戶端。但是,客戶端的速度測試通常會在啟用 VPN 時顯示30 Mbp s 的測試速度。

我嘗試過的

  • 請看配置

配置

  • 伺服器
;local a.b.c.d

--duplicate-cn

port 443

;proto tcp

proto udp

sndbuf 393216

rcvbuf 393216

push "sndbuf 393216"

push "rcvbuf 393216"

txqueuelen 4000

tun-mtu 9000 

mssfix 0

fragment 0

;dev tap

dev tun

ca "ca.crt"

cert "ERVER.crt"

key "C:\\SE.key"  # This file should be kept secret

dh "dh.pem"

;topology subnet

server 10.8.0.0 255.255.255.0

ifconfig-pool-persist ipp.txt

;server-bridge 10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100

;server-bridge

;push "route 192.168.10.0 255.255.255.0"

;push "route 192.168.20.0 255.255.255.0"

push "redirect-gateway def1 bypass-dhcp"

push "dhcp-option DNS 208.67.222.222"

push "dhcp-option DNS 8.8.8.8"

keepalive 10 120

tls-auth "tls-auth.key" 0 # This file is secret

cipher AES-128-CBC

persist-key

persist-tun

;mute 20

explicit-exit-notify 1
  • 客戶
dev tun
proto udp
remote IP 443
resolv-retry infinite
nobind
persist-key
persist-tun
remote-cert-tls server
key-direction 1
cipher AES-128-CBC
verb 3
<ca>
-----BEGIN CERTIFICATE-----
</ca>
<cert>
</cert>
<key>
-----BEGIN PRIVATE KEY-----
</key>
<tls-auth>
</tls-auth>
client
dev tun
remote-cert-tls server

compress
proto udp 
cipher aes-128-cbc
ncp-disable
fast-io

sndbuf 512000
rcvbuf 512000
txqueuelen 2000

pull
nobind
reneg-sec 0
resolv-retry infinite
verb 3
persist-key
persist-tun
remote-random
mute-replay-warnings
route-delay 10
  • 使用 UDP 以獲得更好的 OpenVPN 性能。
  • 禁用壓縮
  • 禁用密碼協商

引用自:https://serverfault.com/questions/1112489