This article will tell you how to install ShadowSocks server in 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 has 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 top bar to open below web page. Input firewall rule name, and set all other field as below picture. Select IP ranges in 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 Allow all radio button in Protocols and ports section.
- But some time 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 9090 port number and use both TCP and UDP protocol. So the Specified protocols and ports value should be tcp:9090;udp:9090. The Target tags is the google cloud virtual machine tags, if specified here means that virtual machine which has shadowsocks tag will use this firewall rule. Do not forget click Save button to save the changes.
- Now you can see the newly added firewall rule in the Firewall rules list page. We will use this firewall rule in virtual machine configuration later.
2. Create Google Cloud Virtual Machine Instance.
- Click Compute Engine —> VM instances menu item in Navigation menu.
- Then click CREATE INSTANCE menu item at top to create a google cloud virtual machine. Select micro in Machine type(micro is enough and not expensive). Select Ubuntu 18.0 in Boot disk. Click Create button to save the changes.
- Now you can return to the vm list page, you can find the vm instance you just created there. Click the instance link to goto it’s detail info page and click Edit button at top bar. Then input shadowsocks in the Network tags input box, so that this vm 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 vm instance has been added correctly. We will install ShadowSocks server in that vm now.
- Go to the vm instance list page, click the down arrow behind the SSH Connect type, then click Open in browser window menu item. The ip address in below page is hidden for security issue.
- Then it will open a ssh client ( in a web browser ) that you can use to interact with the Linux server. In that server you can setup ShadowSocks server and configure the ShadowSocks port number to 9090 which is allowed by the firewall rule. For more detail about how to setup ShadowSocks server and client tool to connect to it, please refer article How To Setup ShadowSocks VPN On Mac, Windows And Linux
- ShadowSocks Wiki
- Create, Modify, or Close Your Billing Account
- Google Cloud Identity and Access Management Documentation