V2RAY SET UP

Recently, the Great Wall has been built higher, like the US-Mexico border, so, I have to figure a way out…

Since V2Ray has claimed to be more secure and powerful, I decided to configure it on my VPS so that I can crawl out of the wall.

The VPS service I used is DigitalOcean, and there is a $50 credits for 30 days link for you to try it out.

The system I am using for VM is Ubuntu 18.04. I think these commands also support Debian 7+ and CentOS 7+.


Set Up Virtual Machine

Create a Droplets

As far as I’m using this service, the process has been fairly easy. Click on the top right, and select Create -> Droplets as shown:

Then, you will see the set up page for the droplet, which allows user to modify different settings visually. The Distributions I selected is Ubuntu 18.04 x 64, and the plan I chose is the cheapest one -> $5 per months one.

I just left the rest of setting as it be, besides the Select additional options. In that section, I select _IPv6_, as it allows data to be transferred on the Internet:

I do not have any preference toward a pacific region on the list. With the current situation, I’d recommend you to ping the given IP address after the droplet has been created. If the connection is not lost, which means this address survived. Otherwise, just delete this droplet, and create a new one.

After making sure the current IP address works, it’s time for next step.


Configure V2Ray

Before configuring VM, open the email account related to DigitalOcean, the IP address, Username usually is root, and password is sent via email.

Log in to the VM via tools. I used PuTTy, but anything that can connect to VM works. First time log in to the account, the machine requires you to reset the password. After resetting the password, it’s time for real configuration.

Simply just following these processes is fine:

1
2
3
4
5
6
# install curl
$ apt-get update -y && apt-get install curl -y
# run v2ray script
$ bash <(curl -L -s https://install.direct/go.sh)
# I like to check if the config file for v2ray actually exists and looks properly
$ cat /etc/v2ray/config.json

If the file looks like something below, then everything at this point woks properly.

{
“inbounds”: [{
“port”: #####,
“protocol”: “vmess”,
“settings”: {
“clients”: [
{
“id”: “some uuid”,
“level”: 1,
“alterId”: 64
}
]
}
}],
“outbounds”: [{
“protocol”: “freedom”,
“settings”: {}
},{
“protocol”: “blackhole”,
“settings”: {},
“tag”: “blocked”
}],
“routing”: {
“rules”: [
{
“type”: “field”,
“ip”: [“geoip:private”],
“outboundTag”: “blocked”
}
]
}
}

port, id, and alterId can be changed. I believe id is in the format of uuid, unless you find some generator, don’t mess with it.

1
2
3
4
5
6
7
8
9
10
11
12
13
# the script suppose to start the service, but just in case
$ service v2ray start
# check if the vps port is accessible
$ firewall-cmd --zone=public --list-ports
# if firewall is installed, then it'll list the port, otherwise, install it first
$ apt install firewalld
$ systemctl start firewalld # start the service
# then check the port again
$ firewall-cmd --zone=public --list-ports
# if the port is not accessible
$ firewall-cmd --zone=public --add-port='port_in_config.json_here'/tcp --permanent
$ firewall-cmd --reload # reload service
$ firewall-cmd --zone=public --list-ports # the port should be accessible

All other set up tutorials stop here, and says that after this step, the V2Ray is all good and ready to connect.

However, I found it to not be true. I tried it several times, and wasn’t able to connect. Just when I thought that V2Ray has already been detected, I finally found the solution.


Last Step Configuration

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
$ netstat -apn | grep v2ray
tcp6 0 0 :::xxxxx :::* LISTEN XXXX/v2ray
unix 3 [ ] STREAM CONNECTED 788043 22194/v2ray
# v2ray is not listening properly, it's not getting the proper ip address. Add the ip address forceing v2ray to listen
$ nano /etc/v2ray/conf.json
{
"inbounds": [{
"port": #####,
"protocol": "vmess",
"listen":"add.your.port.here"
"settings": {
"clients": [
{
"id": "some uuid",
"level": 1,
"alterId": 64
}
]
}
}],
"outbounds": [{
"protocol": "freedom",
"settings": {}
},{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
}],
"routing": {
"rules": [
{
"type": "field",
"ip": ["geoip:private"],
"outboundTag": "blocked"
}
]
}
}
# restart the service
$ systemctl restart v2ray

Set Up V2Ray Server

Again, I use windows.

Download Necessary Files

v2rayN and v2ray-core, both of them are on the GitHub.

Once download completes, add v2rayN.exe into 2nd folder, which I believe is v2ray-windows-64.zip.


Configure V2RayN

Click on V2RayN, and click add [VMess] server under servers as below

Then, enter the information in /etc/v2ray/conf.json, mainly is the IP address of the VM, port set by V2Ray script, UUID generated during the process, and the AlterId which by default is 64.


Reference

V2Ray教程:V2Ray服务器搭建、V2Ray软件下载和配置

从零开始:史上最详尽V2Ray搭建图文教程

CentOS开放端口的方法

解决v2ray安装之后无法连接问题

-------The end of this article  Thank you for your reading-------
0%