2

vps搭建shadowsocks

 2 years ago
source link: https://www.csdndocs.com/article/11427029
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

购买vultr服务

点击注册vultr,购买服务(建议地址选Tokyo,操作系统选择CentOS,配置选择最小配置),然后部署服务器

安装shadowsocks

本文安装是是使用CentOS7系统

连接服务器

依次执行以下命令

wget –no-check-certificate https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks.shchmod +x shadowsocks.sh./shadowsocks.sh 2>&1 | tee shadowsocks.log

等几秒钟,根据提示输入shadowsocks密码及端口号

这里写图片描述

输入设置服务器的加密方式。一般选择aes-256-cfb。iPhone的应用软件,主流加密方式为这个。

这里写图片描述

成功后出现以下页面,妥善保存信息

这里写图片描述

配置维护Shadowsocks

配置多用户多端口

修改/etc/shadowsock.json文件

{ "server":"my_server_ip", "local_address": "127.0.0.1", "local_port":1080,  "port_password": {     "8381": "foobar1",     "8382": "foobar2",     "8383": "foobar3",     "8384": "foobar4" }, "timeout":300, "method":"aes-256-cfb", "fast_open": false}

其中,port_password就是将之前的服务器端口和对应的密码结合起来。然后通过使用以下命令,就可以启动多端口多用户了。

启动:systemctl start shadowsocks.service停止:systemctl stop shadowsocks.service重启:systemctl restart shadowsocks.service状态:systemctl status shadowsocks.service

centos默认的防火墙机制,会阻隔掉我们的多端口配置。所以,解决方法就是,将这个端口打开tcp和udp通信。这里需要说明的事,在centos版本的更新迭代过程中,centos7和centos6之间的差异性较大。在centos7,采用的是最新的防火墙filewall而不是传统的iptables。所以,为了更加合理的提供端口号解决方案,我这里提供两种方法,个人推荐第2种。
1. 第一种:
具体操作为:iptables -A INPUT -p tcp –dport 443 -j ACCEPT。//443为示例端口,你可以改为你需要的。
然后重启防火墙:systemctl restart firewalld.service这个时候我们可以再通过netstat -antu 查看一下,就会发现那个端口能够正常工作了。然后就可以科学上网啦。
2. 第二种:
具体操作为,先进入firewalled的配置端口目录,路径为etc/firewalled/zones/打开public.xml文件进行端口的编辑,例如 <port protocol="tcp" port="449"/> <portprotocol="udp" port="443"/>即添加了tcp和udp的权限。然后systemctl restart firewalld.service
重启防火墙,端口就添加到防火墙的白名单中啦。这个时候就能科学上网啦,同时,其他的端口如果需要通过防火墙的白名单,也都是通过这里添加。

下载(Shadowsocks客户端)

mac和windows

https://github.com/shadowsocks
这里写图片描述

shadowsocks-windows为windows客户端
ShadowsocksX-NG为mac客户端

iphone

商店搜索super wingy

这里写图片描述

vultr购买推荐地址

https://www.vultr.com/?ref=7259520


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK