Skip to main content

Socks proxy Troubleshooting

This document describes SocksProxy troubleshooting steps, focusing on configuration verification and checking the connection status from the CE and PE sides. In this case, users cannot connect to the SocksProxy. The causes could include a slow connection in terms of speed, failure to access given resources, or complete failure of connectivity. The whole troubleshooting process involves checking the Shadowsocks configuration both at the CE and PE, as well as checking for the status of network connections and also searching for error logs.


Issue: Shadowsocks Configuration Mismatch

Troubleshooting Steps

Verify CE Configuration

Log into the CE and inspect the Shadowsocks configuration file. The location may be different but common locations include /etc/config/shadowsocks-libev. Run the following command.

sudo cat /etc/config/shadowsocks-libev

This command shows the configuration file contents. Carefully check the settings, especially the server address, port, and password.

Verify PE Configuration

In the PE, log in and check the Shadowsocks configuration file. A common phrase for this is /etc/shadowsocks-libev/vtun56_3.json. The command to run the configuration in a pretty print format is:

cat /etc/shadowsocks-libev/vtun56_3.json | json_pp

json_pp formats the JSON output for better readability. Check also that the port and password are set correctly in the settings.

Check for Configuration Errors

Review both configuration files for syntax errors, typos, or wrong characters. Even a tiny error can keep shadowsocks from working correctly. For the PE's JSON configuration, validate the file with a JSON validator, either online or command line tools. Invalid JSON will prevent Shadowsocks from starting.


Issue: Connection Status

Check the Connection Status on the CE

Use netstat on the CE to check the connection status. The following command can determine whether the CE tried to connect the PE on the configured port, such as port 30021:

netstat -ntualp | grep 30021

This command filters the netstat output for lines containing the word "30021". Use this command to find Established connections from the CE that successfully connected to the PE. If no line is found or if the connection is in the SYN_SENT state, then the CE cannot establish a connection with the PE.

Check the Connection Status on the PE

Use netstat on the PE to see if there are incoming connections on the Shadowsocks port:

sudo netstat -ntualp | grep 30021

This command verifies that the PE is listening on the given port and if there are connections established. If the PE is not listening on the port, then something is wrong with Shadowsocks. If connections are Seen, then it means the CE is successfully connecting to the PE.

Check Shadowsocks Logs

The Shadowsocks logs on the CE and PE for errors or warnings. The log location varies depending on the system. For systems that use logread, run the following command:

logread

This will print the system logs. Check for messages concerning Shadowsocks, particularly error messages regarding failed startups or connection attempts. Pay attention to the timestamps to associate the log entries with the attempted connections.