V2Ray TLS Handshake and Certificate Errors: Fix Clock and SNI Issues

Troubleshoot common TLS handshake failures and invalid certificate errors, focusing on how to identify and fix clock drift, an SNI mismatch, and misuse of allowInsecure.

At a glance

For readers who have imported a node but encounter a handshake failure or certificate rejection when connecting. First determine whether the error occurs during a node connection or subscription update, then check the clock, hostname, and certificate chain. Keep certificate verification enabled and retest the same node after making changes.

Identify handshake errors in the core logs

In the v2rayN main window, select the affected node, make a real request, then check the core logs for that same moment. Work inward from the connection failure message and note the most specific x509: or tls: error. A TCP latency test only shows that the port was reachable at some point; it does not confirm that the TLS handshake completed or that the certificate passed verification.

x509: certificate has expired or is not yet valid

Cause: The current time used by the client falls outside the certificate’s validity period. Fix: Sync the system clock first. If the time is correct, check whether the server’s actual certificate or an intermediate certificate has expired.

x509: certificate signed by unknown authority

Cause: The client cannot build a chain from the peer certificate to a trusted issuer. Fix: Check whether the server is missing a required intermediate certificate and verify which trust store the core uses. Don’t extract a certificate from a failing connection and trust it directly.

x509: cannot validate certificate for 192.0.2.10 because it doesn't contain any IP SANs

Cause: An example IP address in the logs is being used as the verification name, but the certificate has no IP SAN. Fix: If the service explicitly supports connecting by IP, set serverName to a DNS name covered by the certificate, as specified by the service provider.

remote error: tls: handshake failure

Cause: The peer sent a generic handshake failure alert. This message alone doesn’t identify whether the issue is the hostname, TLS parameters, or connection settings. Fix: Check the port and security type first. If you manage the server, look up its handshake logs for the time of the request.

If the error appears only after you click “Update subscription,” check the subscription URL’s HTTPS certificate and your system clock first. The subscription site and nodes may use different hostnames, ports, and certificates. Changing the node’s SNI won’t fix a certificate error on the subscription site.

Sync the system clock and check the validity period

443
Default HTTPS TCP port; not a fixed node port
123
Common UDP port for NTP time services

A certificate’s validity period is defined by Not Before and Not After. Convert log timestamps to UTC before comparing them to avoid confusing the displayed time zone with an incorrect system clock. Changing the time zone usually only changes how the time is displayed. If you previously set the clock manually using the wrong time zone, the actual system time may still be wrong.

  1. Turn on automatic time

    In Windows 11, open “Settings” → “Time & language” → “Date & time,” turn on “Set time automatically,” and check the current time zone. On devices managed by organizational policy, follow your organization’s time-source settings.

  2. Sync the clock now

    On the same page, click “Sync now.” If syncing fails, first check your network connection and whether the configured time source is available. Being able to browse the web doesn’t mean NTP requests can get through. Don’t repeatedly adjust the clock by hand instead of syncing it.

  3. Check the validity period

    Try connecting again and compare the current time in the new logs with the certificate’s validity period. If the endpoint’s certificate was recently replaced, confirm that the new certificate is actually being served; don’t rely only on the certificate file uploaded to the management panel.

  4. Retry the same node

    Keep the address, port, and security type unchanged; change only the system clock, then test again. If several previously working TLS nodes recover at once, clock drift is a more likely explanation.

Still expired after syncing? Check the endpoint

If only one node still reports an expired certificate, check the certificate served by the peer at the address, port, and hostname that node actually uses. A reverse proxy or load balancer may still serve an old certificate on one endpoint. Updating the client won’t replace it.

Compare the connection address, TLS SNI, and transport Host

In the v2rayN main window, double-click the affected node and check “Address,” “Port,” and the TLS-related fields in the editor. Depending on the version, the field may be labeled “SNI” or serverName; compare values based on what each field does. A provider’s “disguise domain” isn’t a standardized field name: it could mean the TLS hostname or the WebSocket Host. Don’t copy it into every hostname field.

FieldPurposeWhat to check
Address and portDetermine where the client actually connects.Use the assigned endpoint and port. Don’t assume the domain on the certificate is also the connection address.
TLS SNI / serverNameA hostname in SNI helps the server select a TLS virtual host. In a typical TLS configuration, the specified serverName is also used to verify the certificate’s hostname.Enter a hostname such as edge.example, without https://, a port, or a path. The certificate’s DNS SAN must cover this name.
WebSocket HostUsed to select a virtual host for the HTTP request sent after the TLS handshake.Set this according to the transport configuration. Changing the Host won’t fix a certificate hostname error during the TLS handshake.

A wildcard certificate for *.example.net can match edge.example.net, but not example.net or a.edge.example.net. If the logs show a certificate for another site, check the SNI and actual endpoint first, then ask the server administrator to verify the virtual host’s certificate binding. Don’t copy an unfamiliar hostname from the logs into the expected name field: passing hostname verification doesn’t prove you connected to the intended service.

Inspect the endpoint certificate and trust chain

If OpenSSL is installed on your computer, you can independently check a standard TLS/TCP endpoint that you manage or are authorized to test. The example below uses reserved addresses and example hostnames: replace -connect with the address and port the node actually uses, and replace both hostnames with the confirmed TLS name. This check won’t send node credentials or test a WebSocket path, VLESS authentication, or VMess authentication.

openssl s_client -connect 192.0.2.10:443 \
  -servername edge.example -verify_hostname edge.example \
  -verify_return_error -showcerts

Keep certificate verification enabled and retest

In core versions that still support allowInsecure, enabling it relaxes standard certificate verification and may allow connections that would otherwise be blocked because of an expired, mismatched, or untrusted certificate. It doesn’t fix the certificate or make the server select the right virtual host. Support for this field varies between core versions, so don’t treat a setting in an old configuration as a universal fix.

After saving, confirm the core has loaded the updated configuration. Keep certificate verification enabled and make a real request through the same node. If the issue came from the subscription configuration, update the subscription once more after testing to confirm it doesn’t overwrite the corrected hostname. When reporting the issue to the administrator, include the exact error, time, and time zone; remove the subscription URL, user identifiers, and access tokens.

Get a client