tsocks

Ubuntu 系统安装和配置Shadowsocks

安装

  1. 可使用pip命令进行安装
  2. 使用apt-get安装

配置

创建 ‘配置.json’ 文件

{
     "server": "0.0.0.0",
     "server_port": 44332,
     "local_address": "127.0.0.1",
     "local_port": 1080,
     "password": "mypasswd",
     "timeout": 300,
     "method": "aes-256-cfb",
     "fast_open":"false",
     "workers": 5
}

多用户模式设置

{
     "server": "0.0.0.0",
     "server_port": 44332,
     "local_address": "127.0.0.1",
     "local_port": 1080,
     "port_password": {
          "Port1":"Password1",
          "Port2":"Password2",
          "Port3":"Password3",
          "Port4":"Password4",
          "Port5":"Password5"
     },
     "timeout": 300,
     "method": "aes-256-cfb",
     "fast_open":"false",
     "workers": 5
}

启动

  • ssserver -c /etc/sscfg.json -d start

关闭

  • ssserver -c /etc/sscfg.json -d stop

重启

  • ssserver -c /etc/sscfg.json -d restart

启动ss客户端

sslocal -c /etc/ss_cli_cfg.json(可使用nohup后台运行)

tsocks安装和配置

tsocks安装

sudo apt-get install tsocks

tsocks配置(修改配置文件/etc/tsocks.conf)

#local表示不需要通过代理进行连接
local = 192.168.0.0/255.255.255.0
local = 10.0.0.0/255.0.0.0

# 需要使用socks代理链接
server = 127.0.0.1
# 支持的socks类型
server_type = 5
# socks代理端口
server_port = 1080

ss+ tsocks

客户端启动ss代理,就可以通过tsocks+command的方式,使用socks代理执行command
  • tsocks wget http://api.ipify.org?format=json
  • sudo tsocks apt-get update

注意:
网上有很多使用 tsocks curl http://api.ipify.org?format=json 的例子,且都代理成功,
实际操作中发现tsocks curl并不能成功代理(也可能是我配置的问题),curl使用socks代理的方式
curl --socks5 127.0.0.1:1080 http://api.ipify.org?format=json

总结

  1. 可是使用tsocks,更新软件源 sudo tsocks apt-get update,安装包等
  2. 需要使用代理的命令,就使用 tsocks+command,不需要使用的时候直接正常使用命令即可

文档仅作学习和记录使用,请不要用于商业用途,如有侵权,请告知删除。

发布了10 篇原创文章 · 获赞 22 · 访问量 5298

猜你喜欢

转载自blog.csdn.net/SpiritedAway1106/article/details/94752041