Using Google VPS, set up ssr and v2ray

4 minute read

Using Google VPS, set up ssr and v2ray

Background

Network freedom is demanding for everyone, especially for programmers and researchers. However, because of the reason everyone knows, there is a barrier in Chinese mainland towards some sites(e.g. Google, Facebook, Twitter, Youtube, etc.). In the beginning, this post is only a note for myself about how to cross the network barrier, but many of my friends keep asking me how to have network freedom in China, so I revised this post and make things clearer and easy to understand. I hope this post can help you perform better in learning and developing. As an individual, we must have the ability to distinguish what information on the Internet should trust. And here, I claim that this post is only for learning and research.

If you want to buy a VPN (proxy), you do not need to read this post, most of VPN vendors provide a shared proxy server and limit bandwidth to users, so it may be real slow. Moreover, you may not trust the vendor and worry about they may monitor you data, so you can create your proxy server by yourself and exclusive bandwidth, if you wish to achieve that, you can read this post and learn how to do it. If there has something unclear, feel free to leave a comment.

Virtual Private Server(VPS) is a virtual machine run on cloud and used by individual. Companies like Google, AWS, Alibaba, Tencent etc. provide their servers to customers, and people can use these server to host there website, do computing, set up proxy etc.

Here I will introduce how to set up a Google VPS and set up a network proxy server on it. For how to set up a website on VPS, refer to my post—Create your website on cloud.

Requirements

  • You need a temporary available VPN to visit Google and setup your server, and after you set up your server, you just switch to your own service and no need for the a temporary VPN.

How to get temporary available VPN?

you can find a VPN vendor and start a free trial, Lol.

  • You should have some background of computer system(especially Linux system), otherwise its may hard for you to understand some terms and implement these things. For this case, you can learn to build your proxy by some more step-by-step video tutorials, you may find it on Youtube by searching ssr and v2ray.

1. Set up cloud Virtual Private Server (VPS)

You can use any server which can visit freedom network, most of them are out side of China, and you can buy a mini-server from cloud server provider, e.g. Google, AWS, BandwagonHost. a mini-server often very cheap, and you can pay by a double currency credit card. Here I tell you how to set up a server on Google cloud.

  1. buy a VM on Google cloud (it has one year free trial now) choose Debian Linux and the place near to get fast access (eg, asia-east, asia-noutheast, hongkong)
  2. use ssh connect VPS (you can use browser ssh or ssh key on terminal)

2. Set up proxy server

Here I list two popular way to go through the special firewall, one is ssr, the other is v2ray. Both of them are kind of proxy protocol and can achieve your goal of visiting some banned websites.

SSR is a protocol to avoid censorship, recently it stopped maintain and GFW has ability to ban some of ssr data flow, so it is not very stable.

v2ray is a platform for anti-censorship, and it can use Vmess protocol, at least present it is more stable than SSR.

2.1 set up BBR and ssr

set up BBR and ssr through script on VPS connected by ssh

sudo -i
wget --no-check-certificate https://github.com/iyuco/scripts/raw/master/bbr.sh
chmod +x bbr.sh
./bbr.sh
./shadowsocksR.sh

and if you want to create multi-user accounts, the following one is more convenient

wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/ssrmu.sh && chmod +x ssrmu.sh && bash ssrmu.sh

Notice: Don’t forget set you Google cloud firewall to allow your ssr port in both http and https

2.2 set up v2ray

Please refer the v2ray official website for detail. For more brainless method, refer toutyrater

or you can just run this scrip to set up it without thinking

bash <(curl -s -L https://git.io/v2ray.sh)

3. set up Linux PC client

3.1 set up ssr

```
wget http://www.djangoz.com/ssr
sudo mv ssr /usr/local/bin
sudo chmod 766 /usr/local/bin/ssr
ssr install
ssr config
```

3.2 Set up v2ray client

  1. synchronize you time first by

    sudo apt-get install ntp ntpdate -y
    ntpdate 0.asia.pool.ntp.org  
    sudo hwclock -w 					# write to hardware
    date # check time
    

    list of time server

    time.nist.gov  
    time.nuri.net  
    0.asia.pool.ntp.org  
    1.asia.pool.ntp.org  
    2.asia.pool.ntp.org  
    3.asia.pool.ntp.org
    us.pool.ntp.org 
    
  2. download install script

    wget https://install.direct/go.sh   
    
  3. run install and set up

    sudo go.sh
    
  4. move you config.json file to /etc/v2ray/ and delete the default config file

  5. start v2ray

    sudo systemctl start v2ray
    
  6. check status

    service v2ray status
    

4. using socks on terminal

  1. sudo apt-get install privoxy

  2. edit /etc/privoxy/config, below is an example
     listen-address 127.0.0.1:8118   # in line 783
     forward-socks5 / 127.0.0.1:1080 .  # in line 1336
    
  3. sudo /etc/init.d/privoxy restart

  4. configure terminal environment by run or add following to .bashrc

     export http_proxy="127.0.0.1:8118"
     export https_proxy="127.0.0.1:8118"
    
  5. try wget http://www.google.com to test.

Chrome management

if you want to use chrome to manage your redirection, you can use Proxy SwitchyOmega extension.

5. set up other clients

5.1 SSR client

5.2 V2ray client

visit v2ray github rep to find it.

Special statement: This tutorial is only for learning and research, thanks.

Comments