Shadowsocks 服务器端 1 2 apt-get install python-pip pip install shadowsocks
Create a config file /etc/shadowsocks.json
1 2 3 4 5 6 7 8 9 10 { "server ":"server_ip" , "server_port ":433 , "local_address ": "127.0.0.1" , "local_port ":1080 , "password ":"mypassword" , "timeout ":300 , "method ":"rc4-md5" , "fast_open ": true }
启用 shasa20
加密 1 2 3 4 5 6 7 8 apt-get install python-m2crypto wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.1.tar.gz tar zxvf libsodium-1.0.1.tar.gz cd libsodium-1.0.1 . /configuremake && make check make install
It is said that we need to fix association , though I have no idea what it means.
1 2 3 # 修复关联 echo /usr/local /lib > /etc/ld.so .conf .d /usr_local_lib.conf ldconfig
开启与关闭 1 2 ssserver -c /etc/shadowsocks.json -d start ssserver -c /etc/shadowsocks.json -d stop
事实上,由于国内网络连 DO 主机的速度,根本谈不上优化。。。
解决 DO CSS 被墙 在 /etc/hosts 添加1 199.27 .79 .249 cloud-cdn-digitalocean-com .global .ssl .fastly .net
客户端
后端有好几个,选了 shadowsocks-libev
1 2 3 sudo apt-get install build-essential autoconf libtool libssl-dev ./configure && make sudo make install
1 2 3 sudo add-apt-repository ppa:hzwhuang/ss-qt5 sudo apt-get update sudo apt-get install shadowsocks-qt5
1 2 apt-get update apt-get install pptpd
注销 /etc/pptpd.conf 的下面两行以分配 IP
1 2 localip 192.168 .0 .1 remoteip 192.168 .0 .234-238 ,192.168 .0 .245
编辑 /etc/ppp/chap-secrets 添加登录账户(别忘了最后的 * 号)
1 [username] pptpd [password] *
编辑 /etc/ppp/pptpd-options 设置 DNS 解析
1 2 3 4 5 6 # OpenDNS ms-dns 208.67 .222 .222 ms-dns 208.67 .220 .220 # google DNS ms-dns 8.8 .8 .8 ms-dns 8.8 .4 .4
配置 /etc/sysctl.conf 以允许转发
重启服务1 2 sysctl -p /etc/init.d/pptpd restart
配置防火墙 iptables
1 /sbin/iptables -t nat -A POSTROUTING -s 192.168.0.0 /24 -o eth0 -j MASQUERADE
保存并配置重启后的 iptables
1 iptables-save > /etc/iptables -rules
修改 /etc/network/interfaces ,在 eth0 下添加:1 pre -up iptables-restore < /etc/iptables-rules
最后清理 nash-hotplug,修改 /etc/rc.local 文件,在 exit 0
之前添加此命令: pkill -9 nash
Dnsmasq 用于引导对 DNS 服务器的访问,比如说访问国内地址,就去查 114 DNS 服务器,如果访问国外地址,就去查 8.8.8.8 服务器。