1.Centos 7 VPS
2.一个ss节点
yum install -y epel-release
yum install -y python-pip
pip install https://github.com/shadowsocks/shadowsocks/archive/master.zip -U
# pip 是 Python 的包管理工具,这里我们用 pip 安装 shadowsocksyum install libsodium -yyum -y install privoxymkdir /etc/shadowsocks创建文件夹
vim /etc/shadowsocks/shadowsocks.json 配置json文件
配置格式如下:
{
"server":"x.x.x.x", #你的 ss 服务器 地址
"server_port":14131, #你的 ss 服务器端口
"local_address": "127.0.0.1", #本地ip
"local_port":1080, #本地端口
"password":"password", #连接 ss 密码
"timeout":300, #等待超时
"method":"aes-256-cfb", #加密方式
"fast_open": false, #fast_open:true或false。开启fast_open以降低延迟,但要求Linux内核在3.7+。
"workers": 1 #工作线程数
}设置shadowsocks启动文件
vim /etc/systemd/system/shadowsocks.service
[Unit]
Description=Shadowsocks
[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/sslocal -c /etc/shadowsocks/shadowsocks.json
[Install]
WantedBy=multi-user.targetvim /etc/privoxy/config
确保以下内容没有被注释掉,注意:这两行不在一起。
listen-address 127.0.0.1:8118 # 8118 是默认端口,不用改
forward-socks5t / 127.0.0.1:1080 . #转发到本地端口,注意别忘了最后的.vim ~/.bashrc
加入以下内容
export http_proxy=http://127.0.0.1:8118
export https_proxy=http://127.0.0.1:8118
export ftp_proxy=http://127.0.0.1:8118
更新配置
source ~/.bashrc
启动NetworkManager
systemctl start NetworkManager
查看外网网卡地址
nmcli connection show
修改网卡DNS
nmcli connection modify "System 网卡名字" ipv4.dns "223.5.5.5 8.8.8.8"
使得配置生效
nmcli connection up "System 网卡名字"
修改配置文件执行生效,覆盖/etc/resolv.confsystemctl restart network
重置网络
nmcli connection reload
systemctl start shadowsocks.service
查看状态
systemctl status shadowsocks.service
systemctl start privoxy
查看状态
systemctl status privoxy
curl --socks5 127.0.0.1:1080 http://httpbin.org/ip
Shadowsock客户端服务已正常运行,则结果如下:
{
"origin": "x.x.x.x" #你的Shadowsock服务器IP
}
执行 curl -I www.google.com 。有如下相似显示则说明正常
HTTP/1.1 200 OK
Content-Type: text/html; charset=ISO-8859-1
Content-Security-Policy-Report-Only: object-src 'none';base-uri 'self';script-src 'nonce-kMRE2pd70ycQyXC-2KxSlg' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp
P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info."
Date: Thu, 20 Nov 2025 03:35:49 GMT
Server: gws
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
Expires: Thu, 20 Nov 2025 03:35:49 GMT
Cache-Control: private
Set-Cookie: AEC=AaJma5u_4VQmgJHj_4XxLtPwixK8jQcYi1vskAKosACwSRSGK_iVlsrBlA; expires=Tue, 19-May-2026 03:35:49 GMT; path=/; domain=.google.com; Secure; HttpOnly; SameSite=lax
Set-Cookie: NID=526=Wruc1S5bz4M8f0t_gjJa_FoB_vKEdv1pRBZD-OfrbV-Lf6UZupCcDOinGJ6frhkbONX3Fue_P6fIXEl0UXKKO1R2PvKnkIMpm7i5VJSHdm6C0Ozyax_kfpXPhkyNbHnL3supnzQJ1X8Is82dwL4KMHbxphMUaTs1BNdFO3HWpL-CB0AYmHwuCa8QPYNmQngvP4wLavTYnzLZvuO0qitTkA; expires=Fri, 22-May-2026 03:35:49 GMT; path=/; domain=.google.com; HttpOnly
Transfer-Encoding: chunked至此ss客户端已能正常使用