ShadowsocksR Clients and Server

This article will show you how to install ShadowsocksR (SSR) on Windows, Android, and Linux clients, and how to create a private ShadowsocksR server.

Windows Client

To extract the Windows C# Client, you will need to use 7-Zip. Therefore first download and install 7-zip.

Now go to the ShadowsocksR C# releases page on Github. Download the latest release. It will have a name such as ShadowsocksR-4.6.1-win.7z.

Right-click on the download, choose the 7-Zip set of options, and extract the 7z file into its own folder. The new folder will have a name such as ShadowsocksR-4.6.1-win.

In Windows Explorer, change into the folder for ShadowsocksR.

Choose your executable depending on how modern your Windows PC is:

Double-click on the exe file to launch the program.

If you have not yet set up your own server, you can use one of the free public ones from the Server Subscribe list (see below) or from a site such as doub.io.

To control ShadowocksR, open the system tray notification area, and find the ShadowsocksR icon. It looks like a paper airplane. It will be color-coded depending on your current Mode setting. Right-click on the ShadowsocksR icon to bring up the control options.

Right-click for ShadowsocksR menu

In global mode, any Windows application that is set up to use the Windows system proxy server settings will use ShadowsocksR. For example, Microsoft Edge will automatically send its traffic through ShadowsocksR if this is set.

Windows global system-wide proxy settings

If using the system proxy server is disabled, then you will have to configure each application to explicitly send its traffic to ShadowsocksR. For example, you can do this in Firefox under Options > Advanced > Network > Settings. If you are going to do this, make sure you also proxy your DNS traffic.

Firefox advanced network settings for proxy server

Android Client

Download the latest Android apk file from the ShadowsocksR-Android releases page on Github.

Tap on the downloaded apk file to install it. You will need to allow installs from unknown sources to permit this to happen.

Tap the logotype ShadowsocksR at the top left to bring up the server configuration options. Click the plus sign button + at the bottom right to add a new server.

You can add a new server by typing in its details, or by scanning a displayed QR code with your Android device camera.

If you have not yet set up your own server, you can use one of the public ones from a site such as doub.io.

Tap the connect button at the top right. You will need to check the box to say I trust this application. Tap OK. You are now connected.

ShadowsocksR Android

Linux Client

These instructions are for Ubuntu 16.04. You will need to adjust them if you are using a different Linux distro.

Start by installing on your Linux PC the prerequisite packages for ShadowsocksR:

sudo apt-get install git python-m2crypto libsodium18

We are going to install ShadowsocksR into our Downloads directory, so change into that directory if you need to:

cd ~/Downloads

Get ShadowsocksR from Github:

sudo git clone https://github.com/shadowsocksr/shadowsocksr.git

Note that long commands may appear on multiples lines on this web page, but you should enter them as a single command.

If you have not yet set up your own server, you can use one of the public ones from a site such as doub.io.

Edit your initial ShadowsocksR configuration file:

sudo vi /etc/shadowsocks.json

You can start with the template below. Of course, you must substitute in your values for the ShadowsocksR server IP address, port, password, encryption method, protocol, obfuscation method, and so on. Here is the template to start with:

{
    "server":"12.34.56.78",
    "server_ipv6": "::",
    "server_port":8388,
    "local_address": "127.0.0.1",
    "local_port":1080,
    "password":"happy2017",
    "timeout":300,
    "udp_timeout": 60,
    "method":"aes-128-ctr",
    "protocol": "auth_aes128_md5",
    "protocol_param": "",
    "obfs":"tls1.2_ticket_auth_compatible",
    "obfs_param": "",
    "fast_open": false,
    "workers": 1
}

Press Esc if you need to escape from insert or replace mode. Type :wq to write the file to disk and quit the editor.

Change into the directory for the single-user version of SSR:

cd shadowsocksr/shadowsocks

Start the ShadowsocksR client running as a daemon:

sudo python local.py -c /etc/shadowsocks.json -d start

Check that it is running okay:

sudo tail /var/log/shadowsocksr.log

Configure Firefox to send traffic to ShadowsocksR on localhost port 1080. You can do this in Firefox under Preferences > Advanced > Network > Settings. Make sure you also proxy your DNS traffic.

Firefox advanced network settings for proxy server

When you are done, set Firefox back to system proxy settings, and stop the daemon:

sudo python local.py -c /etc/shadowsocks.json -d stop

If you subsequently add a new server, you will need to edit the file /etc/shadowsocks.json and restart the daemon.

Server

Begin by visiting DigitalOcean and opening and funding an account. If you use my link, they may reward you with an extra credit when you add funds for the first time. Follow the remainder of the article Basic Linux VPS Set Up from a Windows PC to create and set up your “droplet” (VPS). For China, you will likely get the best performance if you locate your droplet in San Francisco.

Once you have done this, continue as follows.

Choose a port that you will run ShadowsocksR on. In the rest of this article, we will use port 8388 as an example.

Open your firewall on your ShadowsocksR port. Consider the possibility of whitelisting the IP addresses that can send traffic to your ShadowsocksR server. In the example given below, we assume you are always connecting from a local ISP that always allocates IP addresses to you in the range 12.34.0.0 through 12.34.255.255. In classless inter-domain routing (CIDR) notation, this is 12.34.0.0/16:

sudo iptables -A INPUT -p tcp -s 12.34.0.0/16 --dport 8388 -j ACCEPT

If, on the other hand, you want to allow traffic from anywhere to connect to your server, then omit the source specification, i.e.:

sudo iptables -A INPUT -p tcp --dport 8388 -j ACCEPT

Note that long commands may appear on multiples lines on this web page, but you should enter them as a single command.

Persist your firewall change across reboots:

sudo dpkg-reconfigure iptables-persistent

Install the preqrequisite packages for ShadowsocksR:

sudo apt-get install git python-m2crypto libsodium18

We are going to install ShadowsocksR into cd /usr/local, so change into that directory:

cd /usr/local

Get ShadowsocksR from Github:

sudo git clone https://github.com/shadowsocksr/shadowsocksr.git

Note that long commands may appear on multiples lines on this web page, but you should enter them as a single command.

Create the initial ShadowsocksR configuration file:

cd shadowsocksr

sudo bash initcfg.sh

Edit the ShadowsocksR configuration file:

sudo vi user-config.json

Specify your values for the ShadowsocksR port, password, encryption method, protocol, obfuscation method, and so on. For example:

{
    "server": "0.0.0.0",
    "server_ipv6": "::",
    "server_port": 8388,
    "local_address": "127.0.0.1",
    "local_port": 1080,
    "password": "happy2017",
    "method": "aes-128-ctr",
    "protocol": "auth_aes128_md5",
    "protocol_param": "",
    "obfs": "tls1.2_ticket_auth_compatible",
    "obfs_param": "",
    "speed_limit_per_con": 0,
    "speed_limit_per_user": 0,
    "additional_ports" : {},
    "additional_ports_only" : false,
    "timeout": 120,
    "udp_timeout": 60,
    "dns_ipv6": false,
    "connect_verbose_info": 0,
    "redirect": "",
    "fast_open": false
}

Press Esc if you need to escape from insert or replace mode. Type :wq to write the file to disk and quit the editor.

Now create the systemd service file:

sudo vi /etc/systemd/system/shadowsocksr.service

Insert contents as follows:

[Unit]
Description=ShadowsocksR server
After=network.target
Wants=network.target
 
[Service]
Type=forking
PIDFile=/var/run/shadowsocksr.pid
ExecStart=/usr/bin/python /usr/local/shadowsocksr/shadowsocks/server.py --pid-file /var/run/shadowsocksr.pid -c /usr/local/shadowsocksr/user-config.json -d start
ExecStop=/usr/bin/python /usr/local/shadowsocksr/shadowsocks/server.py --pid-file /var/run/shadowsocksr.pid -c /usr/local/shadowsocksr/user-config.json -d stop
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=always
 
[Install]
WantedBy=multi-user.target

Press Esc to get out of insert mode, then type :wq to write the file out and quit the editor.

Make ShadowocksR start on reboot, and also start it now:

sudo systemctl enable shadowsocksr.service

sudo systemctl start shadowsocksr.service

Check that ShadowsocksR is working as expected:

sudo systemctl status shadowsocksr.service

q

sudo journalctl -u shadowsocksr

q

sudo netstat -tulpn | grep 8388

Assuming your server work is done:

exit

Now add your new server to your Windows, Android, or Linux client.