找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 2175|回复: 21

[Router OS] RouterOS ospf V2 rayA 分流

[复制链接]
本帖最后由 IRDETO 于 2024-1-25 18:42 编辑

#RouterOS设置,复制粘贴到Terminal回车即可,注意我内网ros的ip为10.10.10.1 ,跑隧道的网关ip为10.10.10.254,请自行对应修改 自己的内网ip
  1. /routing ospf instance
  2. add disabled=no name=bird version=2 router-id=10.10.10.1 routing-table=main
  3. add disabled=no name=bird-ipv6 version=3 router-id=10.10.10.1 routing-table=main

  4. /routing ospf area
  5. add disabled=no instance=bird name=bird
  6. add disabled=no instance=bird-ipv6 name=bird-ipv6

  7. /routing ospf interface-template
  8. add area=bird  interfaces=LAN type=broadcast
  9. add area=bird-ipv6  interfaces=LAN type=broadcast
复制代码

Debian端相关配置
1.安装v2,执行
  1. sh v2_install.sh
复制代码


2.安装bird2.执行
  1. sh bird_install.sh
复制代码



3.拉取python脚本
  1. git clone https://github.com/dndx/nchnroutes
  2. cd nchnroutes
  3. nano Makefile
复制代码
编辑Makefile
  1. produce:
  2.         git pull
  3.         curl -o delegated-apnic-latest https://ftp.apnic.net/stats/apnic/delegated-apnic-latest
  4.         curl -o china_ip_list.txt https://raw.githubusercontent.com/17mon/china_ip_list/master/china_ip_list.txt
  5.         python3 produce.py --exclude 1.1.1.1 这里一定要排除你海淘服务器的ip,拿4个1做师范,多个的话用空格隔开
  6.          sudo mv routes4.conf /etc/bird/routes4.conf
  7.          sudo mv routes6.conf /etc/bird/routes6.conf
  8.          sudo birdc configure
复制代码
修改produce.py里的ens3为你网卡的名字,注意双引号要保留
  1. parser.add_argument('--next', default="ens3", metavar = "INTERFACE OR IP",  
复制代码


接着执行make,有报错不用管他
  1. make
复制代码
最后重启bird
  1. systemctl restat bird
复制代码
检查birde状态和我的一样
  1. systemctl status bird
复制代码
  1. root@debian:/etc/bird# systemctl status bird
  2. * bird.service - BIRD Internet Routing Daemon
  3.      Loaded: loaded (/lib/systemd/system/bird.service; enabled; preset: enabled)
  4.      Active: active (running) since Thu 2024-01-25 16:33:28 CST; 25min ago
  5.     Process: 1053 ExecStartPre=/usr/lib/bird/prepare-environment (code=exited, status=0/SUCCESS)
  6.     Process: 1060 ExecStartPre=/usr/sbin/bird -p (code=exited, status=0/SUCCESS)
  7.    Main PID: 1061 (bird)
  8.       Tasks: 1 (limit: 4641)
  9.      Memory: 28.2M
  10.         CPU: 3.606s
  11.      CGroup: /system.slice/bird.service
  12.              `-1061 /usr/sbin/bird -f -u bird -g bird

  13. Jan 25 16:33:28 debian systemd[1]: Starting bird.service - BIRD Internet Routing Daemon...
  14. Jan 25 16:33:28 debian systemd[1]: Started bird.service - BIRD Internet Routing Daemon.
  15. Jan 25 16:33:28 debian bird[1061]: Started
  16. Jan 25 16:33:28 debian bird[1061]: Kernel dropped some netlink messages, will resync on next scan.
复制代码

完活!
最后把你电脑的网关dns全部指向RouterOS即可



本帖子中包含更多资源

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

×
我是用ros和v2做的vrrp
回复

使用道具 举报

 楼主| | 显示全部楼层
linuxunion 发表于 2024-1-25 22:53
我是用ros和v2做的vrrp

你说的是  负载均衡?
回复

使用道具 举报

IRDETO 发表于 2024-1-26 12:42
你说的是  负载均衡?

网关冗余。。。。。。
回复

使用道具 举报

思考一下,思考
回复

使用道具 举报

这个实用,顶。
回复

使用道具 举报

请教一下大佬,254不是science的网关嘛,routelist里面,国内的ip地址的gateway都指向science网关是为啥?
回复

使用道具 举报

 楼主| | 显示全部楼层
kissinger1220 发表于 2024-2-23 10:37
请教一下大佬,254不是science的网关嘛,routelist里面,国内的ip地址的gateway都指向science网关是为啥? ...

那是排除国内国内的ip地址的  有个!
回复

使用道具 举报

IRDETO 发表于 2024-2-24 01:42
那是排除国内国内的ip地址的  有个!

明白 多谢大佬!!!
回复

使用道具 举报

感谢大佬 按照你方法 成功了 不过现在有一问题 就是wechat走国外一直转圈 很慢 怎么才能让它直连
回复

使用道具 举报

大佬,请问一键脚本里:
请输入新的 Router ID [默认为网卡的IPv4地址 192.168.5.3]: 这个写什么,旁路有的地址吗,
还有
请输入新的 Interface [默认为 ens192]:
这个是旁路有的网卡吗

回复

使用道具 举报

 楼主| | 显示全部楼层
lizhongwen 发表于 2024-3-3 19:39
感谢大佬 按照你方法 成功了 不过现在有一问题 就是wechat走国外一直转圈 很慢 怎么才能让它直连 ...

ros上已经ip分流了 微信怎么还能走到旁路?
回复

使用道具 举报

 楼主| | 显示全部楼层
KKNI 发表于 2024-3-17 19:15
大佬,请问一键脚本里:
请输入新的 Router ID [默认为网卡的IPv4地址 192.168.5.3]: 这个写什么,旁路有 ...

大佬,请问一键脚本里:
请输入新的 Router ID [默认为网卡的IPv4地址 192.168.5.3]: 这个写什么,旁路有的地址吗,----是
还有
请输入新的 Interface [默认为 ens192]:
这个是旁路有的网卡吗---这个一般是自动判别应该是输入旁路的网卡名称
回复

使用道具 举报

  1. log syslog all;

  2. router id 10.10.10.11;

  3. protocol device {
  4.         scan time 60;
  5. }

  6. protocol kernel {
  7.         ipv4 {
  8.               import none;
  9.               export all;
  10.         };
  11. }
  12. protocol kernel {
  13.         ipv6 {
  14.               import none;
  15.               export all;
  16.         };
  17. }

  18. protocol static {
  19.         ipv4;
  20.         include "routes4.conf";
  21. }
  22. protocol static {
  23.         ipv6;
  24.         include "routes6.conf";
  25. }

  26. protocol ospf v2 {
  27.     ecmp no;
  28.         ipv4 {
  29.                 export all;
  30.         };
  31.         area 0.0.0.0 {
  32.                 interface "*" {
  33.                         type broadcast;
  34.                 };
  35.         };
  36. }

  37. protocol ospf v3 {
  38.     ecmp no;
  39.         ipv6 {
  40.                 export all;
  41.         };
  42.         area 0.0.0.0 {
  43.                 interface "*" {
  44.                         type broadcast;
  45.                 };
  46.         };
  47. }
复制代码



  1. root@debian:~/nchnroutes# systemctl status bird.service
  2. ● bird.service - BIRD Internet Routing Daemon
  3.      Loaded: loaded (/lib/systemd/system/bird.service; enabled; preset: enabled)
  4.      Active: active (running) since Sun 2024-04-14 14:34:03 CST; 14s ago
  5.     Process: 92518 ExecStartPre=/usr/lib/bird/prepare-environment (code=exited, status=0/SUCCESS)
  6.     Process: 92524 ExecStartPre=/usr/sbin/bird -p (code=exited, status=0/SUCCESS)
  7.    Main PID: 92526 (bird)
  8.       Tasks: 1 (limit: 2234)
  9.      Memory: 24.6M
  10.         CPU: 565ms
  11.      CGroup: /system.slice/bird.service
  12.              └─92526 /usr/sbin/bird -f -u root -g root

  13. 4月 14 14:34:03 debian systemd[1]: Starting bird.service - BIRD Internet Routing Daemon...
  14. 4月 14 14:34:03 debian systemd[1]: Started bird.service - BIRD Internet Routing Daemon.
  15. 4月 14 14:34:03 debian bird[92526]: Started
  16. 4月 14 14:34:03 debian bird[92526]: Kernel dropped some netlink messages, will resync on next scan.
复制代码











请问我按照教程来的,怎么最后状态始终是init?

本帖子中包含更多资源

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

×
回复

使用道具 举报

ospf 高大上 谢谢教程
回复

使用道具 举报

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

本版积分规则

关闭

欢迎大家光临恩山无线论坛上一条 /1 下一条

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

GMT+8, 2024-5-14 17:36

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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

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