Simple V2Ray Deployment

About V2Ray Project V is a set of tools that can help you build your own dedicated base communication network. The core tool of Project V is called V2Ray, which is primarily responsible for implementing network protocols and functions, and communicates with other Project V tools. V2Ray can run standalone or work together with other tools to provide a streamlined workflow. For more information and resources, please refer to: https://v2ray.com/. V2Ray is more like a platform of tools, supporting a range of protocols, including Shadowsocks, though given recent stability and usability, using SS is not recommended. This article uses the VMess protocol. Deployment The following steps assume a VPS has already been deployed and you are logged in as the root user. For details, refer to the article: The Complete Guide to Bypassing Internet Censorship Download V2Ray Then run the script to install V2Ray: The and from above will be needed later. Start V2Ray Configure the Firewall Do not skip this step, otherwise everything configured afterward will be useless. CentOS 7.0 uses firewall as the default firewall. Open a port firewall-cmd --zone=public --add-port=80/tcp --permanent Parameter meanings: -- zone #scope -- add-port=80/tcp #add port, format: port/protocol -- permanent #permanent, without this parameter the change will not persist after a restart The above comes from in the installation script output. You can then run to view the configuration. For CentOS 6.0, use iptables instead. Commands: Client Installation I use a Mac, so I chose V2RayX. For other platforms, you can choose and download from here. Server-Side Configuration V2Ray configuration uses JSON format, which is relatively complex. If you're a developer, you should find it familiar. The default server-side configuration path is . Edit the configuration with . Necessary explanations: is the port mentioned earlier. Note: this is the server's port. is the client ID, which must match the client configuration (covered later). and will also be used in the client configuration; just keep them consistent. Client Configuration After opening V2RayX, look at its menu and open . Then fill in the corresponding configuration based on the JSON above. After confirming, check from the menu. If all previous steps were done correctly, you should now be able to browse freely. Troubleshooting and Optimization Only basic approaches and methods are provided here. V2Ray has logs to help with troubleshooting. View the client configuration and logs as follows. The server-side logs need to be configured first before they are recorded. Edit the configuration with . Add the configuration below. Make sure not to miss the English-mode commas. You can then view the server-side logs with the command . During my first configuration, I forgot to open the firewall port and deduced this by examining the logs. In addition, since we're using the TCP protocol, HTTP header obfuscation can be applied. See here for details. The key configuration is: Add this inside in the server configuration, at the same level as . Also add it on the client side, but in . For optimization, the main approach is to use BBR. Important: be sure to check the system version. The following is for CentOS 7. If you use this on another version, the system may fail to boot on restart. For CentOS 8, see further below. Select 1. After installation is complete, restart the VPS, then restart V2Ray with , run the script again with , and select 5, , to finish. CentOS 8's default kernel version is 4.18.x. Any kernel version above 4.9 can directly enable BBR, so enabling BBR on CentOS 8 is very simple. Then restart the system. If the output contains BBR, it means BBR has been enabled successfully. There are actually more optimizations available, but I simply haven't had time to implement them — this will do for now. Additionally, for the iOS client, I use Kitsunebi.