GithubHelp home page GithubHelp logo

v2ray-padavan's Introduction

v2ray-padavan

注意!!!重点推荐使用新的方案,性能更优,更稳定。

新方案在这里!新方案在这里!新方案在这里!

本文为在k2p路由器使用padavan(N56U/改华硕)固件安装配置v2ray的简单流程,相关的配置请参考官方文档。其他型号路由器理论上类似,可以参考。

为了方便小伙伴们,这里给出了一个配置样例供参考。注意替换==包含的内容为你自己的配置,路由部分使用自定义的site文件,支持gw上网及各种广告过滤,site.dat文件可以从v2ray-adlist获取最新版。

重要提示:

由于v2ray体积较大,需要自行编译路由器固件,增大storage分区的大小,可以先fork一下https://github.com/hanwckf/rt-n56u,然后根据自己的需要修改配置文件,目前使用的是自编译的K2P_DRV,如果有需要可以在我的repositories里找rt-n56u

需要修改3个文件,本文将storage分区大小调整为6mb,修改时注意进制及单位:

获取最新版本的v2ray

更新:在我的v2ray-openwrt里增加了压缩流程的相关说明,需要的话移步前去查看。release下有已经整合编译并压缩过的v2ray可以直接下载使用,直接支持读取json配置文件,不用额外转换。

下载路由器硬件对应平台的压缩包到电脑并解压。以k2p为例的话是mipsle。解压后得到v2ray单文件,文件已经使用upx压缩过,体积比官方的小,一般不超过4mb,这样才好放到路由器里。

上传软件

一共需要4个文件:v2ray、config.conf、iptables.sh、check.sh

mkdir /etc/storage/v2ray
cd /etc/storage/v2ray
# 上传v2ray相关文件到该目录下
chmod +x v2ray

透明代理(iptables.sh)

透明代理部分使用iptables实现,如果不需要可自行删减修改。

规则中局域网的ip段(192.168.1.0)和v2ray监听的端口(12345)请结合实际情况修改。

#!/bin/sh

# set iptables rules
iptables -t nat -N V2RAY
iptables -t nat -A V2RAY -d 0.0.0.0/8 -j RETURN
iptables -t nat -A V2RAY -d 127.0.0.0/8 -j RETURN
iptables -t nat -A V2RAY -d 192.168.1.0/24 -j RETURN
# From lans redirect to Dokodemo-door's local port
iptables -t nat -A V2RAY -s 192.168.1.0/24 -p tcp -j REDIRECT --to-ports 12345
iptables -t nat -A PREROUTING -p tcp -j V2RAY
iptables -t nat -A OUTPUT -p tcp -j V2RAY

点此直接下载 iptables.sh文件

启动/守护脚本(check.sh)

上次添加了守护脚本后,发现有时会出现多个进程同时存在的情况,导致cpu居高不下直至路由系统挂掉,猜测可能是脚本加在防火墙启动后调用导致,未证实。

#!/bin/sh

cd /etc/storage/v2ray

sleep 5

while true; do
    server=`ps | grep -e "v2ray[[:space:]]\|v2ray$" | grep -v grep`
    if [ ! "$server" ]; then
        ulimit -v 65536
        ./v2ray &
    fi
    sleep 60
done

点此直接下载check.sh文件

设置v2ray开机自动启动

高级设置 -> 自定义设置 -> 脚本 -> 在路由器启动后执行:

# 增加一行
/etc/storage/v2ray/check.sh &

高级设置 -> 自定义设置 -> 脚本 -> 在防火墙规则启动后执行:

# 增加一行
/etc/storage/v2ray/iptables.sh

保存软件及配置

padavan系统文件系统是构建在内存中的,重启后软件及配置会丢失,所以操作完成后,需要将v2ray及配置写入闪存。

高级设置 -> 系统管理 -> 配置管理 -> 保存内部存储到闪存: 提交

由于v2ray程序比较大,提交保存操作需要一定的时间,点过提交后请耐心等待1分钟,以确保写入成功。

如果一切顺利,重启路由器后你想要的v2ray依然在默默守护着你。Good luck!

更新记录

2020-07-16

  • 导向新方案

2019-06-07

  • 去掉pb文件相关描述

2019-03-12

  • 修改了脚本及启动方式

2019-02-11

  • 增加了守护脚本,自动重启v2ray

2018-12-10

  • 增加了客户端配置样例,方便使用

v2ray-padavan's People

Contributors

felix-fly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

v2ray-padavan's Issues

关于hiboy的v2ray使用经验

1、一定要在ss设置中的第三方dns改成非dnsmasq,最好也关闭chinadns。dnsmasq会自动启动chinadns,这几个进程会反复启动,导致v2ray也反复启动无法使用

2、v2ray设置中的 透明代理路由规则使用方式,一定要用分流。选择内部分流规则会导致v2ray进程反复启动

3、最好只留一个节点,或者关闭故障转移。因为我这里一个节点会经常检查出问题要切换,但实际上可以一直正常使用。只是系统日志一直显示
“Feb 7 23:05:33 【v2ray】: 【自动】设置 ss_tproxy 配置文件,配置导入中...
Feb 7 23:05:35 【v2ray】: 【自动】设置 ss_tproxy 配置文件,完成配置导入”
但不影响使用

我照着您的教程修改为ss+v2ray-plugin无法启动

您好:
很多路由器自带了ss-libev,因为体积小巧。但是仅用ss很容易被识别,所以我想增加v2ray-plugin插件一起使用。
照着您的教程,我解包了trx固件,将v2ray-plugin插件压缩到2.5MB大小,复制到了/etc_ro目录中,重新打包为trx固件,在breed中也成功刷入并且能够正常启动。
在bash下,我单独运行ss-libev是可以启动的;单独运行v2ray-plugin也是可以启动的。
但是当用参数例如:
/usr/bin/ss-orig-local -s website.com -p 443 -l 8080 -k password -m chacha20-ietf-poly1305 -t 300 -u --fast-open --mptcp --no-delay --plugin /etc_ro/v2ray-plugin --plugin-opts "tls;fast-open;path=/ss;loglevel=none;remoteAddr=website.com;remotePort=443"
这样来启动,能够看到ss-libev启动成功,随后v2ray-plugin就要报错。
failed to start server: v2ray.com/core/app/proxyman/inbound: failed to listen TCP on 15908 > v2ray.com/core/transport/internet: failed to listen on address: [::1]:15908 > listen tcp [::1]:15908: bind: cannot assign requested address
希望能够得到您的帮助。
谢谢!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.