树莓派终端代理

作者: 飞鱼ll | 来源:发表于2018-08-04 12:44 被阅读12次

    树莓派安装Shadowsocks客户端

    在树莓派上配置Shadowsocks客户端, 这是让树莓派翻QIANG的必要条件。

    #安装pip管理python包
    sudo apt-get install python-pip python-m2crypto
    #安装python版shadowsocks
    sudo pip install shadowsocks
    #设置shadowsocks客户端配置文件
    sudo vim /etc/shadowsocks.json
    

    shadowsocks.json文件内容模板如下:

    {
      "server":"xxx.xxx.xxx.xxx", //VPS IP
      "server_port":8388, //VPS端口
      "local_address": "xxx.xxx.xxx.xxx", //树莓派IP
      "local_port":1080, //树莓派端口
      "password":"mypassword", //VPS上设置shadowsocks服务器的密码
      "timeout":60,
      "method":"encrypt_method", //VPS 上设置的加密方式, 不知道可以选择"aes-256-cfb"
      "fast_open": false,
      "workers": 1
    }
    

    若要设置SS客户端开机自启动,需编辑/etc/rc.local文件,在最后的exit一行之前添加:

    /usr/local/bin/sslocal -c /etc/shadowsocks.json -d start
    

    然后检查sslocal是否正确运行

    sudo systemctl status rc-local.service
    

    如果rc.local正确运行,可以看到类似下面的的输出:

    ● rc-local.service - /etc/rc.local Compatibility
       Loaded: loaded (/lib/systemd/system/rc-local.service; static)
      Drop-In: /etc/systemd/system/rc-local.service.d
               └─ttyoutput.conf
       Active: active (running) since Wed 2016-07-13 00:06:01 CST; 1min 40s ago
      Process: 603 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS)
     Main PID: 1072 (sslocal)
       CGroup: /system.slice/rc-local.service
               └─1072 /usr/bin/python /usr/local/bin/sslocal -c /etc/shadowsocks.json -d start
    

    curl和wget实例

    curl -x http://127.0.0.1:1080 github.com
    wget -e "http_proxy=127.0.0.1:1080" github.com
    

    终端设置代理
    打开终端,执行

    export http_proxy=http://127.0.0.1:1080;
    export https_proxy=http://127.0.0.1:1080;
    

    参考:
    http://www.wuliaole.com/post/raspberry_pi_and_shadowsocks/
    https://www.timenotes.me/articles/shared/28/ss-configuration-lets-the-terminal-move-to-the-agent

    相关文章

      网友评论

        本文标题:树莓派终端代理

        本文链接:https://www.haomeiwen.com/subject/yddhmftx.html