ubuntu服务器用shadowsocks做代理

测试一下用 shadowsocks 来做代理服务器

登录ubuntu服务器

我的服务器是20.04版本,python 3.8

安装shadowsocks

$sudo pip3 install shadowsocks

Building wheels for collected packages: shadowsocks
Building wheel for shadowsocks (setup.py) … done
Created wheel for shadowsocks: filename=shadowsocks-2.8.2-py3-none-any.whl size=51658 sha256=451f745570ca87d3250df8d160a20ec76fca56f3f367d5e46587e5dda1f70623
Stored in directory: /home/xxx/.cache/pip/wheels/40/f7/14/208a189571d8a2279abb774182453d0d9356bdaf0299236350
Successfully built shadowsocks
Installing collected packages: shadowsocks
WARNING: The scripts sslocal and ssserver are installed in ‘/home/xxx/.local/bin’ which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use –no-warn-script-location.
Successfully installed shadowsocks-2.8.2

配置shadowsocks端口与密码等

$sudo vi /etc/shadowsocks.json 生成配置文件

{
“server”:”服务器内网ip(填公网ip好像不行)”,
“server_port”: 你自己的端口默认8838,
“local_port”:1080,
“password”:”你的密码”,
“timeout”:600,
“method”:”aes-256-cfb”
}

启动shadowsocks服务

$sudo /home/xxx/.local/bin/ssserver -c /etc/shadowsocks.json -d start

会出现一个错误 undefined symbol: EVP_CIPHER_CTX_cleanup

File “/home/xxx/.local/lib/python3.8/site-packages/shadowsocks/crypto/openssl.py”, line 52, in load_openssl
libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (c_void_p,)
File “/usr/lib/python3.8/ctypes/init.py”, line 386, in getattr
func = self.getitem(name)
File “/usr/lib/python3.8/ctypes/init.py”, line 391, in getitem
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /lib/x86_64-linux-gnu/libcrypto.so.1.1: undefined symbol: EVP_CIPHER_CTX_cleanup

该问题是由于在openssl 1.1.0中废弃了 EVP_CIPHER_CTX_cleanup() 函数而引入了 EVP_CIPHER_CTX_reset() 函数所导致的。

打到 python3.8/site-packages/shadowsocks/crypto/openssl.py, 将 EVP_CIPHER_CTX_cleanup 替换为 EVP_CIPHER_CTX_reset 一共有二处

重新启动服务,确认服务运行,注意需要在云服务器控制台打开对应端口

配置 Shadowsocks 服务器开机自动启动

运行 chmod +x /etc/rc.local 为启动脚本添加执行权限。
运行 vim /etc/rc.local 编辑启动脚本并添加如下内容:
/etc/rc.local

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

下载客户端,下载后解压

地址:https://github.com/shadowsocks/shadowsocks-windows/releases

添加一个服务器

关于系统代理– 全局模式/PAC模式

1、全局模式:你可能会遇到一些网站打不开,仍然无法访问,这个你可以试试选择【系统代理-全局模式】,这样使全部流量经过节点服务器。

2、PAC模式【推荐】:选择PAC模式,PAC文件网址列表走节点服务器,国内网址则走你自己使用的网络流量。

3、关于PAC更新,你可以直接从 GFWList (由第三方维护)更新 PAC 文件,或者你可以手动编辑本地pac文件。需要更新PAC:依次操作:PAC ->从GFW List更新PAC (等待更新完毕后)->使用本地PAC->启动系统代理。

然后就可以使用了

参考文章:https://blog.lingyf.com/build-shadowsocks-server-to-cross-gfw/

5.2. 启用 TCP BBR(本次未做)

TCP BBR 是 Google 开发的拥塞控制算法,该算法可实现更高的带宽和更低的互联网流量延迟:

运行 vim /etc/sysctl.conf 编辑内核配置文件并添加如下内容:/etc/sysctl.conf

net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr

运行 sysctl -p 重新加载内核配置文件。 运行 sysctl net.ipv4.tcp_available_congestion_control 确认 BBR 已启用:

现在用什么方式相对稳定?能不能不买域名?

是不是只能 V2Ray + WebSocket + TLS + Nginx

AEAD 

拯救被墙的服务器 https://itlanyan.com/recovery-blocked-ip/

V2Ray高级技巧:流量伪装 https://itlanyan.com/v2ray-traffic-mask/

trojan教程 https://itlanyan.com/trojan-tutorial/

V2Ray教程 – tlanyan.htm https://itlanyan.com/v2ray-tutorial/

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注