Shadowsocks is a powerful and flexible proxy tool that can help bypass internet restrictions and enhance online privacy. This guide will walk you through setting up your own Shadowsocks proxy server on Ubuntu, allowing you to create a secure tunnel for your internet traffic.
Installing Shadowsocks on Ubuntu
The first step is to install the Shadowsocks server software on your Ubuntu system. Shadowsocks-libev is the recommended implementation due to its speed and efficiency.
Step 1: Update your package lists:
sudo apt update
Step 2: Install Shadowsocks-libev:
sudo apt install shadowsocks-libev
Configuring the Shadowsocks Server
After installation, you’ll need to configure the Shadowsocks server.
Step 1: Open the configuration file:
sudo nano /etc/shadowsocks-libev/config.json
Step 2: Replace the contents with the following, adjusting the values as needed:
{
"server":["::0", "0.0.0.0"],
"server_port":8388,
"password":"your_secure_password",
"timeout":300,
"method":"chacha20-ietf-poly1305",
"fast_open": true,
"nameserver":"1.1.1.1"
}
Key configuration options:
server
: Set to["::0", "0.0.0.0"]
to listen on all interfacesserver_port
: Choose an available port (e.g. 8388)password
: Set a strong passwordmethod
: The encryption method (chacha20-ietf-poly1305 is recommended for its security and speed)fast_open
: Enables TCP Fast Open for improved performancenameserver
: Specifies a DNS server (1.1.1.1 is Cloudflare’s public DNS)
Step 3: Save the file and exit the editor.
Starting and Enabling the Shadowsocks Service
Now that the configuration is set, you can start the Shadowsocks service and enable it to run at boot.
Step 1: Start the Shadowsocks service:
sudo systemctl start shadowsocks-libev
Step 2: Enable the service to start on boot:
sudo systemctl enable shadowsocks-libev
Step 3: Verify the service is running:
sudo systemctl status shadowsocks-libev
Configuring the Firewall
If you’re using a firewall, you’ll need to open the port Shadowsocks is using.
For UFW (Uncomplicated Firewall):
sudo ufw allow 8388
Replace 8388 with the port you specified in the Shadowsocks configuration.
Setting Up the Shadowsocks Client
To use your Shadowsocks server, you’ll need a client on your device. There are clients available for various operating systems.
For Ubuntu Desktop:
Step 1: Install the Shadowsocks client:
sudo apt install shadowsocks-libev
Step 2: Create a client configuration file:
sudo nano /etc/shadowsocks-libev/client-config.json
Step 3: Add the following content, adjusting the values to match your server:
{
"server":"your_server_ip",
"server_port":8388,
"local_address":"127.0.0.1",
"local_port":1080,
"password":"your_secure_password",
"timeout":300,
"method":"chacha20-ietf-poly1305"
}
Step 4: Start the client:
ss-local -c /etc/shadowsocks-libev/client-config.json
For Windows:
Download and install a Shadowsocks client like Shadowsocks-Windows from the project’s GitHub releases page. Configure it with your server details.
Configuring Your Browser to Use the Proxy
After setting up the client, you’ll need to configure your browser to use the Shadowsocks proxy.
For Firefox:
- Go to Settings > General > Network Settings
- Select “Manual proxy configuration”
- Set “SOCKS Host” to 127.0.0.1 and “Port” to 1080
- Choose “SOCKS v5”
- Check “Proxy DNS when using SOCKS v5”
For Chrome:
Install the “Proxy SwitchyOmega” extension and configure it to use the Shadowsocks proxy (127.0.0.1:1080).
Optimizing Shadowsocks Performance
To improve your Shadowsocks proxy’s performance, consider these optimizations:
- Enable TCP Fast Open in your server configuration (already included in the config above)
- Use the AEAD ciphers like chacha20-ietf-poly1305 for better security and performance
- Consider enabling BBR (Bottleneck Bandwidth and Round-trip propagation time) on your server for improved network performance
Troubleshooting Common Issues
If you encounter issues with your Shadowsocks setup:
- Check the Shadowsocks service status:
systemctl status shadowsocks-libev
- Review the logs:
journalctl -u shadowsocks-libev
- Ensure your firewall is properly configured
- Verify that the client configuration matches the server settings
Setting up a Shadowsocks proxy server on Ubuntu provides a powerful tool for bypassing network restrictions and enhancing your online privacy. Remember to keep your server and client software updated for the best security and performance.