This article will tell you how to install the ShadowSocks server in the google cloud Linux server (Ubuntu) and how to connect it from your local machine. But before you can exercise, you should have a google account and have applied google cloud service, please see this article’s reference section to learn how to do it.
1. Create A Firewall Rule In Google Cloud.
- Login to google cloud console. Click VPC network —> Firewall rules menu item in left Navigation Menu.
- Then click CREATE FIREWALL RULE button at the top bar to open the Create a firewall rule web page. Input firewall rule name, and set all other fields as below picture.
- Select IP ranges in the Source filter drop-down list. The Source IP ranges value should be 0.0.0.0/0 to allow any IP address to connect.
- If you want to expose all protocols and ports number to the client in this firewall rule, you can choose the Allow all radio button in the Protocols and ports section.
- But sometimes such as in this case, we should restrict the protocols and ports to clients to use this firewall rule so we can choose Specified protocols and ports radio button in the Protocols and ports section. And then input text with protocol_1:port_number_1; protocol_2:port_number_2 format.
- In this example, ShadowSocks will use the 9090 port number and use both TCP and UDP protocols. So the Specified protocols and ports value should be tcp:9090;udp:9090.
- The Target tags are the google cloud virtual machine tags, if you specify the value shadowsocks to it here means that the virtual machine which has the shadowsocks tag will use this firewall rule. Do not forget to click the Save button to save the changes.
- Now you can see the newly added firewall rule on the VPC network —> Firewall rules list page. We will use this firewall rule in virtual machine configuration later.
2. Create Google Cloud Virtual Machine Instance.
- Log in to the Google Cloud Platform console, then click the Compute Engine —> VM instances menu item in the Navigation menu.
- Then click CREATE INSTANCE menu item at the top to create a google cloud virtual machine. Select micro in Machine type(micro is enough and not expensive). Select Ubuntu 18.0 in the Boot disk. Click the Create button to save the changes.
- Now you can return to the virtual machines list page, you can find the virtual machine instance you just created there. Click the instance link to go to it’s detail info page and click the Edit button at the top bar. Then input shadowsocks in the Network tags input box, so that this virtual machine instance is tagged as shadowsocks, and it will use the firewall rule created in step one which Target tags value is shadowsocks also.
3. Setup ShadowSocks Service In Google Cloud Virtual Machine Instance.
- Now the firewall rule and the virtual machine instance have been added correctly. We will install the ShadowSocks server on that virtual machine now.
- Go to the virtual machine instance list page, click the down arrow behind the SSH Connect type, then click Open in browser window menu item.
- Then it will open an ssh client ( in a web browser ) that you can use to interact with the Linux server.
- In that server, you can set up the ShadowSocks server and configure the ShadowSocks server port number to 9090 which is allowed by the firewall rule.
- For more detail about how to set up the ShadowSocks server and the client tool to connect to it, please refer article How To Setup ShadowSocks VPN On Mac, Windows And Linux
4. Example Demo Video.
- You can see this example demo video on URL https://youtu.be/6jFjUJgEa9k.
- ShadowSocks Wiki
- Create, Modify, or Close Your Billing Account
- Google Cloud Identity and Access Management Documentation