Shadowsocks – 504 connect to failed: socks protocol error

Hello everyone,

I am assuming you have encountered this error when using Shadowsocks and have stumbled upon this website upon Googling it. :)

I have also faced this issue and spent countless hours trying to find out what went wrong.


Step 1: Check your Shadowsocks server’s IPtables (if you’re running Fedora, check Firewalld too)

Have you added an exception rule for IPtables? If not, you should run the following commands:

/sbin/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport SERVER_PORT_NUMBER -j ACCEPT

/etc/init.d/iptables save

/etc/init.d/iptables restart

Replace SERVER_PORT_NUMBER with the port number of your Shadowsocks server.

If you would like to save the hassle of doing so, you can simply turn off IPtables with the following commands :

service iptables stop

chkconfig iptables off


By now it should be working, however, if you’re still facing this error, proceed to step 2

Step 2: Run Shadowsocks client as Administrator


If you’re running windows, you need to always run Shadowsocks client as an administrator or else it will not work.


If you’re still facing this issue, please let me know through the comments below. Thank you and I hope that this has helped you a lot! :)

Author: Woo Huiren

Currently a student at National University of Singapore. I contribute to opensource projects - primarily PHP and Angular related. I write about PCF and PWS related stuff too.

4 thoughts on “Shadowsocks – 504 connect to failed: socks protocol error”

  1. I encountered this question, but i still can resolve it according to yr method.
    The error occured when I use free shadowsocks IPV6 node. Everything is ok when i use the IPV4 node. I already spend 3days to find out what went wrong.
    Hope that you can helped me out.

    1. Hello, a few questions:

      • Does the IPv6 node have dualstack setup or is it purely IPv6?
      • If the node is only IPv6, check if your ISP has assigned you IPv6 addresses. If you do not have IPv6 address for your connection, you will not be able to connect to IPv6 nodes.
      1. 1) The IPv6 node has dualstack DNS; But I think that it is none business of the node,because it works normally in the different PCs (all these PCs in the same LAN are installed win7-64bit OS) .
        2) I access the internet using education internet which suports IPv6.
        ping _OK
        test _OK
        3) I run the shadowsocks client as administrator. But it does not work still.

        So I think that my PC settings has some questions somewhere, what should I do now? thanks

Leave a Reply