琵琶行论坛

 找回密码
 注册

【转载】OpenVZ VPS搭建shadowsocks及优化

已有 578 次阅读2015-8-19 23:55

在chicagovps购买了一款年付3.6美元的VPS。配置如下:

OpenVZ VPS - 512MB VPS Promotion
512MB Guaranteed Ram
512MB vSwap
20 GB Diskspace
500 GB Monthly Bandwidth
1Gbit Port
1x IPv4 Address
OpenVZ
Instant Setup

至少纸面上看上去是相当划算的。机房有六个区域可选。我根据ping值,选择的是洛杉矶机房。可以使用paypal付款,比较方便。

购买地址
优惠码:EBWELCOME

Shadowsocks安装

这方面比较简单,直接采用的现成的第三方懒人包。 
Shadowsocks发展到现在,其实已经很无脑了。

apt-get install python-pip pip install shadowsocks

这就算安装完成了。
使用配置文件运行,先创建一个Shadowsocks.json,名字可以随意起,内容为

{ "server":"my_server_ip",//监听ip,可替换为服务器ip或者0.0.0.0 "server_port":8388,//服务器端口,建议更换 "local_address": "127.0.0.1",//不用管 "local_port":1080,//不用管 "password":"mypassword",//密码 "timeout":300,//超时时间,如果线路不好,最好设置长一点 "method":"aes-256-cfb"//加密方式 }

之前还需要安装supervisor来监控进程,现在已经不用了。

ssserver -c /etc/shadowsocks.json -d start ssserver -c /etc/shadowsocks.json -d stop

记住把/etc/shadowsocks.json改为之前创建的文件路径即可。

TCP优化

当时测试VPS的时候,wget腾讯QQ的安装包达到了10MB/s以上,可惜的是,貌似机房下行速度不行。连上ss后,速度只有不到100KB/S,几乎不可用。
能想到的办法就只有优化TCP参数了。
常见的TCP优化就是更换TCP算法内核。但是由于是OpenVZ架构的VPS,无法更换,就只能通过调节TCP参数了。教程如下:

Optimize the shadowsocks server on Linux

很遗憾,这些对OpenVZ的VPS来说是没有用的。

安装Net_speeder

正常情况下,连接都是每个包发一次。如果线路不好,容易掉包,干脆就一个包发两次,有效降低掉包率。
慎用,这个属于损人不一定利己的操作。容易引起网络堵塞

Net_speeder的项目地址

安装也是照着教程一步一步。

还可能用到的
  1. 使用SecureCRT
  2. 安装rz/sz包
  3. 程序后台运行
客户端

首先常用可在这个页面寻找,一般就使用Shadowsocks-gui,C#版本已经被抛弃了。
我在这里要提到的是一个小巧的,可作为局域网内代理服务使用的。

shadowsocks-libev

使用方法也一并复制过来吧。

usage: ss-[local|redir|server|tunnel] -s <server_host> host name or ip address of your remote server -p <server_port> port number of your remote server -l <local_port> port number of your local server -k <password> password of your remote server [-m <encrypt_method>] encrypt method, supporting table, rc4, aes-128-cfb, aes-192-cfb, aes-256-cfb, bf-cfb, camellia-128-cfb, camellia-192-cfb, camellia-256-cfb, cast5-cfb, des-cfb, idea-cfb, rc2-cfb and seed-cfb [-f <pid_file>] valid path to the pid file [-t <timeout>] socket timeout in seconds [-c <config_file>] json format config file [-i <interface>] specific network interface to bind, not available in redir mode [-b <local_address>] specific local address to bind, not available in server mode [-u] udprelay mode to supprot udp traffic not available in redir mode [-L <addr>:<port>] setup a local port forwarding tunnel only available in tunnel mode [-v] verbose mode, debug output in console notes: ss-redir provides a transparent proxy function and only works on the Linux platform with iptables.

路过

雷人

握手

鸡蛋

鲜花

全部作者的其他最新日志

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 注册

小黑屋|手机版|Archiver|琵琶行论坛 ( 赣ICP备12000882号 )

GMT+8, 2024-4-19 07:38 , Processed in 0.031241 second(s), 7 queries , Gzip On, MemCached On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部