多条线路使用routeros路由设置

合集下载

ROS多线路自动策略路由切

ROS多线路自动策略路由切

ROS多线路自动策略路由切2.9.X 电信+网通+ 1条ADSL 多线路自动策略路由切换+备份第一ip设好/ ip addressadd address=192.168.1.1/24 network=192.168.1.0 broadcast=192.168.1.255 \interface=lan comment="" disabled=noadd address=电信地址/掩码network=自动设置broadcast=自动设置interface=TEL comment="" disabled=noadd address=网通地址/掩码network=自动设置broadcast=自动设置interface=CNC comment="" disabled=no这里如果你有PPPOE的ADSL 也可以+上ADSL记住要改MSS/ ip firewall mangleadd chain=forward out-interface=pppoe-out1 protocol=tcp tcp-flags=syn \action=change-mss new-mss=1400 comment="" disabled=no/ ip firewall natadd chain=srcnat src-address=192.168.1.0/24 action=masquerade comment="" \ disabled=no--------------------------------------------------------------------------------------------------第2步添加网通的路由网关电信的服务器在网络中占了绝大多数所以不需要考虑电信的服务器/ ip routeadd dst-address=59.80.0.0/14 gateway=网通网关check-gateway=ping \distance=0 scope=255 target-scope=10 comment="CNC" disabled=noadd dst-address=60.0.0.0/13 gateway=网通网关check-gateway=ping \distance=0 scope=255 target-scope=10 comment="CNC" disabled=noadd dst-address=60.8.0.0/15 gateway=网通网关check-gateway=ping \distance=0 scope=255 target-scope=10 comment="CNC" disabled=noadd dst-address=60.10.0.0/16 gateway=网通网关check-gateway=ping \distance=0 scope=255 target-scope=10 comment="CNC" disabled=noadd dst-address=60.12.0.0/16 gateway=网通网关check-gateway=ping \distance=0 scope=255 target-scope=10 comment="CNC" disabled=noadd dst-address=60.13.0.0/18 gateway=网通网关check-gateway=ping \distance=0 scope=255 target-scope=10 comment="CNC" disabled=noadd dst-address=60.13.128.0/17 gateway=网通网关check-gateway=ping \distance=0 scope=255 target-scope=10 comment="CNC" disabled=noadd dst-address=60.16.0.0/12 gateway=网通网关check-gateway=ping \distance=0 scope=255 target-scope=10 comment="CNC" disabled=noadd dst-address=60.55.0.0/16 gateway=网通网关check-gateway=ping \add dst-address=60.208.0.0/13 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=60.216.0.0/15 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=60.220.0.0/14 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.4.79.0/24 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.4.64.0/20 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=noadd dst-address=61.48.0.0/13 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.128.210.0/24 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.133.0.0/17 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.134.98.0/24 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.134.108.0/22 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.134.120.0/28 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.134.112.0/20 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.134.96.0/19 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.134.128.0/17 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.135.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.136.64.0/18 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.137.128.0/17 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.138.128.0/18 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.139.128.0/18 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.148.0.0/15 gateway=网通网关check-gateway=ping \add dst-address=61.156.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.158.128.0/17 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.159.0.0/18 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.161.0.0/18 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.161.128.0/17 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.167.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=noadd dst-address=61.168.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.176.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.179.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.180.13.0/24 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.180.128.0/17 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.181.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.182.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.189.0.0/17 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.233.7.0/24 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.233.59.0/24 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=61.237.148.0/24 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=202.95.98.0/24 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=202.96.0.0/18 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=202.96.66.0/24 gateway=网通网关check-gateway=ping \add dst-address=202.96.64.0/19 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=202.97.128.0/17 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=202.98.0.0/19 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=202.99.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=202.102.128.0/18 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=202.102.224.0/19 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=202.106.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=noadd dst-address=202.107.0.0/17 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=202.108.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=202.110.0.0/17 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=202.110.192.0/18 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=202.111.128.0/18 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=203.88.200.0/24 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=203.88.203.0/24 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=211.95.192.0/18 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=211.97.245.0/24 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=211.148.8.0/24 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=211.151.130.0/24 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=211.158.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=211.163.0.0/16 gateway=网通网关check-gateway=ping \add dst-address=218.7.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=218.8.0.0/14 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=218.12.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=218.24.0.0/14 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=218.28.0.0/15 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=218.56.0.0/14 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=218.60.0.0/15 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=218.62.0.0/17 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=noadd dst-address=218.67.128.0/17 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=218.68.0.0/15 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=218.104.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=218.106.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=218.107.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=218.108.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=218.109.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=219.154.0.0/15 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=219.156.0.0/15 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=219.158.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=219.159.0.0/18 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=220.248.0.0/15 gateway=网通网关check-gateway=ping \add dst-address=220.250.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.0.0.0/14 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.4.0.0/15 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.6.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.7.0.0/18 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.7.64.0/19 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.7.128.0/17 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.8.0.0/15 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.10.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=noadd dst-address=221.11.0.0/17 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.11.128.0/18 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.11.192.0/19 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.12.0.0/17 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.12.128.0/18 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.13.0.0/18 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.13.64.0/19 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.14.0.0/15 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.136.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.192.0.0/14 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.196.0.0/15 gateway=网通网关check-gateway=ping \add dst-address=221.198.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.199.0.0/19 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.199.32.0/20 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.199.128.0/18 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.199.192.0/20 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.200.0.0/14 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.204.0.0/15 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.207.0.0/18 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.208.0.0/14 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.212.0.0/15 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=noadd dst-address=221.214.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=221.216.0.0/13 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=222.128.0.0/12 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=222.160.0.0/15 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=222.162.0.0/16 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=222.163.0.0/19 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=222.173.101.0/24 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=222.173.102.0/23 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=222.173.104.0/22 gateway=网通网关check-gateway=ping \ distance=0 scope=255 target-scope=10 comment="CNC" disabled=no add dst-address=222.173.108.0/23 gateway=网通网关check-gateway=ping \add dst-address=222.208.65.0/24 gateway=网通网关check-gateway=ping \distance=0 scope=255 target-scope=10 comment="CNC" disabled=noadd dst-address=0.0.0.0/0 gateway=222.218.157.97 check-gateway=ping distance=0 \scope=255 target-scope=10 comment="TEL" disabled=no(最后这条的意义就是保证在上面找不到网通的网关后IP包自动走电信的线路如果想拷贝这个规则就用替换功能换上具体的IP就可以了)-------------------------------------------------------------------------------------------------------第3步设置好监控的开关/ tool netwatchadd host=电信网关timeout=1s interval=1m up-script=dxup \down-script=dxdown comment="TEL" disabled=noadd host=网通网关timeout=1s interval=1m up-script=CNCup \down-script=CNCdown comment="CNC" disabled=no--------------------------------------------------------------------------------------------------------第四写好脚本自动切换/ system scriptadd name="dxup" source="/ip route set \[/ip route find comment=TEL\] gateway \ 电信网关\n" policy=ftp,reboot,read,write,policy,test,winbox,passwordadd name="CNCup" source="/ip route set \[/ip route find comment=CNC\] gateway \网通网关\n" policy=ftp,reboot,read,write,policy,test,winbox,passwordadd name="dxdown" source=":if \(\[/tool netwatch get \[/tool netwatch find \ comment=CNC\] status\]=\"down\"\) do {/ip route set \[/ip route find \comment=TEL\] gateway \[/ip address get \[/ip address find \interface=pppoe-out1\] network\]} else {/ip route set \[/ip route find \comment=TEL\] gateway 网通网关}" \policy=ftp,reboot,read,write,policy,test,winbox,passwordadd name="CNCdown" source=":if \(\[/tool netwatch get \[/tool netwatch find \ comment=TEL\] status\]=\"down\"\) do {/ip route set \[/ip route find \comment=CNC\] gateway \[/ip address get \[/ip address find \interface=pppoe-out1\] network\]} else {/ip route set \[/ip route find \comment=CNC\] gateway 电信网关}" \policy=ftp,reboot,read,write,policy,test,winbox,password。

routeros电信+网通双线策略过程

routeros电信+网通双线策略过程

2023 routeros电信+网通双线策略过程CATALOGUE目录•介绍•routeros双线设置•routeros高级设置•常见问题及解决方案•结论01介绍•在当今互联网时代,网络已经成为人们生活和工作中必不可少的部分。

然而,由于网络资源的有限性,不同地区的网络用户常常面临着网络速度慢、网络掉线等问题。

为了解决这些问题,许多网络用户开始采用双线策略,即同时使用两个不同的网络线路来提高网络性能和稳定性,而ROS(RouterOS)就是一种常用的双线策略实现方式。

背景•双线策略的主要目的是提高网络性能和稳定性。

通过同时使用两个不同的网络线路,用户可以获得更大的带宽和更快的网速,同时还可以避免单线路故障导致的网络中断。

此外,双线策略还可以提高网络的容错能力,使得网络更加可靠和稳定。

目的任务确定两个不同的网络线路的接入方式,包括PPPoE、静态IP等;配置路由表,指定数据包优先级和路由路径;监控网络线路的运行状态,及时处理故障和异常情况。

双线策略的实现需要完成以下任务设置两个网络接口的IP地址、网关等参数;设置防火墙规则,确保网络安全和稳定性;01020304050602 routeros双线设置选择支持双线路接入的路由器,具备WAN口和LAN口。

路由器选择将电信线路和网通线路分别接入路由器的WAN口,将电脑等设备连接到路由器的LAN口。

网线连接硬件设置1软件设置23在浏览器中输入路由器的IP地址,登录到路由器管理界面。

登录路由器管理界面在路由器管理界面中,找到并点击“上网设置”或“网络设置”等类似选项。

导航至“上网设置”在“上网设置”中,分别添加电信线路和网通线路的信息,包括运营商分配的IP地址、子网掩码、网关等信息。

添加线路信息03保存设置保存所做的所有设置,使路由器开始正常工作。

网络接口配置01配置WAN口在路由器管理界面中,找到并点击“网络接口”或类似选项,配置WAN口,选择双线路自动切换或负载均衡等模式。

【RouterOS】ADSL多线详解,无脚本更新IP,无脚本断线自动切换

【RouterOS】ADSL多线详解,无脚本更新IP,无脚本断线自动切换

【RouterOS】ADSL多线详解,无脚本更新IP,无脚本断线自动切换前言:当你手里面有多条ADSL的时候,你会如何去利用他们呢?同时,怎么最大化利用他们呢?今天我们就来说说这个话题。

说到多线策略,就需要提及到两个概念,一个是负载均衡一个是带宽叠加。

就我个人理解,负载均衡是在多个人用有限的几条线时,如何使这几条线的利用率都最大化。

比如我有A、B、C、D四条线,在做负载均衡以前,可能A、B是满负荷工作,而C、D是空的;做了负载均衡以后,A、B、C、D都有流量,而不会出现一个压的喘不过气,一个没事做的情况了。

带宽叠加是在一个人用多条线的时候,能将多条线的带宽加起来,从而达到提高下载速度或减少网页打开的时间。

在ROS中,以该路由器为中心,可以分为上下两部分,下面一部分是内网限速(最典型的就是DSCP Over HTB),这里不做讨论,如有需要以后分析;另一部分就是ADSL向上的那一部分,下面我就以ADSL这部分的NTH均衡来做下实例,希望抛砖引玉,希望更好的策略能够提供给有需要的读者。

在设置ADSL多线的时候,你将可能会遇到以下问题:1、你可能没有四张网卡,需要用到Vlan交换机;这个需要你的交换机支持802.1Q,所需要拨号的四个交换机端口(也就是连着四个ADSL猫的端口)都设置成access模式,vlanID分别是10、20、30、40(当然,其他的数字也可以)。

连接RouterOS外线网卡的端口设置成trunk模式,并且允许以上vlan通过,在routeros 的wan口建立4个vlan,vlanID分别为10、20、30、40(需要与交换机上的对应),这样就保证的了多个猫之间不会互相干扰,但是都可以和routeros上的虚拟vlan接口通讯。

1./interface vlan2.add arp=enabled disabled=no interface=wan mtu=1500 name=vlan10vlan-id=103.add arp=enabled disabled=no interface=wan mtu=1500 name=vlan20vlan-id=204.add arp=enabled disabled=no interface=wan mtu=1500 name=vlan30vlan-id=305.add arp=enabled disabled=no interface=wan mtu=1500 name=vlan40vlan-id=40复制代码2、ADSL无法拨上号,因为用来拨号的mac都一样;如果你的vlan都是附着在wan口上面的,因此所有vlan虚拟接口的MAC地址都是同一个,因此电信局端检测到两个相同的mac在尝试用两个不同的账号同时拨号的时候就会断掉其中一个,这也是为什么有的无法同时拨号的原因。

ROS多线路由策略原理详解

ROS多线路由策略原理详解

以下为命令行模式下的配置:
/ ip firewall nat
add chain=srcnat connection-mark=1 action=src-nat to-addresses=116.21.32.241
to-ports=0-65535
add chain=srcnat connection-mark=2 action=src-nat to-addresses=121.32.177.37
add chain=prerouting in-interface=Local connection-mark=1 action=mark-routing
new-routing-mark=1 passthrough=no
/ ip firewall mangle
add chain=prerouting in-interface=Local connection-state=new nth=1,1,1
/ ip route
add dst-address=0.0.0.0/0 gateway=121.32.177.37 scope=255 target-scope=10
第六步填加防掉线脚步:脚本是ROS官方提供的,虽然短短几行代码,但具体是怎样的工作原理我也实在没弄通,不过好在脚本是通用的,将脚本设置成自动运行就可以了,以下是配置图:
至此,所有配置工作完成,由于ROS基础配置过程较多,所以在这里只针对ADSL配置和负载平衡进行了详细的介绍,由于实际当中配置多条ADSL多为重复过程,所以在这里只以两条线为例,如果配置多条ADSL来实现叠加网速,还要注意一些细节,可以说按照以上流程,再详细掌握了以下细节后就可以应用自如了。
以下为命令行模式下的配置: / ip route

routeros双线配置

routeros双线配置

dst-address=外网地址/32:80 to-dst-address=内网ip地址
^
这里是你要映射的端口,如果全部就不要添
例子1:将外网所有80端口的请求都指向到168上
ip firewall dst-nat> add action=nat protocol=tcp
dst-address=319.23.23.23/32:80 to-dst-address=192.168.0.168
routeros双线配置
1。用光盘版全选安装 (软盘版要另外下插件)
注意注册码都用大写
先插上一块网卡以便定下他作为连接内网的网卡
2。使用 admin用户登陆, 密码为空
3。设置第一块网卡的ip
输入setup,提示你设置ether1(第一块网卡连接内网),输入ip地址(192.168.0.1)子网掩码(255.255.255.0) gateway:192.168.0.254一路回车即可。
dst.port勾上填入134-139
action
在action里选drop丢弃包或reject拒绝包
ok完成
再选forward和output照上面设完,这样不论是外网的机器或内网的机器中毒都不会影响其他用户了。
其实ip filter rules可设很多规则可以作一个非常不错的防火墙不过要注意input,forward,output根据不同情况的设置
例子2:完全开放192.168.0.168
ip firewall dst-nat> add action=nat protocol=tcp
dst-address=319.23.23.23/32 to-dst-address=192.168.0.168

RouterOS多线部署

RouterOS多线部署

功能特点
隧道协议(PPP、PPPoE、PPTP、EoIP、IPIP以 及IPsec ) Hotspot热点认证服务 脚本控制 RouterOS提供了可以编写的脚本功能,脚本的加入 使RouterOS在处理很多网络方案、自动检查故障和 动态生成策略等,都可以通过脚本很好的解决。使 得在处理很多网络问题上更加的灵活和智能化。
实例讲解
多线策略路由配置 多线负载均衡配置[NTH] 多线负载均衡配置[PCC] 带宽控制实例:PCQ+HTB
双线接入配置
策略路由(电信网通双线)
策略路由(电信网通双线)
为了便于区分,先把两个WAN口重新命名一 下
策略路由(电信网通双线)
分别添加电信与网通端口的ip地址
策略路由(电信网通双线)
基于NTH的负载均衡
配置ip伪装(srcnat)
ip firewall nat>add chain=srcnat action=src-nat connection-mark=first toaddresses=222.240.101.6 to-ports=0-65535 ip firewall nat>add chain=srcnat action=src-nat connection-mark=second to-addresses=222.240.102.6 to-ports=0-65535
Interface 命令系列
进入interface命令接口(/interface) 显示接口信息(print)
启动接口(enable 接口号)
Ip address命令系列
给接口添加一个IP地址
/ip address add address IP地址/掩码 interface 接口名 在配置IP 地址中,配置‘address’和‘netmask’参数时,在许多事例中你 可以将IP 地址和子网掩码一起定义,也可以将子网掩码单独定义,以下几 种方式是相同的 1.>/ip address ip address>add address 192.168.151.111/24 interface ether1 2.>/ip address add address 192.168.151.111/24 interface ether1 3.>/ip address add address 192.168.151.111 netmask 255.255.255.0 interface ether1

RouterOS外网三线进行IP分流上网

RouterOS外网三线进行IP分流上网-模拟环境需求:1、因环境限制,三条外网ISP使用模拟;使用192.168.1.0/24模拟电信PPPOE出外网使用192.168.2.0/24模拟移动PPPOE出外网使用192.168.3.0/24模拟联通PPPOE出外网2、通过指定内网某些IP某些网段走电信,某些走移动,某些走联通实现分流负载;拓扑:R osuterOS配置注意:1、当有多条线路进行NAT伪装时,Out. Interface这个必须选择具体的网卡,不能默认只用一个,不然会出现偶尔断线的情况。

2、指定某些IP走电信的原理是通过在防火墙的Mangle打标签,然后再路由表上匹配标签,但此时需要特别注意,只要打了标签之后,在路由表默认留空的标记不会匹配打了标记的,这一点不要以为留空就会在没有匹配到标记会走默认的。

配置CCR1009-7G-1C-1S+PC(1)修改接口标识;(2)配置三条ISP接口ip及LAN内网ip地址;(3)配置LAN内网DHCP地址池;记得配置DNS:114.114.114.114或者所在运营商的DNS;配置好的截图:(4)配置路由;配置三条默认路由,各自标记下出口的运营商;(5)配置NAT,IP->firewall->NAT三个出口设置一遍;(6)做防火墙的M angle,以电信出口为例,其他类似;Src. Address可以试固定IP、整个IP段192.168.102.0/24,或者IP范围192.168.102.2-192.168.102.10,但不可以某几个不连续的IP配置好的截图;(7)测试;电脑接到4口,收到配置静态ip地址;配置ip地址为:10.0.0.10设置走电信的;使用路由跟踪下;配置ip地址为:10.0.0.110设置走移动的;配置ip地址为:10.0.0.254设置走联通的;至此配置完毕,实现分流负载;。

ROS 多线路路由


多线路复合应用
某网吧有5M电信光纤一条,5M网通光纤一条,5条 4MADSL,内部主机120台。 简单网络结构
结合网页数据上传小,下行比较大的特点,让网页数据负载均衡走ADSL 线路,然后导入网通路由表,让网通数据走网通光纤,默认路由走电信 光纤
接口配置
IP配置
80端口分流路由标记
:for i from=1 to=5 do= {/ip firewall mangle add chain=prerouting in-interface=ether3-lan\ protocol=tcp dst-port=80 per-connection-classifier=("bot"both-addresses:5/".($i-1)) \ dst-address-type=!local action=mark-connection new-connection-mark=("web-conn".$i);\ /ip firewall mangle add chain=prerouting in-interface=ether3-lan protocol=tcp \ dst-port=80 connection-mark=("web-conn".$i) action=mark-routing\ new-routing-mting-mark=("web-rout".$i)}
导入之后可以在ip rout rule目录下面看到路由表信息
最后添加一条网关为电信,routing-mark为路由表标记Tlecom的路由
同ISP多线路
对于同类型ISP线路,将数据按带宽比例进行划分,让相应比例的数据 走相应线路。 如下示例,我们将内网的访问连接按连接的源地址和目标地址分组 (PCC)为3份,其中1/3走电信1,其余2/3走电信2。

ros软路由实用技术ros软路由adsl双线 pppoe服务器设置(图文讲解)

ros软路由ADSL双线+PPPOE服务器设置详细图文教程减小字体增大字体一、先说下这几天泡论坛发现在自己以前及其错误的地方登录winbox 初始化ros以前都是把显示器键盘接到ros上,配置lan网卡地址后再将显示器键盘接到电脑上,把电脑本地连接配ros网段,连接winbox,等测试自动获取ip时又将本地连接设为自动获取。

需要回复ros为初始时,又重复上面的过程泡坛才知道,winbox可以用ros lan网卡的mac地址登录,不必管本地连接的ip的。

初始化时在winbox里使用new terminal就可以初始化了,初始了后用mac登录winbox就可以配置了。

总结:把ros的电脑先设BIOS设为来电自动开机,忽略一切错误开机,就可以再也不接键盘和显示器了。

二、配置ros 双ADSl负载均衡走的弯路因为夹杂了pppoe服务,一直配不通,用脚本生成器生成的也不通,看很多教程,互相影响,自己最后也不知道在配什么了。

总结:先一步一步配,看到哪一步不通。

不如1、先配好lan,看winbox能否登陆winbox2、配置双线adsl,看2条adsl是否拨号成功,双线adsl脚本配置后,在ip里是不应该出现58类ip的,因为之前不理解自动刷新网关,看到脚本里58类ip,自己的机子里没有,以为不正常,重复添加脚本。

(增加pppoe服务后,拨号用户不通,这个后面详解)3、客户机配置手动ip和dns,看能否上网。

3、增加pppoe服务,导入pppoe账号,可以用脚本生成器生成。

三:配置双线adsl+pppoe服务过程1、安装ros,这个这里省略。

2、配置lan ip3、电脑配ip,和ros一个网段,winbox登陆,获取到lan的MAC,把ip换为mac登陆。

方法是ip登陆后点下后面小□(里面有三个...的那个,connect左边那个)在打开的菜单里点mac就可以换了。

4、改网卡名字我把第一个改为wan1,第二个改为wan2,第三个改为lan。

RouterOS从入门到精通——双线教程

RouterOS从入门到精通——双线教程希望大家能支持本站,买些你做路由需要的配件,这样也好给我点写教程的动力,我逐步放上来供大家参考。

前面大家都知道了怎么做单线路由了,这里有些简单相同的步骤我就不重复再说了此主题相关图片如下:这一步是添加网通的IP和掩码,我相信这个还是简单了就不多说了,下一步此主题相关图片如下:添加网通网关,点击IP—routes进入路由列表菜单,点+然后按图添加网通的网关,千万别忘记了给网通网关做标记“CNC”,这个标记要完全与你路由表中的标记名相同,而且是区分大小写的,否则你的路由表就无效,填写完成后点OK就行了。

下一步此主题相关图片如下:会的,然后把网通的路由表上传上去后关闭FTP软件此主题相关图片如下:点击Files菜单后就能查看你刚才上传的文件了。

下一步此主题相关图片如下:路由表文件名+后缀,回车后就能导入路由表了。

下一步此主题相关图片如下:在路由列表上点Rules标签,这里可以看到全部的网通列表,下一步此主题相关图片如下:网通网关生效,到此为止,你的双线策略路由算初步完成了。

结束语:其实routeros路由器的制作并不神秘,这要看你有没有用心去研究,做一台路由简单,但如何利用好这台路由那就要用很长的时间去分析和了解,ROS实在是太强大了,我所掌握的还都只能算是皮毛,还需要经过长期的努力才能有更深入的了解。

从这台路由上可以详细了解到你的内部网络正常与否,可以从中学习由于内网网络问题而引起的本来算是抽象的网络知识,这在一个大型的网络中起的作用应该不会小,所以希望大家都能熟练掌握它,让它为你更好的服务。

如果有时间我会把VPN借线,双向绑定、PPPOE拨号防ARP攻击,内网限流等等好多东西逐步放上来供大家参考!希望大家能都能支持一下本站的发展,谢谢!!。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Winbox配置回程路由:标记由线路1进入的连接conn1
标记由第二条线路进入的连接为conn2
在Output链表中将连接标记为conn1的标记路由为rout1
在Output链表中将连接标记为conn2的标记路由为rout2
在路由里做路由指向
回程路由标记和之前分流路由标记,此处路由规则就不需 要重复添加。
再将连接标记为conn1和conn2的分别标记路由为rout1和rout2
Winbox配置连接标记
选择Prerouting链表
选择内网接口
使用Both-adddress分类方式 分两个组
从0开始计数,选择第一组
排除路由器本地地址
标记连接为 conn1
添加第二条连接标记规则
和第一条差区别只是PCC和标记连接部分
多线路路由
电信网通双线 同ISP多线路 复合应用 VPN借线
成都网大科技
RouterOS的路由功能主要为:
基于源地址的路由 基于目标地址的路由 基于端口的路由 基于负载均衡的路由 基于端口的负载均衡
电信网通双线
电信网通双线路一般选择带宽较大的线路做主线路, 导入较小带宽类型的路由表,让数据根据目标地址来 选择线路
Both-address(源地址和目标地址)
将内网进入路由器的连接按照源地址和目标地址的连接标记连接和路由,已 有的连接则保持不变。
PCC配置
Mangle 标记配置 /ip firewall mangle
add action=mark-connection chain=prerouting comment="" disabled=no \ in-interface=ether3-lan new-connection-mark=conn1 passthrough=yes \ per-connection-classifier= both-address :2/0
/ip firewall mangle add chain=input in-interface=ether1-tel1\ action=mark-connection new-connection-mark=conn1 /ip firewall mangle add chain=input in-interface=ether2-tel2\ action=mark-connection new-connection-mark=conn2 /ip firewall mangle add chain=output connection-mark=conn1\ action=mark-routing new-routing-mark=rout1 /ip firewall mangle add chain=output connection-mark=conn2\ actitn=mark-routing new-routing-mark=rout2
导入之后可以在ip rout rule目录下面看到路由表信息
最后添加一条网关为电信,routing-mark为路由表标记Tlecom的路由
同ISP多线路
对于同类型ISP线路,将数据按带宽比例进行划分,让相应比例的数据 走相应线路。 如下示例,我们将内网的访问连接按连接的源地址和目标地址分组 (PCC)为3份,其中1/3走电信1,其余2/3走电信2。
配置步骤 设置接口 配置IP地址 配置路由,设置备份路由
配置NAT
PCC负载均衡
PCC 原理
PCC 匹配器将允许你分离传输流做到平衡流量的能力(你能指定这个设置选择 src-address, src-port, dst-address,dst-port) PCC 从一定范围内分析选择 IP数据包头,通过哈西散列算法的帮助下,将选 定的区域转换为 32bit 值。这个值除以指定 Denominator(分母),余数这时 比较一个指定的(Remainder)余数。如果平等然后将捕获的数据包你可以从 IP 头选择 src-address, dst-address, src-port, dst-port使用此操作。
导入联通路由表,路由指向
VPN借线
• 假设一个接入点A有电信和网通两条线路,并做了以网通为主,电信 为静态路由策略设置。而另一个接入点B 接入了网通的线路,并且想 通过PPTP隧道的方式借用接入点A的电信线路,现在看下面的图例
119.6.72.2
119.6.62.2
根据上面的案例,接入点A 和B他们都是共同使用了网通的线路,这里网 通两个点之间的延迟小于10ms,网络延迟小才能保证足够的网速给B 做电信的访问。首先建立从接入点B 到A的PPTP隧道,我们在接入点A 设置PPTP服务器,在接入点B设置客户端。这里接入点A的网通IP地址 为 119.6.72.2,B网通地址为119.6.62.2。
多线路复合应用
某网吧有5M电信光纤一条,5M网通光纤一条,5条 4MADSL,内部主机120台。
简单网络结构
结合网页数据上传小,下行比较大的特点,让网页数据负载均衡走ADSL 线路,然后导入网通路由表,让网通数据走网通光纤,默认路由走电信 光纤
接口配置 IP配置
80端口分流路由标记
:for i from=1 to=5 do= {/ip firewall mangle add chain=prerouting in-interface=ether3-lan\ protocol=tcp dst-port=80 per-connection-classifier=("bot"both-addresses:5/".($i-1)) \ dst-address-type=!local action=mark-connection new-connection-mark=("web-conn".$i);\ /ip firewall mangle add chain=prerouting in-interface=ether3-lan protocol=tcp \ dst-port=80 connection-mark=("web-conn".$i) action=mark-routing\ new-routing-mting-mark=("web-rout".$i)}
Winbox配置路由标记
Prerouting链表
选择由内网接口进入的数据 选择连接标记为conn1
标记路由为 rout1
建立路由标记rout2
路由指向
指定tel1 做网关
路由标记 选择rout1
路由指向
网关 选择 tel2
路由标 记选择 rout2
回程路由
回程路由用于外网能从任意公网接口访 问,其策略为在input链表标记从外网接口 进入的连接,然后在output链表以之前标记 的连接标记路由,并在路由里分别指向各 自的网关。
在A接入点配置PPTP-server
定义Profile
开启PPTP服务
在A接入点添加PPTP用户
在B接入点建立PPTP隧道
在B接入点导入电信路由表,并指定电信数据由PPTP隧道走向A接入点, 再由A接入点的电信线路出去。
add action=mark-routing chain=prerouting comment="" connection-mark=conn2 \ disabled=no in-interface=ether3-lan new-routing-mark=rout2 passthrough=yes
add action=mark-connection chain=prerouting comment="" disabled=no \ in-interface=ether3-lan new-connection-mark=conn2 passthrough=yes \ per-connection-classifier= both-address :2/1
将由内网接口进入的数据用PCC按both-address方式分别标记连接为conn1和 conn2
add action=mark-routing chain=prerouting comment=“” connection-mark=conn1\ disabled=no in-interface=ether3-lan new-routing-mark=rout1 passthrough=yes
基ห้องสมุดไป่ตู้网络设置
设置网卡
设置IP地址
设置路由 先添加一条网关为联通的默认路由,distance=1,再添加一条网关为
电信,distance=2的路由,这样当联通线路出现问题的时候,电信就 会自动切换成默认路由。
然后添加NAT规则
导入路由表
将路由表文件上传到Files目录
然后在命令行里执行import 文件名来导入路由表
相关文档
最新文档