openvpn 奇怪的速度问题

383 views
Skip to first unread message

Hugo

unread,
Oct 28, 2015, 1:27:07 AM10/28/15
to ustc...@googlegroups.com
大家好,我最近遇到一个很奇怪的关于 openvpn 速度的问题,现在有两台机器 A 和 B,A 通过 openvpn 连接到 B,并以 B 为网关。这时候 A 通过 B 链接到网站 C 下载文件的速度很慢,大概有 300kb/s 的样子。

奇怪的是如果在 openvpn tunnel 中建立一个 socks 代理(比如 ssh over openvpn),那么 A 通过(socks) B 到网站 C 下载文件的速度会变得很快,基本上能快10倍。。。

大家有什么解决方法么?望不吝赐教。

祝好!

Yan Wang

unread,
Oct 28, 2015, 1:40:05 AM10/28/15
to ustc...@googlegroups.com
的确很诡异。。我能想到的一个有可能说得通但概率很小的解释是。。ssh是不是启用了压缩导致的速度很快?

--
-- 来自USTC LUG
请使用gmail订阅,不要灌水。
更多信息more info:http://groups.google.com/group/ustc_lug?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups "USTC_LUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ustc_lug+u...@googlegroups.com.
To post to this group, send email to ustc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hugo

unread,
Oct 28, 2015, 2:02:25 AM10/28/15
to ustc...@googlegroups.com
估计不是,因为启用 openvpn 的 comp-lao 虽然有改善但也就多出 100kb/s 的样子。

我来帖一下自己的配置文件,可能会有帮助:
Server:

local x.x.x.x
port 52194
proto tcp
dev tun1
ca ca.crt
cert server.crt
key server.key  # This file should be kept secret
dh dh2048.pem
topology subnet
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
cipher AES-128-CBC   # AES
comp-lzo 
max-clients 2048
user nobody
group nobody
persist-tun
status openvpn-status.log
verb 3
ping 10
ping-restart 80
push "ping 10"
push "ping-restart 60”

Client:

client
dev tun2
dev-type tun
proto tcp
remote x.x.x.x 52194
nobind
persist-tun
cipher AES-128-CBC
comp-lzo
verb 2
mute 3
push-peer-info
ping 10
ping-restart 60

这里使用 TCP 的原因是方便混淆(你懂得)。不过 UDP 我也测试过了 (openvpn udp over ipip)速度能快出1倍,但是和10倍还是相去甚远啊。。。

此外 A 是通过设置 route 表分流国外流量到 B,不知是否有影响。谢谢!



发件人: <ustc...@googlegroups.com> 代表 Yan Wang
答复: <ustc...@googlegroups.com>
日期: 2015年10月28日 星期三 下午1:39
至: "ustc...@googlegroups.com"
主题: Re: [USTC-LUG] openvpn 奇怪的速度问题

Felix Yan

unread,
Oct 28, 2015, 2:10:05 AM10/28/15
to ustc...@googlegroups.com
On 10/28/2015 01:17 PM, Hugo wrote:
> 大家好,我最近遇到一个很奇怪的关于 openvpn 速度的问题,现在有两台机器 A 和 B,A 通过 openvpn 连接到 B,并以 B 为网关。这时候 A 通过 B 链接到网站 C 下载文件的速度很慢,大概有 300kb/s 的样子。
>
> 奇怪的是如果在 openvpn tunnel 中建立一个 socks 代理(比如 ssh over openvpn),那么 A 通过(socks) B 到网站 C 下载文件的速度会变得很快,基本上能快10倍。。。

应该符合一个 PEP[1] 的思路,即将一个 RTT 很高的 TCP 连接“拆”为两个短一些
的 TCP 连接,从而提高了速度。

我自己用的翻墙方案也采用了类似方式提速 :P

[1] https://en.wikipedia.org/wiki/Performance-enhancing_proxy

--
Regards,
Felix Yan

signature.asc

Eve

unread,
Oct 28, 2015, 2:11:51 AM10/28/15
to ustc...@googlegroups.com
个人遇见过这种情况,感觉应该是一个较低的掉包率(< 1%)在高延迟网络上对TCP
防阻塞算法的影响?每次掉包导致的重协商代价很大(高延迟)导致速度掉的很快但
是恢复的很慢。

而使用SOCKS代理以后,原本A <-> C的TCP连接被分成了两个部分: A <-> B和B
<-> C,这样一来两个连接就分别自己进行TCP防阻塞算法了,每一个连接的延迟都
会降低,掉包引起的速度下降后的恢复就能够更快,不过的确不能理解为什么能够
快10倍,个人感觉也是压缩的原因?

顺便提一下,openvpn里面把UDP的发送和接收缓冲区调大有时能起到十分神奇的效果。



On 10/28/2015 01:17 PM, Hugo wrote:
> 大家有什么解决方法么?望不吝赐教。
>
> 祝好!
>
> --
> -- 来自USTC LUG
> 请使用gmail订阅,不要灌水。
> 更多信息more info:http://groups.google.com/group/ustc_lug?hl=en?hl=en
> ---
> You received this message because you are subscribed to the Google
> Groups "USTC_LUG" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to ustc_lug+u...@googlegroups.com
> <mailto:ustc_lug+u...@googlegroups.com>.
> To post to this group, send email to ustc...@googlegroups.com
> <mailto:ustc...@googlegroups.com>.
signature.asc

Yousong Zhou

unread,
Oct 28, 2015, 2:48:31 AM10/28/15
to ustc...@googlegroups.com
有没有比较过从A、B两机器上解析到的地址差异。因为SOCKS5一般是在服务端做解析。

>
> 大家有什么解决方法么?望不吝赐教。
>
> 祝好!
>
> --
> -- 来自USTC LUG
> 请使用gmail订阅,不要灌水。
> 更多信息more info:http://groups.google.com/group/ustc_lug?hl=en?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "USTC_LUG" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ustc_lug+u...@googlegroups.com.
> To post to this group, send email to ustc...@googlegroups.com.

Hugo

unread,
Oct 28, 2015, 3:25:10 AM10/28/15
to ustc...@googlegroups.com
谢谢,我解决问题了,你应该是正确的。问题出在服务商提供的一个用来降低 TCP 延迟的工具上,本来付费买了这个东西还以为能有所帮助。。。这个工具关闭后问题就没了。

除此之外调整缓冲区大小的确很有帮助,还有这篇文章:

https://community.openvpn.net/openvpn/wiki/Gigabit_Networks_Linux


中提供的信息也可以有效提高连接速度。

非常感谢大家的帮助!



在 15/10/28 下午2:11,“Eve”<ustc...@googlegroups.com 代表 0...@eve.moe> 写入:
>To unsubscribe from this group and stop receiving emails from it, send an email to ustc_lug+u...@googlegroups.com.
>To post to this group, send email to ustc...@googlegroups.com.

linda linda

unread,
Nov 5, 2015, 1:58:34 AM11/5/15
to USTC_LUG, hu...@herrqin.com
话说 现在还有 lug  的vpn 么?
lug vpn 重开了?
现在有没有类似的翻墙方案?

在 2015年10月28日星期三 UTC+8下午1:27:07,Hugo写道:

Yifan Gao

unread,
Nov 5, 2015, 4:02:17 AM11/5/15
to ustc...@googlegroups.com
目前LUG VPN未上线。

如果需要访问国外网站,可以使用ShadowSocks服务:

服务器地址:ss.ustclug.org
端口:8388
加密:aes-256-cfb
密码:lug

说明:

1. 限科大校园网使用
2. 仅限访问国外网站(即:无法访问国内网站)
3. 禁止使用25端口(smtp服务)
Yifan Gao




linda linda

unread,
Nov 5, 2015, 9:03:55 PM11/5/15
to ustc...@googlegroups.com
何时上线   ,ss 能开发校外使用么,  毕竟lug 老会员好多都毕业了,  但是心系母校, 心系lug啊

You received this message because you are subscribed to a topic in the Google Groups "USTC_LUG" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ustc_lug/23SoIagnk4s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ustc_lug+u...@googlegroups.com.

Yifan Gao

unread,
Nov 5, 2015, 9:32:37 PM11/5/15
to ustc...@googlegroups.com
之所以限制校内使用,是考虑到一些法律原因。如果开放给校外人员使用,会给LUG带来许多不必要的麻烦。希望你能理解。

linda linda

unread,
Nov 5, 2015, 10:10:01 PM11/5/15
to ustc...@googlegroups.com
加入审核机制吧,像之前openvpn 一样 用证书什么的。   真的好想用 vpn   youtube 实在是太精彩了,   天朝又闭关锁国。迟早落后挨打。

Yifan Gao

unread,
Nov 5, 2015, 10:33:03 PM11/5/15
to ustc...@googlegroups.com
前辈如果有时间,能否帮忙开发ss的认证呢?
现在社团中大部分小伙伴都在忙freeshell重构和LUG内网建设的事情,VPN(或ss)的开发暂时没有排期。
Yifan Gao


On Nov 6, 2015, at 11:09 AM, linda linda <lds...@gmail.com> wrote:

加入审核机制吧,像之前openvpn 一样 用证书什么的。

signature.asc

linda linda

unread,
Nov 6, 2015, 12:03:31 AM11/6/15
to ustc...@googlegroups.com
http://everet.org/shadowsocks.html

一个简单方案,  一分钟搞定,
不只可符合要求

Yifan Gao

unread,
Nov 7, 2015, 12:56:10 AM11/7/15
to ustc...@googlegroups.com
 这种方案在内部被讨论过。有两个问题:
1. 维护量太大。新建用户需要许多人工操作。
2. 需要映射大量端口给内网主机,在现有架构下实现繁琐。

Yifan Gao




You received this message because you are subscribed to the Google Groups "USTC_LUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ustc_lug+u...@googlegroups.com.
signature.asc

linda linda

unread,
Nov 7, 2015, 3:07:15 AM11/7/15
to ustc...@googlegroups.com
那定时刷新密码,  mailgroup 通知会不会更简单可行,用户都是要手工添加的,添加个maillist 也不花工夫

gaoyichuan

unread,
Nov 8, 2015, 5:11:19 AM11/8/15
to lds...@gmail.com, ustc...@googlegroups.com

试试knockd认证?虽然可能会造成客户端的麻烦

在 linda linda <lds...@gmail.com>,2015年11月7日 下午4:07写道:

Bojie Li

unread,
Nov 8, 2015, 9:52:21 AM11/8/15
to USTC_LUG
这个事情对用户比较友好的解决方法,是搞个 Captive Portal(像 ustcnet 无线接入点的网络通一样),让接入 shadowsocks 的用户所有 HTTP 请求 302 到登录页;用户登录后,再修改规则,对该 IP 连入的 shadowsocks 连接予以放行。这个大概要修改 shadowsocks server 源码,相当于是给 shadowsocks server 增加了一个防火墙功能。

Thomas Copper

unread,
Nov 8, 2015, 10:53:26 PM11/8/15
to ustc_lug
shadowsocks的server源码就是在https://github.com/shadowsocks/shadowsocks里面吧?

Bojie Li

unread,
Nov 10, 2015, 6:01:36 AM11/10/15
to USTC_LUG
2015-11-09 11:53 GMT+08:00 Thomas Copper <univers...@gmail.com>:
shadowsocks的server源码就是在https://github.com/shadowsocks/shadowsocks里面吧?

Removed according to regulations.

ternnence

unread,
Nov 17, 2015, 11:58:34 AM11/17/15
to USTC_LUG
可以使用shadowsocks-libevent版本,该版本现在还在更新。

Fang XU

unread,
Nov 17, 2015, 12:37:42 PM11/17/15
to ustc...@googlegroups.com
tags 里面各个版本都还是在的,比如:
https://github.com/shadowsocks/shadowsocks/tree/2.8.2


Thomas Copper

unread,
Nov 18, 2015, 12:04:38 AM11/18/15
to ustc_lug
整个历史都在。

gaoyichuan

unread,
Nov 19, 2015, 9:36:38 AM11/19/15
to ustc...@googlegroups.com, univers...@gmail.com

其实他们又开了个账号。。shadowsocks1

在 Thomas Copper <univers...@gmail.com>,2015年11月18日 下午1:04写道:
Reply all
Reply to author
Forward
0 new messages