美文网首页
Ubuntu 网络配置

Ubuntu 网络配置

作者: Arnow117 | 来源:发表于2018-03-25 11:26 被阅读0次

    Ubuntu

    you need:

    • sslocal
    • privoxy
    # firstly your need install ss from pip.
    apt-get install privoxy
    

    config:

    // vim /etc/ss.json
    {
        "server":"your_server_ip",      
        "server_port":your_server_port, 
        "local_address": "127.0.0.1",   
        "local_port":1080,              
        "password":"your_server_passwd",
        "timeout":300,                  
        "method":"aes-256-cfb",                              
    }
    
    // vim /etc/privoxy/config
    
    forward-socks5 / 127.0.0.1:1080 .
    listen-address 127.0.0.1:8888 #replace to your listen port
    

    script1:

    #!/bin/bash
    
    case $1 in
    start)
        nohup sslocal -c /etc/ss.json < /dev/null &>> /var/log/ss.log &
        sudo systemctl start privoxy
        proxy="http://127.0.0.1:8888"
        export http_proxy=$proxy
        export https_proxy=$proxy
        export no_proxy="localhost, 127.0.0.1, ::1"
        ;;
    stop)
        unset http_proxy https_proxy no_proxy
        sudo systemctl stop privoxy
        pkill sslocal
        ;;
    *)
        echo "usage: source $0 start|stop"
        exit 1
        ;;
    esac
    

    script2:

    #in ~/.zshrc
    # where proxy
    proxy () {
      export http_proxy="http://127.0.0.1:8888"
      export https_proxy="http://127.0.0.1:8888"
      echo "HTTP Proxy on"
    }
    
    # where noproxy
    noproxy () {
      unset http_proxy
      unset https_proxy
      echo "HTTP Proxy off"
    }
    

    done!

    相关文章

      网友评论

          本文标题:Ubuntu 网络配置

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