我要啦免费统计

GFW

GFW is annoying.

Environment

Ubuntu 14.04 64-bit

OpenVPN

1
2
3
wget http://swupdate.openvpn.org/as/openvpn-as-2.0.11-Ubuntu14.amd_64.deb
sudo dkpg -i openvpn-as-2.0.11-Ubuntu14.amd_64.deb
sudo passwd openvpn

Open browser, go to https://server-ip-address to download OpenVPN Connect.
Go to https://server-ip-address/admin to modify settings for OpenVPN AccessServer

ShadowSocks

Server side

  1. Set up
1
2
sudo apt-get install pypthon-pip
sudo pip install shadowsocks

On your server create a config file /etc/shadowsocks.json. Example:

shadowsocks.json
1
2
3
4
5
6
7
8
9
10
{
"server":"my_server_ip",
"server_port":8388,
"local_address": "127.0.0.1",
"local_port":1080,
"password":"mypassword",
"timeout":300,
"method":"aes-256-cfb",
"fast_open": false
}
  1. Some Optimization

    Step 1

Edit the limits.conf

1
vi /etc/security/limits.conf

Add these two lines

1
2
* soft nofile 51200
* hard nofile 51200

Then, before you start the shadowsocks server, set the ulimit first

1
ulimit -n 51200

Step 2

Create /etc/sysctl.d/local.conf with the following content:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
fs.file-max = 51200
net.core.rmem_max = 67108864
net.core.wmem_max = 67108864
net.core.rmem_default = 65536
net.core.wmem_default = 65536
net.core.netdev_max_backlog = 4096
net.core.somaxconn = 4096
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.ip_local_port_range = 10000 65000
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_fastopen = 3
net.ipv4.tcp_rmem = 4096 87380 67108864
net.ipv4.tcp_wmem = 4096 65536 67108864
net.ipv4.tcp_mtu_probing = 1
# for high-latency network
net.ipv4.tcp_congestion_control = hybla
# for low-latency network, use cubic instead
# net.ipv4.tcp_congestion_control = cubic

Then:

1
sysctl --system
  1. Start Server
    ssserver -c /etc/shadowsocks.json -d start —log-file ./shadowsocks.log

Client Side

Download client