2023年4月10日星期一

k3路由科学上网-v2ray

k3官改的ssr&v2ray使用起来很好用。但长期以来,很多用户反应不好用,我自己使用中了发现,ssr和ss协议的好用,但是v2ray协议基本上用不成,偶尔成功一次也是很短时间用不了,当时不知道原因,今天终于找到方法了,尽管这个方法以前也知道,但由于没弄清楚没弄明白,所以,以前总是不成功,今天,弄成功了,记录一下。

一、ss和ssr直接可以使用,没有任何限制。

二、v2ray分二种情况,分别为tcp模式和ws模式。无论哪种模式,均需要"国外模式"才可以,且在运行时,最好先停止ssr一次,然后再运行。

A、tcp模式

      该模式的节点信息格式如下:

server: us.abc.com, port: 33208, type: vmess, uuid: b1374-9c5-36cf-95dd-f1dad4bd99, alterId: 0, cipher: auto, tls: false,udp:false,

  信息包括:地址+端口+uuid+alterid+(tcl 和 udp等信息)

  当tls和udp均为false时,可以直接在k3的软件里简单地填写对应信息即可,也就是填写四项信息:地址+端口+uuid+alterid。这样就可以直接运行了。

     当tls和udp不全为false时,直接设置是不行的。需要参见下面的方法。

B、ws模式

      该模式的节点信息格式如下:

server: jp.abc.com, port: 30591, type: vmess, uuid: cf16ef-6f63-3cbe-8298-7aa053bcde, alterId: 1, cipher: auto, tls: false, network: ws, ws-opts: {path: /hls/cctv5phd.m3u8, headers: {Host: jp.abc.com}

   信息比上面的tcp多了二项,分别是path和headers

   这时,在设置时,需要设为自定义配置:在自定义配置里输入以下信息:

   下面红色部分,是需要根据每个节点的不同做出更改的。

   {

  "inbound": {

    "protocol": "dokodemo-door",

    "port": 1234,  

    "settings": {

    "network": "tcp,udp",

    "timeout": 30,

    "followRedirect": true

    }

  },

    "dns": {

        "servers": [

            "8.8.8.8:53",         //这一段绿的可以删除,也可以将这个dns改为其它

            "localhost"

        ]

    },

  "outbound": {

    "protocol": "vmess",

    "settings": {

    "udp": true,     根据情况填写。默认为true.

      "vnext": [{

        "address": "jp.abc.com",

        "port": 30591,  

         "users": [

        {

          "id": "cf7116ef-6f63-3cbe-8298-7aa07553bcde",

          "alterId": 1,

         "security": "aes-128-gcm",    这是加密类型,由于本节点无此项,所以,务必删除此行。如果有对应的加密类型,则保留并修改此行即可。

          "level": 0

        }

              ]

      }]

    },

   "streamSettings": {

      "network": "ws",

      "security": "tls",         由于本节点tls为fasle,所以,这一行必须删除,如果tls为ture,则保留此行即可。

      "tlsSettings": {

        "serverName": "jp.abc.com",

        "allowInsecure": true

       },

      "wsSettings": {

        "connectionReuse": true,

        "path": "/hls/cctv5phd.m3u8"

      }

    }

}

}


微信图片_20230409165344.png


上述设置后,基本上就可以正常运行了!

但,还有以下问题:

部分vmess协议的无论是tcp协议还是ws协议,都不能正常运行。经查询,问题出在v2ray版本太低的缘故上。所以,考虑升级v2ray.方法是:

下载较新的且能正常使用的版本替换路由器自带的。下载地址:在下面地址中,下载armV5系列的。

https://github.com/felix-fly/v2ray-openwrt/releases 

v2ray.rar (当前我使用的是4.31版本。虽然不是最新,但很好用!4.44及以上的已经测试过,无法正常使用!所以,有机会可以再试一下4.31-4.44之间的版本,其实如果使用4.31没有问题,也不必再试其它的,升级没有意义。)

使用了一天,4.31在路由重启后,不能正常启动。需要手动再点击一次才可以启动。多次测试,这个4.31在运行时,经常需要二次重复打开运行,才可以。所以,又测试了一下,发现4.32.0和4.32.1也有这方面问题。目前正在测试中。4.32.1再往上的版本已经测试过,不行!所以,现在能用的就是这三个版本,我放在压缩包里了。

将上面文件,放在路由器tmp文件夹,然后通过bind的方法,在每次启动后替换原来的文件即可[注意:需要在用wincap等软件上传下载的的v2ray文件之后,将文件属性改为0777],在路由启动项里添加命令:

mount –bind /tmp/media/nand/opt/bin/v2ray /usr/bin/v2ray

sleep 40 && /usr/root/ssrcmd.sh           //当前使用的4.32.1,加这句话,相当于重新启动一次。经断电重启和热重启测试,都正常。

—————————-

如果使用的是4.31.0的版本,需要再增加一句话:sleep 60 && /usr/root/ssrcmd.sh,即:

   

mount –bind /tmp/media/nand/opt/bin/v2ray /usr/bin/v2ray

sleep 40 && /usr/root/ssrcmd.sh 

sleep 60 && /usr/root/ssrcmd.sh 

经测试,该4.32.1版本,兼容性很好,目前,所有vmess的都可以运行,既包括tcp的,也包括ws的。而在替换之前,只有部分tcp和部分ws的可以运行运行。也就是说,同样的配置,用替换后的v2ray时,可以正常,但使用自带的v2ray却有时不正常。所以,这一步,最好是也替换一下。

同时,替换后发现,原来必须使用国外模式,现在使用gfw模式也可以了!很是好!

=======================2023-04-22追加tcp+tls模式=========

节点信息:

    – { name: '🇸🇬新加坡', type: vmess, server: sg1.wtg888.com, port: 10086, uuid: 3a476ed-ec0e-4508-ae3a-a376f92c8d7d, alterId: 0, cipher: auto, udp: true, tls: true, skip-cert-verify: true, servername: sg1.wtg888.com }

配置信息:已正常运行,可以gfw模式。(其实就是改了一行,将newwork改为tcp即可)

   {

  "inbound": {

    "protocol": "dokodemo-door",

    "port": 1234,  

    "settings": {

    "network": "tcp,udp",

    "timeout": 30,

    "followRedirect": true

    }

  },

    "dns": {

        "servers": [

            "8.8.8.8:53",         //这一段绿的可以删除,也可以将这个dns改为其它

            "localhost"

        ]

    },

  "outbound": {

    "protocol": "vmess",

    "settings": {

    "udp": true,

      "vnext": [{

        "address": "sg1.zwtg888.com",

        "port": 10086,  

         "users": [

        {

          "id": "a3a476ed-ec0e-4508-ae3a-a376f92c8d7d",

          "alterId": 0,

          "level": 0

        }

              ]

      }]

    },

   "streamSettings": {

      "network": "tcp",

      "security": "tls", 

      "tlsSettings": {

        "serverName": "sg1.wtg888.com",

        "allowInsecure": true

       },

      "wsSettings": {

        "connectionReuse": true,

        "path": "/"    其实这一段ws代码可以删除

      }

    }

}

}

===========上面的同样的,例子2,tcp+tls===========

{  "inbound": {    "protocol": "dokodemo-door",    "port": 1234,      "settings": {    "network": "tcp,udp",    "timeout": 30,    "followRedirect": true    }  },    "dns": {        "servers": [            "223.5.5.5:53",            "localhost"        ]    },  "outbound": {    "protocol": "vmess",    "settings": {    "udp": true,      "vnext": [{        "address": "jp03-alt.entry.srthdw.art",        "port": 21583,           "users": [        {          "id": "cf7116ef-6f63-3cbe-8298-7aa07553bde",          "alterId": 1,          "level": 0        }              ]      }]    },   "streamSettings": {      "network": "tcp",      "security": "tls",       "tlsSettings": {        "serverName": "jp05-vm0.entry.srthdw.art",        "allowInsecure": true       },      "wsSettings": {        "connectionReuse": true,        "path": "/hls/cctv5phd.m3u8"      }    }}}

========最后有关于wssetting的没用,可以保留无妨。主要是前面network:tcp+security:tls=======================

Ditulis Oleh : alipada // 四月 10, 2023
Kategori:

0 comments: