How To Debug V2ray Access Error Using V2ray Log

After I set up the v2ray server and connect it using a v2ray client software, I find the v2ray server does not work, because I can not browse the internet through the v2ray server. So I need to debug both the v2ray server and client to find the error. This article will tell you how to debug the v2ray server and client to fix the access error.

1. How To Debug V2ray On Server And Client Side.

  1. Add the log entry at the beginning of the v2ray config.json file like below.
  2. Below is the v2ray client-side config.json file log entry.
    {
        "log": {
            "loglevel": "warning", // Level of log
            "access": "D:\\v2ray\\access.log",  // Your path of in windows
            "error": "D:\\v2ray\\error.log"
        },
        "inbounds": [
        {
           ......
        }
  3. Below is the v2ray server-side config.json file log entry.
    {
      "log": {
        "loglevel": "warning",
        "access": "/var/log/v2ray/access.log", // Your path of log in Linux
        "error": "/var/log/v2ray/error.log"
      },
      "inbounds": [
      {
          ......
      }
  4. The loglevel attribute value can be one of “debug”, “info”, “warning”, “error”, “none”.
  5. The access attribute value is the access log file path.
  6. The error attribute value is the error log file path.
  7. Now you can run the command tail -f /var/log/v2ray/access.log to see the access log data on the server-side.
  8. You can see the official document https://guide.v2fly.org/en_US/basics/log.html#client-side-configuration for a detailed explanation.

2. How To Fix Error invalid user: VMessAEAD is enforced and a non VMessAEAD connection is received.

  1. In my v2ray server log, I find the error invalid user: VMessAEAD is enforced and a non VMessAEAD connection is received, below is the detailed error message.
    2022/03/12 10:00:24 111.199.187.42:0 rejected common/drain: common/drain: unable to drain connection > websocket: close 1000 (normal) > proxy/vmess/encoding: invalid user: VMessAEAD is enforced and a non VMessAEAD connection is received. You can still disable this security feature with environment variable v2ray.vmess.aead.forced = false . You will not be able to enable legacy header workaround in the future.
  2. I finally find the method to fix this error.
  3. First, you can change the alterId value to 0 in both server and client file config.json.
  4. If this does not take effect, and your server OS is ubuntu, you can follow the below steps to fix it.
  5. Edit the file v2ray.service use the text editor vim.
    vim /etc/systemd/system/v2ray.service
  6. Change the line ExecStart=/usr/bin/v2ray/v2ray -config /etc/v2ray/config.json to ExecStart=/usr/bin/env v2ray.vmess.aead.forced=false /usr/bin/v2ray/v2ray -config /etc/v2ray/config.json.
  7. Run the below command to reload the v2ray service.
    systemctl daemon-reload
    systemctl restart v2ray
  8. Run the command v2ray log to see the log data, you can find the error has been fixed.
  9. If you have any more questions, you can refer to the article https://github.com/Jrohy/multi-v2ray/issues/561, https://github.com/233boy/v2ray/issues/812#issuecomment-1006285593.
  10. For the client-side, you had better use the v2ray official client software (https://github.com/v2ray/dist/) to connect to the v2ray server on macOS, and you can use the v2ray-N on the Windows OS.

3. References.

  1. IPVanish Homepage

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.