|
本帖最后由 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。
- cd /tmp
- wget http://archive.openwrt.org/chaos_calmer/15.05.1/omap/generic/packages/base/dropbear_2015.67-1_omap.ipk
- tar xzf dropbear_2015.67-1_omap.ipk
- cd /opt/upt/apps/apps/
- tar xzf /tmp/data.tar.gz
- mkdir etc/rc.d && cd etc/rc.d
- ln -s ../init.d/dropbear S50dropbear
- rootpw=$(grep root /etc/shadow|cut -d: -f2)
- sed -i "s/root:/root:$rootpw/" ../shadow
复制代码 修改ssh端口,可改成你需要的。
保存后重启光猫,光猫启动后即可用修改过的端口登陆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瑞文件
内容如下:
- #!/bin/sh /etc/rc.common
- # "new(er)" style init script
- # Look at /lib/functions/service.sh on a running system for explanations of what other SERVICE_
- # options you can use, and when you might want them.
- START=99
- SERVICE_USE_PID=1
- SERVICE_WRITE_PID=1
- SERVICE_DAEMONIZE=1
- start() {
- service_start /etc/v2瑞/v2瑞 -config=/etc/v2瑞/config.json
- }
- stop() {
- service_stop /etc/v2瑞/v2瑞
- }
复制代码 修改权限0755。
设置开机启动
然后在/etc/v2瑞目录创建一个v2瑞的配置文件config.json
大概内容如下(仅限在4.+以上版本使用):
- {
- "inbounds":[
- { //任意门,用于透明代理
- "protocol": "dokodemo-door",
- "port": 1080,
- "listen": "0.0.0.0",
- "settings": {
- "network": "tcp, udp",
- "timeout": 30,
- "followRedirect": true
- },
- "sniffing": {
- "enabled": true,
- "destOverride": ["http", "tls"]
- },
- "tag": "in-0" //入口0标识
- },
- { //socks5,用于浏览器代理
- "port":"1081",
- "protocol":"socks",
- "settings":{
- "auth":"noauth",
- "udp":true
- },
- "sniffing": {
- "enabled": true,
- "destOverride": ["http", "tls"]
- },
- "tag": "in-1" //入口1标识
- },
- { //http代理,用于系统代理
- "port":"1082",
- "protocol":"http",
- "settings":{},
- "sniffing": {
- "enabled": true,
- "destOverride": ["http", "tls"]
- },
- "tag": "in-2" //入口2标识
- },
- { //任意门,备用dns解析
- "protocol": "dokodemo-door",
- "port": 5353,
- "settings": {
- "address": "8.8.8.8",
- "port": 53,
- "network": "udp",
- "timeout": 0
- }
- }
- ],
- "outbounds":[
- {
- "protocol":"vmess",
- "settings":{
- "vnext":[
- {
- "address":"1.1.1.1",
- "port":3333,
- "users":[
- {
- "id":"7e8bb2bc-958f-4ecd-ba03-8f1cdc4b3930",
- "alterId":32
- }
- ]
- }
- ]
- },
- "tag": "proxy", //代理标识
- "sockopt": {"mark": 255}
- },
- { //直连标识
- "sendThrough" : "0.0.0.0",
- "tag":"direct",
- "protocol":"freedom",
- "settings":{},
- "sockopt": {"mark": 255}
- },
- {
- "tag":"blocked",
- "protocol":"blackhole",
- "settings":{}
- }
- ],
- "routing":{
- "domainStrategy":"AsIs",
- "rules":[
- { //被屏蔽的域名走代理,可自行添加
- "type": "field",
- "outboundTag": "proxy",
- "domain": [
- "google.com",
- "youtube.com"
- ]
- },
- { //入口0标识的流量直连
- "type":"field",
- "inboundTag": ["in-0"],
- "outboundTag":"direct"
- },
- { //入口1标识的流量直连
- "type":"field",
- "inboundTag": ["in-1"],
- "outboundTag":"direct"
- },
- { //入口2标识的流量直连
- "type":"field",
- "inboundTag": ["in-2"],
- "outboundTag":"direct"
- }
- ]
- }
- }
复制代码
为了避免配置文件有错误,用命令检查一下是否正确不报错。
- /etc/v2瑞/v2瑞 -test -config=/etc/v2瑞/config.json
复制代码 启动v2瑞
设置一下Windows的系统代理为光猫IP以及v2瑞配置里的1082端口,即可愉快使用v2瑞。
不喜欢使用系统代理的可以用浏览器代理。
谷歌浏览器的扩展程序SwitchyOmega里面导入一个新情景模式
这里提供一个已经做好的
- https://github.com/FelisCatus/SwitchyOmega/wiki/GFWList.bak
复制代码 然后修改一下SwitchyOmega的GFWed代理服务器为光猫的ip以及v2瑞配置里的1081端口。
再选一下SwitchyOmega为自动切换,到此完成。
想实现透明代理可用如下iptables命令
小白新手不建议使用,小白新手不建议使用,小白新手不建议使用。
输错命令会登陆不了光猫,只能拔电重启光猫。
- /sbin/iptables -t nat -N V2RAY
- /sbin/iptables -t nat -A V2RAY -d 192.168.0.0/16 -j RETURN
- /sbin/iptables -t nat -A V2RAY -p tcp -j RETURN -m mark --mark 0xff
- /sbin/iptables -t nat -A V2RAY -p tcp -j REDIRECT --to-ports 1080
- /sbin/iptables -t nat -A PREROUTING -p tcp -j V2RAY
复制代码
|
评分
-
查看全部评分
|