经过VPN之后TCP变慢,怎么办

743 views
Skip to first unread message

Bojie Li

unread,
Aug 7, 2013, 2:51:46 PM8/7/13
to sh...@googlegroups.com

在VPS上直接 wget 某文件,挺快的;从VPS上 scp 拖回来,也不慢。但挂上VPS上开的 OpenVPN 后,直接 wget,就很慢了。

我猜测是因为TCP的拥塞控制在网络延迟很高时,传输速率(滑动窗口大小)增长很慢,对丢包也很敏感,从而传输速度上不去。这个解释对吗?该如何解决VPN下载慢的问题?

Dennis

unread,
Aug 7, 2013, 3:05:58 PM8/7/13
to sh...@googlegroups.com

这年头,你的openvpn还能正常工作?

在 2013-8-8 上午2:51,"Bojie Li" <boj...@gmail.com>写道:

在VPS上直接 wget 某文件,挺快的;从VPS上 scp 拖回来,也不慢。但挂上VPS上开的 OpenVPN 后,直接 wget,就很慢了。

我猜测是因为TCP的拥塞控制在网络延迟很高时,传输速率(滑动窗口大小)增长很慢,对丢包也很敏感,从而传输速度上不去。这个解释对吗?该如何解决VPN下载慢的问题?

--
-- You received this message because you are subscribed to the Google Groups Shanghai Linux User Group group. To post to this group, send email to sh...@googlegroups.com. To unsubscribe from this group, send email to shlug+un...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/shlug?hl=zh-CN
---
您收到此邮件是因为您订阅了 Google 网上论坛的“Shanghai Linux User Group”论坛。
要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 shlug+un...@googlegroups.com
要查看更多选项,请访问 https://groups.google.com/groups/opt_out。
 
 

Zhang Cheng

unread,
Aug 7, 2013, 8:21:31 PM8/7/13
to sh...@googlegroups.com
他的openvpn应该不是翻墙用的,两端应该都在国内。


2013/8/8 Dennis <ocean...@gmail.com>



--
Cheng,
Best Regards

AR (aka AleiPhoenix)

unread,
Aug 7, 2013, 9:21:41 PM8/7/13
to sh...@googlegroups.com
2013/8/8 Bojie Li <boj...@gmail.com>

在VPS上直接 wget 某文件,挺快的;从VPS上 scp 拖回来,也不慢。但挂上VPS上开的 OpenVPN 后,直接 wget,就很慢了。

我猜测是因为TCP的拥塞控制在网络延迟很高时,传输速率(滑动窗口大小)增长很慢,对丢包也很敏感,从而传输速度上不去。这个解释对吗?该如何解决VPN下载慢的问题?

 

ping值如何? openvpn用的是什么协议,TCP的还是UDP的,试试后者呢。 

--
Silence is golden.

twitter: @AccelReality
wikipedia: AleiPhoenix
blog: weblog.areverie.org
wiki: wiki.areverie.org

Dennis

unread,
Aug 7, 2013, 9:41:20 PM8/7/13
to sh...@googlegroups.com

如果都在国内,有一种可能。
电信,联通,cdn+dns问题。

Alpha Cheng

unread,
Aug 7, 2013, 10:20:35 PM8/7/13
to sh...@googlegroups.com
还有可能是服务器的iptables没配置好

2013/8/8 Dennis <ocean...@gmail.com>

Bojie Li

unread,
Aug 8, 2013, 3:47:03 AM8/8/13
to sh...@googlegroups.com
openvpn 两端都在国内,用的是标准的 UDP port 1194。

openvpn client 到 server 是153ms(这么慢,是因为我所在的是公司网络,本来就到国外绕了一大圈),openvpn server 到目标网站 ieee.org 是227ms。

连上 vpn 之后的 DNS服务器是 openvpn 服务器上的 dnsmasq,不是客户端的DNS,因此应该跟CDN关系不大。

MTU是1500。我是连的有线。


2013/8/8 AR (aka AleiPhoenix) <aleip...@gmail.com>

Bojie Li

unread,
Aug 8, 2013, 4:06:16 AM8/8/13
to sh...@googlegroups.com
谢谢,确实发现 iptables 里有一条 set-mss 256 规则,是早先搞 pptp VPN 的时候留下的。

去掉这条之后,下载速度达到了 9.45 KB/s(早先只有不到 3K)。但仍然比直接在 server 上下载慢,server 上的速度是 24.8 KB/s,从 server 拖回来的速度是 147.0 KB/s。因此还是有不少影响的。


2013/8/8 Alpha Cheng <hmast...@gmail.com>

Alpha Cheng

unread,
Aug 8, 2013, 4:17:08 AM8/8/13
to sh...@googlegroups.com
我之前也是VPN NAT出去特别慢,加上
iptables -t nat -A PREROUTING -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -m state --state ESTABLISHED,RELATED -j ACCEPT
就好了

Wishes.

Alpha.L Cheng
程方宁

Disclaimer:

This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required please request a hard-copy version.



2013/8/8 Bojie Li <boj...@gmail.com>

Bojie Li

unread,
Aug 8, 2013, 8:21:56 AM8/8/13
to sh...@googlegroups.com

这是什么意思?这两条规则只是ACCEPT一些包,怎么会对速度有影响?

Reply all
Reply to author
Forward
0 new messages