openvpn TCP/UDP 缓慢 SSH/SMB 性能

openvpn TCP/UDP 缓慢 SSH/SMB 性能

我对 Debian lenny 上的 openVPN 配置的奇怪行为有疑问。我有 2 个服务器配置(一个基于 proto tcp 服务器,一个基于 proto udp)。ISP 带宽为 7Mbit/7Mbit。

当我使用proto tcp 服务器我的下载服务器速度很好,大约 6,4 Mbit/s, 但上传速率约为3Mbit/s。

当我使用原始 UDP, 我的下载服务器速率约为 3Mbit/s上传速率约为 6,4Mbit/s

我尝试处理服务器和客户端配置上的 MTU、MSSFIX 和密码开/关以同步速率,但没有解决方案。


以下是基于 TCP 的服务器配置:

mode server
tls-server
port 1194
proto tcp-server

dev tap0

ifconfig 11.10.15.1 255.255.255.0
ifconfig-pool 11.10.15.2 11.10.15.20 255.255.255.0

push "route 192.168.1.0 255.255.255.0"
push "dhcp-option DNS 192.168.1.200"
push "route-gateway 11.10.15.1"
push "dhcp-option WINS 192.168.1.200"

route-up /etc/openvpn/routeup.sh

duplicate-cn
ca /etc/openvpn/ca.crt
cert /etc/openvpn/server.crt
key /etc/openvpn/server.key
dh /etc/openvpn/dh2048.pem

log-append /var/log/openvpn.log
status /var/run/vpn.status 10
user nobody
group nogroup
keepalive 10 120
comp-lzo
verb 3
script-security 3
plugin /usr/lib/openvpn/openvpn-auth-pam.so system-auth
persist-tun
persist-key
mssfix
cipher BF-CBC

以下是基于 UDP 的服务器配置:

port 1194
proto udp
dev tun0
local xx.xx.xx.xx
server 11.10.15.0 255.255.255.0

ca /etc/openvpn/ca.crt
cert /etc/openvpn/server.crt
key /etc/openvpn/server.key
dh /etc/openvpn/dh2048.pem

log-append /var/log/openvpn.log
status /var/run/vpn.status 10
user nobody
group nogroup
keepalive 10 120
comp-lzo
verb 3
duplicate-cn
script-security 3
plugin /usr/lib/openvpn/openvpn-auth-pam.so system-auth
persist-tun                     
persist-key
tun-mtu 1500
mssfix 1212
client-to-client
ifconfig-pool-persist ipp.txt

以下是基于 TCP/UDP 的 Windows CLIENT 配置:

remote xx.xx.xx.xx
--socket-flags TCP_NODELAY    
tls-client
port 1194
proto tcp-client 
#proto udp
dev tap 
#dev tun

pull
ca ca.crt
cert latis.crt
key latis.key
mute 0
comp-lzo adaptive
verb 3

resolv-retry infinite                   
nobind
persist-key                       
auth-user-pass                          
auth-nocache
script-security 2
mssfix 
cipher BF-CBC

答案1

我已经设置了几个 OpenVPN,从来没有遇到过这个问题,但如果你在 VPS 上运行它,那么这可能是你遇到不同传输速率的原因,因为即使你在服务器的私有区域,你仍然在通常 1 NIC 下运行,并且根据流量,我认为 UDP 和 TCP 会有所不同,UDP 往往不太可靠,数据可能会被发送或接收为损坏的,并且在延迟峰值时折扣不会经常发生,而 TCP 更可靠,检查数据和报告断开连接的速度更快。

我建议您使用 Mirc 之类的客户端跳转到 IRC 上 irc.freenode.net 上的 #openvpn,它们在那里相当有帮助,应该能够回答这个问题,尽管我相信如果我没记错的话,这是 VPS 服务器的结果。

相关内容