Home/Server & Website Managed Operations/Using Shadowsocks for Unrestricted Internet Access
Server & Website Managed Operations

Using Shadowsocks for Unrestricted Internet Access

Background

Many technical websites are blocked, causing frequent network resets when searching for solutions or browsing.

I am a heavy Google user. Although I mainly use Google Search and Gmail, these two services alone make it hard to leave the Google ecosystem. Additionally, many websites rely on Google’s OpenID for login and reference Google fonts and other resources, making them inaccessible without proper connectivity. I have tried various methods to bypass restrictions in the past. During university, I benefited from free IPv6 provided by the education network; after graduation, I used GoAgent for a long time and fqrouter on my mobile phone. However, none of these were stable or permanent solutions.

Many people use VPNs, either purchased or self-hosted. After GoAgent became unusable, I seriously considered using a VPN but decided against purchasing one for several reasons:

  1. Publicly available VPNs are often targeted and shut down (though this might be an overestimation of the risk).
  2. For information security and privacy reasons, I do not want the risk of third parties accessing my data (which is why I also stopped using fqrouter).
  3. I wanted to set it up myself.

Therefore, I chose the solution of a foreign VPS combined with Shadowsocks.

Purchasing a VPS

I am most familiar with Linode and DigitalOcean. Their minimum configurations are quite similar, but Linode’s price ($10/month) is twice that of DigitalOcean. I originally intended to choose DigitalOcean, but while experimenting at home, I couldn’t access the DigitalOcean website… So I ended up choosing a VPS from Linode.

The registration process is omitted here. When selecting a data center, it is advisable to test performance first. Online recommendations often suggest Tokyo data centers, but this option was unavailable when I made my purchase. However, there is a Singapore data center in Asia. Regardless, you can determine the best choice by running speed tests on this page. My tests showed that Singapore had the best speed (due to geographical proximity), so I selected the Singapore data center. Don’t worry if you need to switch later; migration is supported.

Once the data center is selected, you can install the operating system. I chose Ubuntu as it is the most familiar and convenient for me. The installation process is simple and fast. After the machine starts, you can connect via SSH.

I purchased the lowest configuration (https://www.linode.com/pricing), which is quite luxurious for personal use, especially given that the current need is only for setting up a VPN.

Installing Shadowsocks

I used the Python implementation. The installation process is very simple, and there is a tutorial in the documentation.

Install Shadowsocks on both the VPS and your local machine:

pip install shadowsocks

Create a configuration file named shadowsocks.json (replace server and password with your server IP and Shadowsocks server password):

{
    "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
}

This configuration file is universal for both client and server. local_address and local_port are used by the client.

Start the Shadowsocks server on the VPS:

ssserver -c /path/to/shadowsocks.json

Start the Shadowsocks client on your local machine:

sslocal -c /path/to/shadowsocks.json

When configuring your VPN client, point it to the local Shadowsocks instance, i.e., 127.0.0.1:1080, rather than connecting directly to the server version.

Using SOCKS Proxy in Chrome

Linux systems allow global network proxy configuration. Chrome can be set to use the system default proxy or configured more flexibly using SwitchySharp.

Users of GoAgent should be familiar with the SwitchySharp Chrome extension. Using SwitchySharp with Shadowsocks is straightforward and requires just a few steps:

  1. Open the SwitchySharp settings interface, create a new profile named “Shadowsocks”.
  2. In the detailed configuration page, under the SOCKS Proxy section, enter IP 127.0.0.1 and port 1080, select “SOCKS v5”, and save.
  3. In the Rules page, change the profile for all rules from GoAgent to Shadowsocks, then save.
  4. Update the online rule list, selecting the Shadowsocks profile; you can also add rules manually.

Done. From now on, accessing websites listed in the rules will route through the Shadowsocks proxy. If you have used SwitchySharp + GoAgent before, this configuration should be easy to understand even without screenshots.

Using SOCKS Proxy in Command Line

The browser can now freely access the internet, but the terminal remains restricted. Commands like curl, wget, and go get still fail when trying to access external resources.

The Shadowsocks wiki provides a tutorial on using command-line tools with proxies, but I was unable to configure it successfully. Later, I found another tool: Privoxy.

Installing Privoxy on Ubuntu is very simple:

sudo apt-get install privoxy

After installation, there will be a privoxy command, and the configuration file is located in the /etc/privoxy/ directory. Privoxy is a web proxy tool offering complex configurations for powerful features; however, I only needed a small portion of its functionality.

Edit the /etc/privoxy/config file and add the following lines at the end:

forward-socks5  /               127.0.0.1:1080 .
listen-address  127.0.0.1:8118
# local network do not use proxy
forward         192.168.*.*/    .
forward         10.*.*.*/       .
forward         127.*.*.*/      .

The forward-socks5 line indicates that all network traffic goes through the SOCKS5 proxy, with the proxy server being 127.0.0.1:1080, which is the Shadowsocks client service running locally. The last three lines configure the local LAN to bypass the proxy.

Restart Privoxy:

sudo service privoxy restart

Now you can browse freely from the command line. Installing various Golang packages using go get works smoothly.

Using SOCKS Proxy on Android

Shadowsocks is truly a blessing, providing an Android client as well: https://github.com/shadowsocks/shadowsocks-android. The installation and configuration process are simple, so I will omit the details.

Postscript

After all this tinkering, I have essentially achieved unrestricted internet access across all platforms. This sense of freedom is incredibly satisfying. At the same time, I feel a bit of sorrow. Things that should be natural require convoluted workarounds here.

Thanks to the authors of Shadowsocks for creating a simple yet powerful proxy tool that benefits everyone.

FREE CHECKUP

Free server checkup

We will send a problem checklist and remediation advice within one business day — no obligation to engage.

135 410 16684
Weekdays Mon – Fri 10:00 – 22:00 (UTC+8) · 7×24 emergency response
Call now
CONTACT

Contact Us

How can we help?

* Required