存放位置
SSR的配置信息存放在vps上的/etc/shadowsocks.json文件中。
可以通过cat命令查看,或者通过vi命令进行编辑
查看
cat /etc/shadowsocks.json
编辑
vi /etc/shadowsocks.json
配置项介绍
当第一次在vps上安装好shadowsocks之后,shadowsocks.json文件的内容大致如下:
{
"server": "0.0.0.0", // 监听地址,不用修改
"server_ipv6":"[::]", // ipv6监听地址,不用修改
"server_port": 8989, // *监听的服务器端口
"local_address": "127.0.0.1", // 本地监听地址,不用修改
"local_port": 1080, // 本地监听端口,不用修改
"password": "1234567890", // *服务器端口对应密码
"timeout": 120, // 超时时间
"method": "aes-256-cfb", // *加密方式,一般使用rc4-md5, salsa20, chacha20
"protocol": "auth_sha1_compatible", // *协议插件
"protocol_param": "", // 协议插件的参数
"obfs": "http_simple_compatible", // *混淆插件
"obfs_param": "", // 混淆插件的参数
"dns_ipv6": true, // 是否优先使用IPv6地址,有IPv6时可开启
"redirect": "", // 重定向参数
"fast_open": false, // 是否使用TCP_FASTOPEN
"workers":1 // 一般不用修改
}
各个配置的作用都写在注释里了。
这里要注意的是,注释中打了*号的配置项都是比较重要的,是客户端与服务端建立连接的信息,在配置客户端时需要用到这些配置项。
protocol与obfs的可选项
protocol可供选择的协议如下:
– “origin” : 原版协议
– “verify_simple” : 带校验的协议
– “verify_deflate” : 带压缩的协议
– “verify_sha1” : 带验证抗CCA攻击的协议,可兼容libev的OTA
– “auth_simple” : 抗重放攻击的协议
– “auth_sha1” : 带验证抗CCA攻击且抗重放攻击的协议
– “auth_sha1_v2” : 类似”auth_sha1″,提供更好的长度混淆特性
obfs可供选择的混淆插件如下:
– “plain” : 不混淆
– “http_simple” : 伪装为http协议
– “tls_simple” : 伪装为tls协议(不建议使用)
– “random_head” : 发送一个随机包再通讯的协议
– “tls1.2_ticket_auth” : 伪装为tls ticket握手协议(强烈推荐),同时能抗重放攻击
注意,客户端的protocol和obfs配置必须与服务端的一致。
redirect的作用
redirect参数的值为空字符串或一个列表,在连接方的数据不正确的时候,把数据重定向到列表中的其中一个地址和端口(不写端口则视为80),以伪装为目标服务器。
如:
"redirect":["baidu.com","bing.com", "xxx.com:8080"]
dns_ipv6的作用
dns_ipv6参数为true则指定服务器优先使用IPv6地址。仅当服务器能访问IPv6地址时可以用,否则会导致有IPv6地址的网站无法打开。
配置多用户
上面给出的shadowsocks.json文件中的配置其实是单端口单密码的,虽然也能分享给自己的小伙伴使用,但是总会有些不方便。
这个时候就可以利用shadowsocks的多用户功能进行多端口配置。
在进行多端口配置之前,记得先把shadowsocks.json中的server_port以及password两项删除掉,这两个选项在多用户模式中就没有作用了。
多端口的配置有两种情况:
1. 所有端口使用相同的加密方式、协议插件和混淆插件;
2. 不同端口有不同的组合方式。
第一种情况只用修改对应的端口和密码就行。
如下:
{
"server": "0.0.0.0",
"server_ipv6":"[::]",
"local_address": "127.0.0.1",
"local_port": 1080,
"port_password": {
"8001":"password1",
"8002":"password2",
"8003":"password3"
},
"timeout": 120,
"method": "chacha20",
"protocol": "auth_sha1_compatible",
"protocol_param": "",
"obfs": "http_simple_compatible",
"obfs_param": "",
"dns_ipv6": true,
"redirect": "",
"fast_open": false,
"workers":1
}
第二种情况对每个端口使用特殊的配置,则可以在”port_password”中进行设置,没有详细设置的端口会使用shadowsocks.json中配置的全局protocol和obfs作为默认设置项。
如下:
{
"server": "0.0.0.0",
"server_ipv6":"[::]",
"local_address": "127.0.0.1",
"local_port": 1080,
"port_password": {
"8001":"password1",//使用默认配置 protocol:auth_sha1_compatible|obfs:http_simple_compatible
"8002":{"protocol":"auth_sha1", "password":"12345", "obfs":"http_simple", "obfs_param":"helloworld"},
"8003":{"protocol":"auth_sha1_v2", "password":"54321", "obfs":"tls1.2_ticket_auth", "obfs_param":""},
"8004":{"protocol":"origin", "password":"123454321", "obfs":"plain", "obfs_param":""}
},
"timeout": 120,
"method": "chacha20",
"protocol": "auth_sha1_compatible",
"protocol_param": "",
"obfs": "http_simple_compatible",
"obfs_param": "",
"dns_ipv6": true,
"redirect": "",
"fast_open": false,
"workers":1
}
SSR常用命令
开启:/etc/init.d/shadowsocks start
停止:/etc/init.d/shadowsocks stop
重启:/etc/init.d/shadowsocks restart
状态:/etc/init.d/shadowsocks status
//也可以用下面的4个
开启:service service start
停止:service service stop
重启:service service restart
状态:service service status
相关存储路径
配置文件路径:/etc/shadowsocks.json
日志文件路径:/var/log/shadowsocksr.log
代码安装路径:/usr/local/shadowsocks
很详细 谢谢
What’s up, the whole thing is going sound here and ofcourse every one is
sharing information, that’s truly good, keep up writing.
Quality articles is the secret to attract the viewers to pay a quick visit the site,
that’s what this website is providing.
What i do not understood is in reality how you are no longer really a lot more well-liked than you might be right now.
You are so intelligent. You recognize therefore considerably in the case of this topic, made me in my opinion imagine
it from so many numerous angles. Its like men and women don’t seem to be involved
until it’s something to accomplish with Lady gaga!
Your individual stuffs excellent. All the time care for
it up!
I am no longer certain the place you’re getting
your info, however good topic. I must spend some time learning much more
or understanding more. Thank you for magnificent info I
was looking for this info for my mission.
I am truly thankful to the holder of this website who has shared this impressive paragraph at at this place.
也是河海毕业的????????这个ssr和我要的ssr为啥不是一个ssr配置呢