V2Ray for Windows Client and Linux Server

V2Ray is a platform for building proxies to bypass network restrictions. It supports SOCKS, HTTP, Shadowsocks, and VMess protocols. Supported platforms include Windows, macOS, Linux, and BSD. This article will show you how to use a Windows PC as a V2Ray client, and how to set up your own V2Ray server on Linux.

Prepare Windows PC

V2Ray needs the time of day on the server and client to be within one minute of each other (it automatically handles the conversion from local time to UTC). Therefore set your Windows time to an accurate value. You can do this by using Windows Settings, and then under Time & language choosing Set time automatically. Alternatively, you can set the time manually using a site such as time.gov.

Firefox gives you most control over your browsing, so for this tutorial, we will use the Firefox browser. If you do not already have it on your PC, download and install Firefox now.

We are going to configure Firefox to send its traffic to a SOCKS5 proxy on port 1080.

From the Firefox menu, choose Options.

Select the Advanced page.

Select the Network tab.

Press the Connection Settings button.

Firefox manual proxy configuration

Click OK to your Connection Settings.

Click OK to finish changing your options.

Install V2Ray on Windows PC

Obtain the latest Windows release from:

https://github.com/v2ray/v2ray-core/releases

For example, at the time of writing, the latest release was v2.33, and the client for 64-bit Windows 10 was named v2ray-windows-64.zip.

Download the zip file.

Once it has downloaded, right-click on the zip file. Select Extract All to extract the contents of the zip file to a new folder.

In Windows Explorer, browse the contents of the new folder. You will see that it contains another folder, named for example v2ray-v2.33-windows-64.

This in turn contains the v2ray.exe executable.

When you double-click the executable, you may receive a message that Windows Defender is protecting you by not launching the program.

Windows protected your PC

If you receive this message, then click More info, then click Run anyway.

A command window opens to say that V2Ray is listening on localhost (127.0.0.1) port 1080.

V2Ray command window

Since you configured Firefox to send traffic to localhost (127.0.0.1) port 1080, and since V2Ray comes with a public test server, you can immeditately browse the web from Firefox via V2Ray.

In Firefox, browse to a site such as:

http://whatismyipaddress.com

It should show the public test server IP address rather than your local IP address.

To end your V2Ray session, go to the command window, and press Ctrl+C.

Prepare Linux Server

Now that you have successfully got V2Ray working on Windows, you can set up a virtual private server (VPS) and install V2Ray on your private server.

Begin by visiting DigitalOcean and opening and funding an account. If you use my link, they may reward you with an extra credit when you add funds for the first time. Follow the remainder of the article Basic Linux VPS Set Up from a Windows PC to create and set up your “droplet” (VPS). For China, you will likely get the best performance if you locate your droplet in San Francisco.

Once you have done this, continue as follows.

Since V2Ray uses the time-of-day on the client and server, these must agree with each other within one minute (when both are automatically converted to UTC). You can check or adjust the time on your server with the Linux date command if you need to. For example, to set the server time to 12:31 p.m. in the server’s local time zone:

date +%T -s "12:31:00"

You may also need to unstall unzip on your server:

sudo apt-get install unzip

You will also need curl:

sudo apt-get install curl

Install V2Ray on Linux Server

Once you have all these prerequisites done, you can download and run the V2Ray install script:

curl -L -s https://raw.githubusercontent.com/v2ray/v2ray-core/master/release/install-release.sh | sudo bash

View the configuration file created by the install script:

sudo less /etc/v2ray/config.json

Note down the values generated for port and id, for example:

  "port": 23456,

and:

    "id": "14d118b6-770e-4ad0-b397-2e6838c4f30a",

Escape from viewing the file with less:

q

You will also need to make a note of your server’s IP address. You will need this in a moment when you reconfigure the Windows client. In the example here, the server IP address is 123.45.67.89.

Open the firewall for your configured port.

sudo iptables -A INPUT -p tcp --dport 23456 -j ACCEPT

sudo dpkg-reconfigure iptables-persistent

Start the V2Ray server running:

sudo service v2ray start

You can check V2Ray is listening on your chosen port (23456 in our example):

sudo netstat -tulpn | grep 23456

You can also check the log file to see if there are any errors:

sudo cat /var/log/v2ray/error.log

Modify Windows Client to Use Private Linux Server

On your Windows PC, edit the Downloads\v2ray-windows-64\v2ray-v2.33-windows-64\config.json file to:

Save and close the config.json file in your editor.

Double-click on v2ray.exe to start it with your edited configuration file.

To test V2Ray, open Firefox, and browse to the site:

http://whatismyipaddress.com

It should show your private server IP address.

To end your V2Ray session, go to the command window, and press Ctrl+C.

You may also wish to set Firefox back to Use system proxy settings.