- 1. Server
- 2. Client
- 3. What to do next?
Shadowsocks with kcptun - Fast & Free Proxy Using Your Own Server
Your school or company network may intentionally block the access to a few specific websites. To bypass the access restriction, I’d highly recommend Shadowsocks, since it is the easiest proxy tool I’ve ever found, and it’s FREE (of course iff you have your own server running).
In this tutorial, we’re going to setup Shadowsocks on both of the Linux server and the local machine, together with an accelerator called kcptun.
Although Shadowsocks works perfectly by itself, it’s highly recommended to use it alongside with kcptun, as kcptun can make it several times faster.
First of all, make sure you have a few packages installed on your server:
Then, install Shadowsocks using
Create a configuration file at
/etc/shadowsocks.json, with the following content:
Don’t forget to change the
Finally, we’re ready to start the shadowsocks server that runs in the background by
If you wish to stop the Shadowsocks server, do this
First, download the latest release to your server and unzip the file so that you can get an executable. In this tutorial, we’re assuming that the server is running 64-bit Linux, so the executable file is called
Create a folder somewhere, and move the executable file into it. From that folder, start a new screen session:
Then, create a configuration file
config.json with the following content:
<server-ip> is the IP address of the server, and
<key> is a random long string that is hard to guess.
Run the kcptun accelerator:
If you wish not to display any log in the screen, use the following command instead:
Finally, detach the screen session by pressing
ctrl + A then press
If you wish to stop kcptun, first, reattach the screen session,
Then in the screen window,
ctrl + C to stop the accelerator process, then
There is a client app called ShadowsocksX-NG for macOS that has built-in support for kcptun.
Configure the Server Preference like this:
First, download the executable from here for your specific platform, for example,
Then, open a Terminal window,
cd to the directory where the executable is located, and create a configuration file
Run the following command:
<key> is same as in the server command.
DO NOT close the Terminal window while you are using the proxy.
Download the GUI client application from here for your local machine, and setup the server IP address and password.
If you are using kcptun, you’ll also need to set the Shadowsocks server address on the client device to 127.0.0.1:8388 (i.e. the local port that the kcptun client listens to).
When you turn on Shadowsocks on your local machine, it actually sets up a local SOCKS5 proxy at 127.0.0.1:1080 (or :1086 if you are using the app for macOS), and only HTTP traffic will be redirected through the proxy.
If you want to enfore global proxy for all TCP traffic on your local machine, you’ll need some additional tools. For example, Proxifier is a cross platform app for both masOS and Windows that can redirect all TCP traffic through the SOCKS proxy that Shadowsocks created.
However, in the global proxy app, always remember to turn on direct-connect for Shadowsocks to avoid infinit loop.
If no other user process on your server is as important as Shadowsocks and kcptun, you may choose to increase the priority of both processes.
First, find the process IDs of both processes using something like htop.
Then, change the niceness/priority by
You need to enter this line of command twice, one for each of the two processes (Shadowsocks and kcptun).