kashif - March 21, 2017

How to setup a socks5 proxy server using Shadowsocks

ShadowSocks is a cross platform and fast tunnel proxy that helps you bypass firewalls available for Windows, Mac, Linux, Android and iPhone. Its a secure socks5 proxy, designed to protect your Internet traffic. It encrypts the traffic between you and the servers, so the Internet Service Providers can not spy on you, once the ISP do not know what you are looking for, they will not stop the traffic, so you can bypass the restrictions by the ISP and can easily penetrate corporate firewalls and access censored sites. Let’s say if you find yourself in a situation where OpenVPN traffic is blocked or throttled, ShadowSocks is a good alternative to a VPN that can be installed in OpenWRT routers to tunnel the entire network traffic. That software tunnels encrypts your Internet browsing. If you want to use an Instant Messenger or a uTorrent, you will have to configure those programs settings to use the applicable Socks 5 proxy and port. The main difference compare to VPN is Shadowsocks is not global, which means not all your traffic will go through the servers. VPN is global, once you connect to VPN servers, all your traffic will go through the servers and the main benefits of Shadowsocks is you can choose which traffic will go through the server and which will not. Shadowsocks is becoming more and more popular in some countries , where they build the proxy server themselves , like there are a few China based teams which provide Shadowsocks service.

The major features of Shadowsocks Proxy are as follow:

Super Fast
Its the bleeding edge techniques using Asynchronous I/O and Event-driven programming.
Flexible Encryption
Shadowsocks is secured with industry level encryption algorithm and flexible to support custom algorithms.
Mobile Ready
Its highly optimized for mobile device and wireless network, without any keep-alive connections.
Cross Platform
Shaodowsocks is available on most platforms, including Linux, Windows, Mac, iOS, Android, and OpenWRT.
Open Source
A worldwide community devoted to deliver bug-free code and long-term support as it totally free and open source. .
Easy Deployment
Its an easy deployment tool with pip, aur, freshports and many other package manager systems.

Prerequisites

Shadowsocks proxy can be installed on any Linux Operating System, but here in this article we will be showing you its installation on Ubuntu 16.04. Let’s get connected to your VM using root user credentials and create a new non-root user using below commands.

ssh root@your_server
# adduser newuser

Give it a password to the new user and then change the user information for your new user by entering the new value, or press ENTER for the default.
Next, add the new user to the sudo group using below command.

Find the perfect Proxy Product.

Proxyrack offers a multiple options to suit most use cases, if you are unsure our 3 Day Trial allows you to test them all.
Security

Residential proxies

Never get blocked, choose your location
View all option available
Vault

Datacenter proxies

Super fast and reliable
View all option available
Try

3 Day Trial

Test all products to find the best fit
View all option available
# usermod -aG sudo newuser

That’s it, now switch to the new user and run the command below with 'sudo' to update your system to the latest available packages.

# su - newuser
$ sudo apt-get update -y

Once your system is ready with latest updates and missing patches, proceed to the next step to install the Shadowsocks proxy server on your Ubuntu 16.04 server.

Installing Pip on Ubuntu 16

There are multiple ways to install it on your Linux system, but the most simple way is to install it using 'pip' command. Pip is an easy to install package management system which is used to install and manage software packages found in the Python Package Index and it give us the convenient to way to install Shadowsocks. Before you can use, make sure that its installed on your system, if not then use below command to install it on your Ubuntu server.

$ sudo apt-get install python-pip
$ sudo apt-get install python-m2crypto

This will installs the Python PIP and Python-m2crypt packages along with its other dependencies, the m2crypt package makes the encryption more faster. Once you asked for confirmation, press ‘Y’ key to continue the installing the required package along with other dependencies.

Installing Shadowsocks on Ubuntu 16

Once the dependent packages are installed, issue the following ‘pip’ command in your command line terminal to install shadowsocks.

$ sudo pip install shadowsocks

This will installs the latest available package which currently ‘shadowsocks-2.8.2’ .

Configuring Shadowsocks on Ubuntu 16

Now before we start shahdowsocks on our server, let’s create a new file and put the following configuration contents in it that contains your hostname or server IP (IPv4/IPv6) , server port number, local port number, a password used to encrypt transfer, connection timeout and and encryption method like “aes-256-cfb”, “bf-cfb”, “des-cfb” or “rc4”, etc.the default encryption method used is table, which is not secure so we will be using 'aes-256-cfb' which is recommended.

So, run the below command to open a new file using your command line editor and put the following configuration parameters in it.

$ sudo vim /etc/shadowsocks.json
{
"server":"server_ip",
"server_port":8000,
"local_port":1080,
"password":"passw0d",
"timeout":600,
"method":"aes-256-cfb"
}

Save and close the configuration file using 'wq!' and move to the next step to start your Shahdosocks server on your Ubuntu 16 server.

Starting Shadowsocks on Ubuntu 16

Once you have placed your configurations, use below commands to start, stop or restart your Shadowsocks server as shown below.

$ sudo ssserver -c /etc/shadowsocks.json -d start
$ sudo ssserver -c /etc/shadowsocks.json -d stop
$ sudo ssserver -c /etc/shadowsocks.json -d restart

You can check from its log file if the server has been started successfully or if there is any error.

$ tail /var/log/shadowsocks.log

You can also check if the port ‘8000’ is listening on the server or not using below command.

$ netstat -tlnp

Put the following line in your ‘/etc/rc.local’ file auto start Shadosocks service at boot.

$ sudo vim /etc/rc.local
/usr/bin/python /usr/local/bin/ssserver -c /etc/shadowsocks.json -d start

Shadowsocks Client Setup on Linux

After successful installation of Shadowsocks proxy server setup, now let’s se how we can use use it from a Windows Client. We can install and setup the client environment both for Windows or Linux Operating Systems.

On your Ubuntu system, run the following command to install Shadowsocks client using PPA by adding a new apt repository.

$ sudo add-apt-repository ppa:hzwhuang/ss-qt5
[sudo] password for kash: ****
 Shadowsocks-Qt5 is a cross-platform Shadowsocks GUI client.

Shadowsocks is a lightweight tool that helps you bypass firewall(s).

This PPA mainly includes packages for Shadowsocks-Qt5, which means it also includes libQtShadowsocks packages.
 More info: https://launchpad.net/~hzwhuang/+archive/ubuntu/ss-qt5
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmp7o__4u0e/secring.gpg' created
gpg: keyring `/tmp/tmp7o__4u0e/pubring.gpg' created
gpg: requesting key 5F00FA99 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmp7o__4u0e/trustdb.gpg: trustdb created
gpg: key 5F00FA99: public key "Launchpad PPA for Symeon Huang" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK

Then update your system, so that the newly added repository should be updated and then we can install the Shadowsocks client on Ubunntu by issuing the below command.

$ sudo apt-get update
sudo apt-get install shadowsocks-qt5

Press 'Y' key to continue the installation, once the installation is complete, then launch the Shadowsocks-Qt5 from the application manager of your Ubuntu desktop.

A new window will be opened for the connection manager, click to the ‘Add’ and then choose ‘Manual’ option to configure your connection settings.

Next edit your client profile under the new connection manager provided by your remote server address and port as shown below.

Click on the 'OK' key to add your new profile and then to the 'connect' button to start using your Shadowsocks proxy.

Setup Shadowsocks Client on Windows

Now let’s see how we can install the client on a Windows 7 VM. Open this Link to Shadosocks Clients. Download the package for your Windows VM, extract it and click on the package to execute it. Make sure that your Windows system has .NET Framework 4.6.2 installed other wise you will not be able to install the Shadowsocks client package.

Once installed, launch the client and configure the server parameters in it as shown below.

Press 'OK' key to complete the Shadosocks client setup for Windows to connect to the the remote Shadosocks Proxy server on Ubuntu 16. Now move to the next step and configure your favorite web browser to use Shadowsocks client.

Configuring Firefox to Use Shadowsocks

Open your firefox web browser on your Windows VM where you have installed the Shadowsocks client.
Open the menue from the the top right corner of your firefox web browser, select the 'Advanced' option and click on the 'settings' under 'Network' menu bar.

Next, under the connection settings, choose ‘Manual Proxy Configuration’ proded by ‘SOCKS Host’ and its port that is ‘1080’ and its version as shown below.

That’s it, now press 'OK' key to continue using your Shadowsocks proxy server by opening any blocked websites from your Firefox web browser.
You can also see from the logs file of your Shadowsocks proxy server about successful connection to the proxy server.

$ sudo tail /var/log/shadowsocks.log
2017-03-19 05:39:46 INFO     connecting 661d:6ed:efe7:977a:98b4:16f8:4bcc:e9df:54347 from xx.xx.xx.xx:57888

Conclusion

At the end of this article, you are now able to install and configure your free and Open Source Shadowsocks Proxy server on Ubuntu 16.04 along with its client setup on Ubuntu and Windows 7 Operating Systems. Similarly you can use any other operating system from the server side as well as client side installation and configurations. Once you have successfully setup your Shadowsocks client side installation and integrated it with your Shadowsocks server, all the traffic will be passed through your proxy server and you will have an easy access to all protected websites in your region that will help you surf the internet privately and securely.

Find the perfect Proxy Product.

Proxyrack offers a multiple options to suit most use cases, if you are unsure our 3 Day Trial allows you to test them all.
Security

Residential proxies

Never get blocked, choose your location
View all option available
Vault

Datacenter proxies

Super fast and reliable
View all option available
Try

3 Day Trial

Test all products to find the best fit
View all option available

Get Started by signing up for a Proxy Product