找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 9195|回复: 20

借助华为光猫里的openwrt跑起v2瑞

[复制链接]
发表于 2019-7-19 19:49 | 显示全部楼层 |阅读模式
本帖最后由 99010 于 2019-11-6 01:02 编辑

本贴仅做为技术研究。

华为hs8145v里面有个使用lxc chroot模式运行的openwrt,具体参考这个帖子
https://www.right.com.cn/forum/thread-352805-1-5.html

有点区别的是,本人没使用22端口,使用了2222端口,避免了端口冲突。

简单说就是跳过修改hw_ctree.xml的步骤,而是修改etc/config/dropbear。
  1. cd /tmp
  2. wget http://archive.openwrt.org/chaos_calmer/15.05.1/omap/generic/packages/base/dropbear_2015.67-1_omap.ipk
  3. tar xzf dropbear_2015.67-1_omap.ipk
  4. cd /opt/upt/apps/apps/
  5. tar xzf /tmp/data.tar.gz
  6. mkdir etc/rc.d && cd etc/rc.d
  7. ln -s ../init.d/dropbear S50dropbear
  8. rootpw=$(grep root /etc/shadow|cut -d: -f2)
  9. sed -i "s/root:/root:$rootpw/" ../shadow
复制代码
修改ssh端口,可改成你需要的。
  1. vi etc/config/dropbear
复制代码

保存后重启光猫,光猫启动后即可用修改过的端口登陆ssh。

剩下的按照原帖子照做就行。

-------------------------------------------------------------
到v2瑞的github
https://github.com/v2瑞/v2瑞-core/releases
下载v2瑞-linux-arm,解压后把geoip.dat、geosite.dat、v2ctl、v2瑞上传到/etc/r2ray目录,记得把v2ctl、v2瑞权限修改为0755。(最好先把v2ctl、v2瑞用upx压缩体积后再传)

建一个/etc/init.d/v2瑞文件
内容如下:
  1. #!/bin/sh /etc/rc.common
  2. # "new(er)" style init script
  3. # Look at /lib/functions/service.sh on a running system for explanations of what other SERVICE_
  4. # options you can use, and when you might want them.

  5. START=99

  6. SERVICE_USE_PID=1
  7. SERVICE_WRITE_PID=1
  8. SERVICE_DAEMONIZE=1

  9. start() {
  10.         service_start /etc/v2瑞/v2瑞 -config=/etc/v2瑞/config.json
  11. }

  12. stop() {
  13.         service_stop /etc/v2瑞/v2瑞
  14. }
复制代码
修改权限0755。
设置开机启动
  1. /etc/init.d/v2瑞 enable
复制代码


然后在/etc/v2瑞目录创建一个v2瑞的配置文件config.json
大概内容如下(仅限在4.+以上版本使用):
  1. {
  2.         "inbounds":[
  3.                 {  //任意门,用于透明代理
  4.                 "protocol": "dokodemo-door",
  5.                 "port": 1080,
  6.                 "listen": "0.0.0.0",
  7.                 "settings": {
  8.                         "network": "tcp, udp",
  9.                         "timeout": 30,
  10.                         "followRedirect": true
  11.                         },
  12.                 "sniffing": {
  13.                         "enabled": true,
  14.                         "destOverride": ["http", "tls"]
  15.                         },
  16.                 "tag": "in-0"  //入口0标识
  17.                 },
  18.                 {  //socks5,用于浏览器代理
  19.                 "port":"1081",
  20.                 "protocol":"socks",
  21.                 "settings":{
  22.                         "auth":"noauth",
  23.                         "udp":true
  24.                                 },
  25.                 "sniffing": {
  26.                         "enabled": true,
  27.                         "destOverride": ["http", "tls"]
  28.                         },
  29.                 "tag": "in-1"  //入口1标识
  30.                 },
  31.                 { //http代理,用于系统代理
  32.                 "port":"1082",
  33.                 "protocol":"http",
  34.                 "settings":{},
  35.                 "sniffing": {
  36.                         "enabled": true,
  37.                         "destOverride": ["http", "tls"]
  38.                         },
  39.                 "tag": "in-2"  //入口2标识
  40.                 },
  41.                 { //任意门,备用dns解析
  42.                 "protocol": "dokodemo-door",
  43.                 "port": 5353,
  44.                 "settings": {
  45.                         "address": "8.8.8.8",
  46.                         "port": 53,
  47.                         "network": "udp",
  48.                         "timeout": 0
  49.                         }
  50.                 }
  51.                         ],
  52.         "outbounds":[
  53.                 {
  54.                 "protocol":"vmess",
  55.                 "settings":{
  56.                         "vnext":[
  57.                                 {
  58.                                 "address":"1.1.1.1",
  59.                                 "port":3333,
  60.                                 "users":[
  61.                                         {
  62.                                         "id":"7e8bb2bc-958f-4ecd-ba03-8f1cdc4b3930",
  63.                                         "alterId":32
  64.                                         }
  65.                                                 ]
  66.                                 }
  67.                                         ]
  68.                                 },
  69.                 "tag": "proxy",  //代理标识
  70.                 "sockopt": {"mark": 255}
  71.                 },
  72.                 {  //直连标识
  73.                 "sendThrough" : "0.0.0.0",
  74.                 "tag":"direct",
  75.                 "protocol":"freedom",
  76.                 "settings":{},
  77.                 "sockopt": {"mark": 255}
  78.                 },
  79.                 {
  80.                 "tag":"blocked",
  81.                 "protocol":"blackhole",
  82.                 "settings":{}
  83.                 }
  84.                         ],
  85.         "routing":{
  86.                 "domainStrategy":"AsIs",
  87.                 "rules":[
  88.                         { //被屏蔽的域名走代理,可自行添加
  89.                         "type": "field",
  90.                         "outboundTag": "proxy",
  91.                         "domain": [
  92.                         "google.com",
  93.                         "youtube.com"
  94.                                 ]
  95.                         },
  96.                         { //入口0标识的流量直连
  97.                         "type":"field",
  98.                         "inboundTag": ["in-0"],
  99.                         "outboundTag":"direct"
  100.                         },
  101.                         { //入口1标识的流量直连
  102.                         "type":"field",
  103.                         "inboundTag": ["in-1"],
  104.                         "outboundTag":"direct"
  105.                         },
  106.                         { //入口2标识的流量直连
  107.                         "type":"field",
  108.                         "inboundTag": ["in-2"],
  109.                         "outboundTag":"direct"
  110.                         }
  111.                         ]
  112.                 }
  113. }
复制代码


为了避免配置文件有错误,用命令检查一下是否正确不报错。
  1. /etc/v2瑞/v2瑞 -test -config=/etc/v2瑞/config.json
复制代码
启动v2瑞
  1. /etc/init.d/v2瑞 start
复制代码
设置一下Windows的系统代理为光猫IP以及v2瑞配置里的1082端口,即可愉快使用v2瑞。

不喜欢使用系统代理的可以用浏览器代理。

谷歌浏览器的扩展程序SwitchyOmega里面导入一个新情景模式
这里提供一个已经做好的
  1. https://github.com/FelisCatus/SwitchyOmega/wiki/GFWList.bak
复制代码
然后修改一下SwitchyOmega的GFWed代理服务器为光猫的ip以及v2瑞配置里的1081端口。

再选一下SwitchyOmega为自动切换,到此完成。

想实现透明代理可用如下iptables命令
小白新手不建议使用,小白新手不建议使用,小白新手不建议使用。

输错命令会登陆不了光猫,只能拔电重启光猫。
  1. /sbin/iptables -t nat -N V2RAY
  2. /sbin/iptables -t nat -A V2RAY -d 192.168.0.0/16 -j RETURN
  3. /sbin/iptables -t nat -A V2RAY -p tcp -j RETURN -m mark --mark 0xff
  4. /sbin/iptables -t nat -A V2RAY -p tcp -j REDIRECT --to-ports 1080
  5. /sbin/iptables -t nat -A PREROUTING -p tcp -j V2RAY
复制代码




评分

参与人数 1恩山币 +2 收起 理由
hcyme + 2 面对这种帖子,我内心复杂,真不知道说什么好……

查看全部评分

我的恩山、我的无线 The best wifi forum is right here.
发表于 2019-7-20 08:48 | 显示全部楼层
技术贴,手动点赞
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-7-23 18:02 | 显示全部楼层
厉害厉害,谢谢楼主分享
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-7-24 14:39 | 显示全部楼层
有想法。,手动点赞
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-7-24 14:45 | 显示全部楼层
感谢分享!! 赞
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-7-24 17:36 | 显示全部楼层
大佬,v2瑞配置里,dns这部分,我看你定义了任意门. 代理走8.8.8.8 国内走223.5.5.5  但没有配置“dns ”项

任意门53代理走8.8.8.8我能看懂,, 直接不是应该走"localhost"的吗? 怎么转到223.5.5.5  

对v2瑞 dns 和routing设置不太懂。 请大佬赐教下,谢谢

点评

223.5.5.5只解析指定geosite列表里面国内域名的ip。 geosite:cn是国内域名。  详情 回复 发表于 2019-7-24 18:24
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2019-7-24 18:24 | 显示全部楼层
本帖最后由 99010 于 2019-7-24 18:27 编辑
wulistock 发表于 2019-7-24 17:36
大佬,v2瑞配置里,dns这部分,我看你定义了任意门. 代理走8.8.8.8 国内走223.5.5.5  但没有配置“dns ” ...

223.5.5.5只解析指定geosite列表里面国内域名的ip。
geosite:cn是国内域名。或许改下顺序,你就能看懂。
  1. "dns": {
  2.                 "servers": [
  3.                         {
  4.                         "address": "223.5.5.5",
  5.                         "port": 53,
  6.                         "domains": ["geosite:cn"]
  7.                         },
  8.                         "8.8.8.8"
  9.                         ]
  10.                 },
复制代码


点评

谢谢 我一下理解了v2ray的 dns和routing搭配关系 效果如拨云见日 茅塞顿开  详情 回复 发表于 2019-7-24 18:51
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-7-24 18:51 | 显示全部楼层
99010 发表于 2019-7-24 18:24
223.5.5.5只解析指定geosite列表里面国内域名的ip。
geosite:cn是国内域名。或许改下顺序,你就能看懂。 ...

谢谢  我一下理解了v2瑞的 dns和routing搭配关系   效果如拨云见日 茅塞顿开
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-7-24 19:09 来自手机 | 显示全部楼层
这个牛嗨皮带
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-8-6 23:31 | 显示全部楼层
学习学习学习下
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-9-19 23:01 | 显示全部楼层
透明代理能起作用吗、
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-9-25 23:25 | 显示全部楼层
谢谢光猫上有这个就方便多了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-9-26 20:41 来自手机 | 显示全部楼层
谢谢分享。。。。。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-9-26 20:47 | 显示全部楼层
谢谢分享了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-11-5 20:55 | 显示全部楼层
好贴留名!!!!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-20 10:00

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表