V2Ray is a proxy software that can help Internet users in the countries with Internet censorship to bypass the restrictions, so that they can access the websites or use other web services that are blocked by the governments. For example, Google, YouTube, Twitter, and many other websites are blocked in China, you can access them with the help of V2Ray; If you live in India, then you can use V2Ray to watch TikTok videos; People in UAE can use V2Ray to unblock WhatsApp.
V2Ray is very similar to Shadowsocks, another proxy software that is currently very popular in the countries with Internet censorship. V2Ray is relatively new to Shadowsocks, but its performance, speed, stability and other aspects are not inferior to Shadowsocks, and the setup process of V2Ray nodes is much simpler than Shadowsocks.
This tutorial will show you how to use V2Ray in detail.
First, a brief introduction to how V2Ray works. V2Ray consists of two parts, one is the V2Ray server, or called “V2Ray node“, and the other is the V2Ray client app. The V2Ray server is a remote server located in the countries where the internet is free and open, the V2Ray script is installed and running on the server, which can be remotely connected by the V2Ray client app, which is software installed on devices such as smartphones or PC, the software can connect the device to the V2Ray server. While the user is browsing the internet, the client app will send the request to the V2Ray server, which will reroute the data to whatever website the user is trying to reach, and since the country where the server is located has no Internet restrictions, it can normally obtain the Internet information that is blocked in the user’s country. The information is then transmitted back to the user’s device, so that the user can bypass the restrictions and access those websites normally.
Therefore, if you want to use V2Ray, you need to first rent a server and make it a V2Ray server, and it’s better to do it yourself (see the detailed setup steps below). If you can’t build it, you can borrow someone else’s (for example, your friends can build a V2Ray server and are willing to share it with you), or buy it from some merchants that provide V2Ray services, but it is difficult to find a trustworthy and well-known merchant. It’s better to buy a VPN, because the performance of the services provided by some well-known VPN merchants is relatively good and stable. Some well-known VPNs are Surfshark, NordVPN, ExpressVPN.
Now let’s see how to setup a V2Ray server. After the setup is completed, you can download a V2Ray client app to start using V2Ray.
Before setting up a V2Ray server, you must obtain a remote server first. This server is usually rented, and the price is generally about US$5 per month, which is relatively cheap compared to the monthly price of more than ten US dollars for a VPN. It is very easy to rent a server, you can choose a VPS provider to rent a server on its website. Some popular VPS providers are Vultr, DigitalOcean, and BandWagonHost.
The following is a brief introduction on how to rent and launch a server on Vultr, don’t worry if you choose other VPS providers, the process will be very similar and easy).
Start by going to the website of Vultr, where you need to register a new user account with your email address.
After an account is registered, the site will take you to a page to select a payment method, you can pay with credit card, PayPal, etc..
Then switch to the “Products” page by clicking “Products” in the sidebar, to launch a server. This page is divided into several parts, each part has different options and settings, it is recommended to select and set as follows:
Choose server: select “Cloud Compute”
CPU & Storage technology: select “Regular Performance”
Server location: Choose the server location you want, it is recommended to choose a city relatively close to you, so that V2Ray will be faster
Server image: Choose the server operating system you like, I recommend Ubuntu (any version is ok) or Debian, this tutorial uses Ubuntu, but there is not much difference if you choose other systems.
Server size: The size of $5/month is recommended, $2.5/month servers only have IPv6 Internet access, not suitable for setting up V2Ray. The $3.5 per month servers is only available in New York, which is far from major countries with Internet censorship, so the speed will be slower.
Add auto backups: You can click to cancel backups, or there will be additional charges. It will not affect the use of V2Ray without backups.
Additional features: skip this section
SSH Keys: No need to add SSH Keys. SSH keys can be used instead of passwords to log in to the server. If you are a beginner, it is recommended to log in with passwords.
Server hostname & label: No need to change
After the selections are made, click the Deploy Now button in the lower right corner of the page to launch a server. The server takes about ten seconds to several minutes to complete the creation. After completion, find its IP address and password and copy them, which will be used when connecting to the server.
Now the server is launched, the next step is to install the V2Ray program on the server to enable the server to work with the V2Ray client. The installation of the V2Ray program on the server will be completed on your local computer through the command line interface. You’d better have a basic understanding of the commands of Linux system, but if you don’t know them, it will not be a big problem. Just follow the steps below carefully to complete the setup of V2Ray server, the whole process only takes about two minutes. If you really can’t do it, it is recommended to use a VPN instead, such as Surfshark and NordVPN, they are easy to use, VPNs do not require users to build their own servers, and allow switching to servers in different countries at any time.
Below are the detailed steps to install V2Ray on the server.
First, use SSH to connect to the server. The method of using SSH varies depending on the operating system of your computer. The following will introduce the SSH connection method of Mac OS and Windows OS respectively.
If you are a Mac user, you can directly open the built-in Terminal command interface to establish an SSH session without installing additional software.
After opening Terminal, enter the following command to connect to the server. Note that replace “your_server_ip” with the IP of the server you launched.
ssh root@your_server_ip
If you’re on Windows, you’ll need to install a software called PuTTY, which can be downloaded from its website. PuTTY is very easy to use, just open it, find the corresponding boxes and enter the server IP address and port number (the default port is 22, Vultr and DigitalOcean users just keep the default, BandwagonHost users need to change it to the port number displayed in the user’s control panel) and then click the Start button to connect to the server. Note that when you connect to a new server for the first time, a dialog box will pop up, and you need to click Accept to connect.
After the server is connected, you need to log in as root, the command line interface will display “login as”, you will enter “root” and press Enter. Then it will ask for your password or SSH key passphrase, enter it and press Enter to log in, note that the characters you entered will not show in the command line interface when entering the password.
After logging in, the cursor will appear at the end of the following line (note that the “@” is followed by the host name of your server, which was automatically generated by the system of VPS provider when creating the server).
“root@the-hostname-of-your-server:~#”
Then you can start installing V2Ray by typing commands after it.
Before installing V2Ray, you need to update the server and download the curl tool, which is used to download V2Ray. Use the following command to do it. (You don’t have to manually type the commands, just copy and paste the command into the command line interface. To paste, simply right-click the mouse in the command line interface, the copied content will be pasted immediately)
apt-get update -y && apt-get install curl -y
The above command works for Ubuntu system and Debian system, but CentOS (default system of BandwagonHost server) users only need to change each “apt-get” in the command to “yum”, as shown below.
yum update -y && yum install curl -y
After entering the command, you need to press the Enter key to execute the command. It takes a few seconds to a minute to update the server and install curl.
Then install V2Ray. The installation of V2Ray is much simpler than that of Shadowsocks. Using the one-click installation script recommended by the V2Ray developers can complete the installation with only a single command.
Enter the following command in the command line interface and press Enter.
bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)
Then V2Ray will start to be installed, the installation takes ten to twenty seconds to complete.
After V2Ray is installed, you need to create a configuration file for V2Ray. The steps are as follows.
First, a user ID is required in the configuration file, so we need to create a user ID before creating the configuration file. The user ID of V2Ray must be in UUID format. You can go to some UUID generation websites to generate one for use. Another more convenient way is to use a command, using the following command will generate a user ID.
cat /proc/sys/kernel/random/uuid
After the ID is shown in the command line interface, copy the ID (select it and press Ctrl+Shift+C) and store it in notepad or anywhere you like, this ID will be used in the configuarion file and client app.
Then we use the Vi editor to create and edit the V2Ray configuration file. Use the following command:
vi /usr/local/etc/v2ray/config.json
After pressing Enter, the interface will switch to the new file, which is almost blank, with only two curly brackets.
First use the “delete” key to delete the two curly brackets, and then copy and paste the following text into the file.
{ "inbounds": [ { "port": 16832, // server port "protocol": "vmess", "settings": { "clients": [ { "id": "b831381d-6324-4d53-ad4f-8cda68b30851", // User ID "alterId": 0 } ] } } ], "outbounds": [ { "protocol": "freedom", "settings": {} } ] }
Then press the “i” key on your keyboard to enter edit mode to edit, you need to replace the user ID with the ID you obtained in the previous step. The way to move the cursor on the interface is to use the arrow keys on the keyboard.
The most important things in the configuration file are the user ID, port, alterID, these will be entered into the V2Ray client app. You can set a port yourself, or leave it unchanged. alterID does not have to be changed.
Then press the Esc key to exit the editing mode, then enter “:wq” (don’t forget to add colon before “w”) and press Enter, this will save the file and exit the Vi editor to return to the original interface.
Next, you can start running V2Ray, the way to start V2Ray is to use the following command.
systemctl start v2ray
If for some reasons you edited the configuration file later when V2Ray is running (for example, you changed your user ID or port), you need to restart V2Ray so that the changes you made will take effect. You can use the following command to restart V2Ray.
systemctl restart v2ray
Now your V2Ray server is almost set up and ready to use, but to make it faster, you can optionally do the following optimizations.
We can make V2Ray faster by installing Google BBR, which is a TCP congestion control algorithm developed by Google, it can improve the processing speed of the V2Ray server. Here we use a script from Github user Teddysun to install Google BBR by entering the following command.
wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh && chmod +x bbr.sh && ./bbr.sh
Press Enter, it will ask you to press any key to start installation, so you can press Enter again, then it will be installed within a few seconds. To make Google BBR start working, you need to restart V2Ray by running the following command.
systemctl restart v2ray
At this point, the installation, settings and optimization of V2Ray are all completed. The next step is to install the V2Ray client app on your smartphone or computer.
Let’s first take a look at the V2Ray client apps for mobile devices.
The V2Ray client app that Android users need to install is called V2RayNG, which can be installed from the Google Play Store. If you are in China, download it on Github (click here to go to the download page).
The client apps for iOS users are Shadowrocket, ShadowRay, Kitsunebi, or Pepi, all of which were originally designed for Shadowsock, but now also support V2Ray. Shadowrocket is a paid app with better performance. If you are in China, you need an overseas iTunes account to search for these apps on the App Store, as all VPNs and similar apps have been removed from the Chinese version of the App Store.
The following is the V2Ray client apps for desktop or laptop devices, all can be downloaded on Github:
Windows: V2RayN (After access the download page, select “v2rayN-Core.zip” in the lastest release to download, decompress and double click “v2rayN” inside the folder to run the app)
Mac OS: V2RayX
Here is a brief introduction to the use of V2Ray Android client app V2RayNG. Open the app and click the plus sign on the upper right, select “Manual input [Vmess]” in the drop-down list, and then find the corresponding area to enter the remark (any name is ok), the server IP address, Port, ID, and alterID, and then choose Security, which is the encryption method, it’s recommended to select “Chacha20-poly1305”. After that, tap the check mark on the upper right, and then tap the connect button at the bottom right to connect to the server.
The use of client application of other operating systems is also similar, first add server in the client, enter the server IP and the information found in the V2Ray configuration file and then connect.
Once connected, you can leave the app running in the background, and try to access websites that are blocked in your country.