找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 4428|回复: 8

freshtomato做主路由配合op或linux,国内外分流

[复制链接]
本帖最后由 tr069 于 2021-9-5 17:55 编辑

之前totolink a3004ns刷了rb750gr3,卖了原版rb750gr3。

今天totolink也卖了,翻出linksys ea6200先顶上。

六七年的东西了,还是可以的,PT下载,40M/s,cpu占用46%,比7621弱一点。

顺便记录一下,配合op或linux,进行国内外流量分流。

开启硬件加速


pppoe拨号


设置dns


我们假定你的op或linux是可以防止dns污染的,如果不能,请设法使能。
  1. server=/#/192.168.1.x
复制代码
192.168.1.x请替换为你的op或linux 的ip地址。

流量分流
我们假定你的op或linux是可以出国的,如果不能,请使能。

下载附件中国IP.zip,解压,得到chn.set和chn6.set,放入u盘,u盘插入路由。没有usb接口的可以用jffs,如何使用jffs,自行google一下。

设定开机脚本



  1. modprobe xt_set
  2. modprobe ip_set
  3. modprobe ip_set_hash_ip
  4. modprobe ip_set_hash_net
复制代码
加载4个内核模块

防火墙分流规则


  1. ipset restore -f /tmp/mnt/DNS/chn.set
  2. ip rule add fwmark 1 table 100
  3. ip route add default via 192.168.1.x table 100
  4. iptables -t mangle -A PREROUTING -d xxxxxx -j RETURN
  5. iptables -t mangle -A PREROUTING -m mac --mac-source xxxxxxxx -j RETURN
  6. iptables -t mangle -A PREROUTING -m mac --mac-source xxxxxxxx -j RETURN
  7. iptables -t mangle -A PREROUTING -m set ! --match-set chnroutes dst  -j MARK --set-mark 1
  8. iptables -t mangle -A OUTPUT -m set ! --match-set chnroutes dst  -j MARK --set-mark 1
  9. ipset restore -f /tmp/mnt/DNS/chn6.set
  10. ip -6 rule add fwmark 0x6666 table 666
  11. ip -6 route add table 666 default via xxxxxxxxxx dev br0
  12. ip6tables -t mangle -A PREROUTING -m mac --mac-source xxxxxxx -j RETURN
  13. ip6tables -t mangle -A PREROUTING -m mac --mac-source xxxxxxxxx -j RETURN
  14. ip6tables -t mangle -A PREROUTING -m set ! --match-set chnroutes6 dst -j MARK --set-mark 0x6666
复制代码


解释
ipset restore -f /tmp/mnt/sda1/chn.set 导入中国ipv4 注意路径替换为你的
ip rule add fwmark 1 table 100 标记1的流量走路由表100
ip route add default via 192.168.1.x table 100 路由表100的下一跳是192.168.1.x,这是op或linux的ip地址
iptables -t mangle -A PREROUTING -d xxxxxx -j RETURN xxxxxx替换为vpsip,意思目的ip为vps的流量忽略
iptables -t mangle -A PREROUTING -m mac --mac-source xxxxxxxx -j RETURN  xxxxxx替换为op或linux mac地址,如果有多台设置,请再加一条。
iptables -t mangle -A PREROUTING -m set ! --match-set chnroutes dst  -j MARK --set-mark 1 来自局域网内的目的ip不是中国ip的流量打上标记1
iptables -t mangle -A OUTPUT -m set ! --match-set chnroutes dst  -j MARK --set-mark 1 本机发出的目的ip不是中国ip的流量打上标记1
以上打上标记1的流量不再从主路由直接出去,它们将去往op或linux,由op或linux封装百隧道再出国。

ipset restore -f /tmp/mnt/sda1/chn6.set 导入中国ipv6 注意路径替换为你的
ip -6 rule add fwmark 0x6666 table 666 标记0x6666的流量走路由表666
ip -6 route add table 666 default via xxxxxxxxxx dev br0 xxxxxxxxxxx替换为op或linux的ipv6地址,是fe80::打头的,不是公网ip,并且一定要加上dev br0,不加的话不通
ip6tables -t mangle -A PREROUTING -m mac --mac-source xxxxxxx -j RETURN xxxxx替换为op或linux mac地址,如果有多台设置,请再加一条。
ip6tables -t mangle -A PREROUTING -m set ! --match-set chnroutes6 dst -j MARK --set-mark 0x6666 来自局域网内的目的ip不是中国ip的流量打上标记0x6666
ip6tables -t mangle -A OUTPUT -m set ! --match-set chnroutes6 dst -j MARK --set-mark 0x6666 本机发出的目的ip不是中国ip的流量打上标记0x6666
以上打上标记0x6666的流量不再从主路由直接出去,它们将去往op或linux,由op或linux封装百隧道再出国。

设置完毕了。重启一下就OK了。

你不用进行本论坛里很常见的各种旁路由旁路网关操作。
不需要在主路由上装任何梯&子。
主路由不需要很强大的心脏。
你手机或电视或电脑发出去的流量,国内的流量,自动从主路由出去,国外的流量,它们不过主路由,自动去往op或linux,由op或linux进行隧道封装,最后出国。






本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×

评分

参与人数 3恩山币 +4 收起 理由
yt*** + 1 强大的恩山!(以下重复1万次)
5614*** + 1 强大的恩山!(以下重复1万次)
Ma*** + 2 强大的恩山!(以下重复1万次)

查看全部评分

我的恩山、我的无线 The best wifi forum is right here.
BCM47081单核心,性能肯定不如双核心的7621
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

我是用 Tomato+N1x2,上面跑 iptables ---> xray(ipt2socks) ---> haproxy ---> N1x2 做自动分流、负载均衡、自动切换、故障隔离,两台 N1 跑 2x2 的线路加密。。。

点评

哥你是怎么设置的啊,我也想用你这个设置。  详情 回复 发表于 2021-9-23 18:36
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

不错不错,旧物利用这个路由器看起来还有玩头。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

多谢分享!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

本帖最后由 网际飞扬 于 2021-9-23 18:48 编辑

你这个规则很好,能解决电脑没有WIFI打倒美帝问题,但是当旁路由去掉(也就是坏了),主路由也不能上网,只有注销掉这个才行。server=/#/192.168.1.x怎么才能去掉旁路由能正常上网呢?

点评

下载https://cokebar.github.io/gfwlist2dnsmasq/dnsmasq_gfwlist.conf 把127.0.0.1#5353改为你的旁路网关ip 把文件拷贝到优盘里,比如/tmp/sda1/dnsmasq.d下 然后一楼设置dns那一步,改为下面两行 conf-dir=/tm  详情 回复 发表于 2021-9-23 20:03
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

jingleeboy 发表于 2021-9-8 21:19
我是用 Tomato+N1x2,上面跑 iptables ---> xray(ipt2socks) ---> haproxy ---> N1x2 做自动分流、负载均 ...

哥你是怎么设置的啊,我也想用你这个设置。

点评

xray haproxy  详情 回复 发表于 2021-9-26 14:42
xray配置: { "log": { "loglevel": "warning" }, "inbounds": [ { "protocol": "dokodemo-door", "port": 1888, "settings": { "network": "tcp,udp",  详情 回复 发表于 2021-9-24 02:02
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

网际飞扬 发表于 2021-9-23 18:36
哥你是怎么设置的啊,我也想用你这个设置。

xray
  1. {
  2.   "log": {
  3.     "loglevel": "warning"
  4.   },
  5.   "inbounds": [
  6.     {
  7.       "protocol": "dokodemo-door",
  8.       "port": 1888,
  9.       "settings": {
  10.         "network": "tcp,udp",
  11.         "followRedirect": true
  12.       }
  13.     }
  14.   ],
  15.   "outbounds": [
  16.     {
  17.       "tag": "socks",
  18.       "protocol": "socks",
  19.       "settings": {
  20.         "servers": [
  21.           {
  22.             "address": "127.0.0.1",
  23.             "port": 1088
  24.           }
  25.         ]
  26.       }
  27.     }
  28.   ]
  29. }
复制代码


haproxy
  1. global
  2.         maxconn 32000
  3.         ulimit-n 65535

  4. defaults
  5.         mode    tcp
  6.         log     global
  7.         option  dontlognull
  8.         timeout connect 5000
  9.         timeout client  50000
  10.         timeout server  50000

  11. listen  haproxy_stats
  12.         bind    *:8888
  13.         mode    http
  14.         stats   refresh 30s
  15.         stats   uri     /haproxy
  16.         stats   realm   Haproxy
  17.         stats   auth    admin:admin
  18.         stats   admin   if TRUE

  19. listen  xray
  20.         bind    *:1088
  21.         server  server1 192.168.x.1:1088 check
  22.         server  server2 192.168.x.2:1088 check
复制代码

点评

这个真的好啊  详情 回复 发表于 2021-9-26 16:11
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报


这个真的好啊
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-27 14:04

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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

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