V2Ray Guide for Secure and Open Internet Access

V2Ray official website

A free cross-platform tool that helps you encrypt network traffic and bypass interference from network providers.

I. Features

The V2Ray project, as software, is permanently free;
Cross-platform, currently supports Windows, Mac OS X, and Linux, with support for iOS and Android to be added in the future;
No installation required; the release package contains only one application and one configuration file, and can run immediately after download without relying on third-party tools;
Flexible configuration; the client and server share the same application, and different effects can be achieved by using different configuration files.

II. How it works

It works basically the same as SS, using an encrypted protocol to connect to a remote server and bypass the firewall, so both the server and client need to be configured.

036

 

 

III. Server configuration

Debian / Ubuntu

1. Install unzip and curl

apt-get update
apt-get install unzip
apt-get install curl

For centos6 and centos7, you need to open the port you want to set before it can be used

centos 6

iptables centos6 firewall

Start/stop/restart the firewall
 If you do not want anything too complicated, you can simply disable the firewall directly

Enable firewall (takes permanent effect after reboot):chkconfig iptables on

Disable firewall (takes permanent effect after reboot):chkconfig iptables off

Enable firewall (takes effect immediately, invalid after reboot):service iptables start

Disable firewall (takes effect immediately, invalid after reboot):service iptables stop

Restart firewall:service iptables restartd

.View open ports

/etc/init.d/iptables status
Open a port (using 8080 as an example)
Open port
iptables -A INPUT -p tcp --dport 8080 -j ACCEPT Save and restart the firewall
/etc/rc.d/init.d/iptables save
/etc/init.d/iptables restart
To open ports between 49152 and 65534, you can enter
iptables -A INPUT -p tcp --dport 49152:65534 -j ACCEPT  

Likewise, you need to save the settings here and restart the firewall.

centos7

# firewall-cmd –zone=public
–add-port=65443/tcp –permanent
//permanently add port 65443 to the allowed rules
# firewall-cmd –zone=public –list-ports
//display the list of open ports
65442/tcp 65443/tcp
# firewall-cmd –reload

2. Then run the following command to download and install V2Ray:

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

This will install it automatically and configure the auto-start script.

V2Ray installation directory: /usr/bin/v2ray/

Configuration file path: /etc/v2ray/config.json

Open the V2Ray configuration file vi
/etc/v2ray/config.json

Here you mainly need to change “port” and “id”; the script will generate them automatically.
Of course, you can also set your own port and ID.

PS: PROT is the port number. 
The ID is like the Shadowsocks password; vmess is where v2RAY differs from SHADOWSOCKS.

Log file: /var/log/v2ray/access.log

Commands: service v2ray
start|stop|status|reload|restart|force-reload

For example, after the system is installed      service v2ray start                
  Start

If you changed the configuration yourself        service v2ray restart          
 Restart

 

 

3. Edit the configuration file vi /etc/v2ray/config.json

{
  "port": 12286,  #Port, set it yourself
  "log" : {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "warning"
  },
  "inbound": {
    "protocol": "vmess",
    "settings": {
      "clients": [
        {
          "id": "d41f12d9-6d69-4f8c-8fa7-13c5e1a7c2f7",   #User ID
          "level": 1
        }
      ]
    }
  }

The password-like line after the user ID is the UUID, which functions the same as an SS password.

You can generate it through the website; to configure multiple users, just add multiple lines.

{
    "id": "d41f12d9-6d69-4f8c-8fa7-13c5e1a7c2f7",
    "id": "5c84ab74-111a-450a-94c8-78a9c6113fe3",
    "id": "a0a4f9ad-2149-4e28-9fe8-498017406c9f",
    "level": 1
}

4. Start the server

service v2ray start

Afterward, you can use service v2ray
start|stop|status|reload|restart|force-reload to control V2Ray
operation

2. Client Configuration

First, you need to download the client software: https://github.com/v2ray/v2ray-core/releases

For example, I use Windows 64-bit, so I can download v2ray-windows-64.zip

Then download the client launcher software: https://www.v2ray.com/chapter_01/3rd_party.html

For Windows, you can download v2ray-taskbar:

https://github.com/kxjhlele/v2ray-taskbar/releases/download/0.2/v2ray-taskbar.zip

Extract the above two compressed files into the same folder:

v2ray - High-performance modular proxy software - Image 1 | Kuangruan Blog

Open config.json to start configuring the client:

By default, the SOCKS protocol is used. You can find its documentation here: https://www.v2ray.com/chapter_02/protocols/socks.html

After the configuration is complete, double-click v2ray-taskbar.exe to start it. The following is the log:

Then you can configure the proxy, for example, I configured SwitchyOmega in Chrome:

v2ray - High-performance modular proxy software - Image 2 | Kuanruan Blog

If you need automatic switching, please configure it yourself. Then switch the proxy to
v2ray and try accessing it. Configuration complete!

Using the Shadowsocks Protocol

v2ray is compatible with the Shadowsocks
protocol. After configuring it, it is equivalent to having an additional Shadowsocks server.

1. Server-side Configuration

Open the configuration file again:

You can keep the file’s default protocol section, then add the extended configuration after inbound
( Note: please delete the explanatory comments yourself ):

In the configuration file, I enabled two Shadowsocks-compatible ports:
30001 and 30002. For other details, see this page:

https://www.v2ray.com/chapter_02/protocols/shadowsocks.html

Restart the v2ray server:

2. Client Configuration

The client can directly use a Shadowsocks or ShadowsocksR client.

v2ray - High-performance modular proxy software - Image 3 | Kuanruan Blog

Once everything is configured, switch the Shadowsocks proxy to this server and test it.

5. Firefox Settings

Settings

The machine’s time is very important, so please keep the time synchronized
If you cannot connect, use the sudo dpkg-reconfigure
tzdata command to change the time zone from the United States to Hong Kong

Of course, v2ray supports one-click BBR acceleration, which can reduce and prevent packet loss. This site has a one-click BBR tutorial.

 

Leave a Comment

Your email address will not be published. Required fields are marked *

中文 EN
🚀

RedGate VPN

免费节点太挤太慢?
升级高速稳定专线

立即体验 →

告别卡顿

RedGate VPN
全球高速节点

免费下载 →
Scroll to Top