V2Ray Chinese Site > V2Ray Setup > V2Ray Time Synchronization Tutorial: Resolving Time Inconsistency between V2Ray Server and Client
V2Ray Time Synchronization Tutorial: Resolving Time Inconsistency between V2Ray Server and Client
When configuring V2Ray, if the V2Ray server uses the Vmess protocol and the client's time is inconsistent with the VPS's time, it can lead to a malfunction. This article will introduce methods for synchronizing time between the V2Ray server and the V2Ray client.
As mentioned in the V2Ray official script installation and download time calibration section, the verification method includes time. Even if there are no configuration issues, if the server and client's time don't match, you can't connect to the V2Ray server, and the server will consider it an illegal request. Time zone differences are acceptable; the main protocol affected is Vmess. If you are using the latest VLESS protocol, it is not affected by time differences.
V2Ray Server
Checking the VPS Server Time
If your VPS server runs on a Linux system, you can check the server time using Linux time-viewing commands, as follows:
bash
date -R
Setting the Time Zone to Beijing Time
This step is not mandatory. Generally, foreign VPSs use international time zones by default. For convenience, you can set it to match your local time. If you are in mainland China, you can set it to Beijing time. Log in to the V2Ray server via SSH and execute the following commands:
NTP (Network Time Protocol) is used for time synchronization between distributed time servers and clients (in this context, the V2Ray server). It is a complex synchronization protocol across wide or local area networks and usually achieves millisecond-level accuracy.
Using the NTP protocol on a VPS server can easily synchronize the VPS server's time with a time server. First, install the necessary packages:
Debian/Ubuntu:
bash
apt-get install ntp ntpdate -y
CentOS/RedHat:
bash
yum install ntp ntpdate -y
After installation, stop the current NTP service on the VPS server:
bash
service ntpd stop
Then synchronize the current VPS server's time with a time server:
bash
ntpdate us.pool.ntp.org
Finally, start the NTP service:
bash
service ntpd start
After executing these steps, the time on the VPS server will be relatively accurate.
Client
As for how clients can synchronize time, it's assumed everyone knows how, so it won't be explained here.
Reference Resources
Default Time Zone Reference Table
Public NTP Network Time Server List
5/5 - (4 votes)
Last Updated: 2022-06-24
V2Ray Setup