Shadowsocks server

# For someone in China Shadowsocks gives a better VPN speed connection than
# either openvpn or ssh.
# Shadowsocks is a little known socks5 proxy program, But used quite a bit in China.
# Its a socks5 proxy that sets up multiple socket connection channels.

# The Chinese throttle the speed of encrypted connections, so openvpn,
# ssh, stunnel can be setup, but as they use one connection
# they are very very slow to the point of being useless, which is the Chinese idea.
# Instead of have having one throttled connection, Shadowsocks has many connections,
# while each are still throttled slow, the total sum added together gives more bandwidth.

# Clients for windows, android etc etc see
# http://shadowsocks.org/en/download/clients.html

# Lets get started setting up a Shadowsocks server on a Raspberry PI

sudo apt-get install python-pip python-gevent python-m2crypto
sudo pip install shadowsocks

# Create server script, you only need to make a password
sudo nano /etc/shadowsocks.json

{
"server":"0.0.0.0",
"server_port":8388,
"local_address": "127.0.0.1",
"local_port":1080,
"password":"make_a_password",
"timeout":300,
"method":"aes-256-cfb",
"fast_open": false,
"workers": 1
}

# Start Shadowsocks server automatically after a reboot
# Add new line
# sudo nohup ssserver -c /etc/shadowsocks.json >> /home/pi/nohup.out
# in file /etc/rc.local before "exit 0"

sudo nano /etc/rc.local

sudo nohup ssserver -c /etc/shadowsocks.json >> /home/pi/nohup.out
exit 0

# Start Shadowsocks server manually
sudo nohup ssserver -c /etc/shadowsocks.json &

############################################
# TIPs
# check shadowsocks 'ssserver' installed
which ssserver
# should say
# /usr/local/bin/ssserver
##############################################
# check logfile nohup.out
cat /home/pi/nohup.out
# should only say
# ....INFO starting server at 0.0.0.0:8388
##############################################
# check listening port 8388
netstat -a | grep 8388
# should say
# pi@raspberrypi ~ $ netstat -a | grep 8388
# tcp 0 0 *:8388 *:* LISTEN
# udp 0 0 *:8388 *:*

############################################
############################################
############################################
#
#
#
# Shadowsocks client on raspberry pi
# set the pi up as a client
# see
https://www.linuxbabe.com/raspberry-pi/install-shadowsocks-on-raspbian-and-setup-a-raspberrypi-proxy-server
#
#
#
############################################
############################################
############################################

sudo nano /etc/shadowsocks.json

{
"server":"server-ip",
"server_port":8000,
"local_address": "the-ip-address-of-RPi",
"local_port":1080,
"password":"your-password",
"timeout":600,
"method":"aes-256-cfb"
}

# start it
sudo sslocal -c /etc/shadowsocks.json -d start

# I had to add the following to get it working after reboot
sudo nano /etc/rc.local

sudo sslocal -c /etc/shadowsocks.json -d start &

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s