Ubuntu 网络配置
2018-03-25 本文已影响0人
Arnow117
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"
}