Abstract
This article aims to build a SSH proxy server with a VPS with public IP address, and we will use a China VPS as example to access Chinese only website by the ssh proxy. This method can used to access website in GFW from China as well.
Requirement
- A Chinese VPS with public IP address, CentOS 7 as example.
- A SSH client on the PC, such as Git for Windows on Windows.
Step 1. Buying a Chinese VPS
Buying a Chinese VPS with public IP address so that you have a Chinese IP address to access the Chinese only service.
Step 2. Install SSH client
Install SSH client like Git for Windows. If you use mac or linux, you can just use terminal.
Step 3. Generate SSH public key
To allow device use the VPS as proxy, generate a SSH public key of the device and add it to the allow list of SSH on the VPS.
Generate SSH public key with Git Bash with this command:
ssh-keygen
Then the public key will be found in the file as the command windows returned. It is usually in the path C:/User/Username/.ssh/id_rsa.pub
Step 4. Copy the SSH public to the allow list of SSH on VPS
Log in to the VPS, and open the file /root/.ssh/authorzied_keys:
sudo vim /root/.ssh/authorzied_keys
Add the SSH public key generated on the computer to the end of the file, and save the file.
Step 5. Build port map
In the Git Bash on the PC, build port map with this command:
ssh -Nf -D 7777 username@remote_server
It means forward access traffic to the local port 7777, and the username
and remote_server
is the login information of the VPS.
Now, 127.0.0.1:7777 is a proxy on your PC, which can forward access traffic to the VPS server.
Step 6. Set proxy on Chrome
We use Chrome and SwitchyOmega plugin as an example to set the proxy. Add a new scene mode in the left sidebar, and add a proxy server with parameter as below:
Apply the settings and turn on the SwitchyOmega when access to the Chinese only service with Chrome, then the service can be accessed successfully.