第一 ip设好
/ ip address
add address=192.168.1.1/24 network=192.168.1.0 broadcast=192.168.1.255 interface=lan comment="" disabled=no
add address=电信地址/掩码 network=自动设置 broadcast=自动设置
interface=TEL comment="" disabled=no
add address=网通地址/掩码 network=自动设置 broadcast=自动设置
interface=CNC comment="" disabled=no
这里如果你有 PPPOE的 ADSL 也可以+上 ADSL
记住要改MSS
/ ip firewall mangle
add chain=forward out-interface=pppoe-out1 protocol=tcp tcp-flags=syn action=change-mss new-mss=1400 comment="" disabled=no
/ ip firewall nat
add chain=srcnat src-address=192.168.1.0/24 action=masquerade comment="" disabled=no
--------------------------------------------------------------------------------------------------
第2步 添加 网通的路由网关
电信的服务器在网络中占了绝大多数
所以不需要考虑电信的服务器
/ ip route
add dst-address=59.80.0.0/14 gateway=网通网关 check-gateway=ping distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
add dst-address=60.0.0.0/13 gateway=网通网关 check-gateway=ping distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
add dst-address=60.8.0.0/15 gateway=网通网关 check-gateway=ping distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
add dst-address=60.10.0.0/16 gateway=网通网关 check-gateway=ping distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
add dst-address=60.12.0.0/16 gateway=网通网关 check-gateway=ping distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
add dst-address=60.13.0.0/18 gateway=网通网关 check-gateway=ping distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
add dst-address=60.13.128.0/17 gateway=网通网关 check-gateway=ping distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
add dst-address=60.16.0.0/12 gateway=网通网关 check-gateway=ping distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
add dst-address=60.55.0.0/16 gateway=网通网关 check-gateway=ping distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
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=no
add 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 distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
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=no
add 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 distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
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=no
add 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=203.93.0.0/16 gateway=网通网关 check-gateway=ping distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
add dst-address=203.175.192.0/18 gateway=网通网关 check-gateway=ping distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
add dst-address=210.51.0.0/16 gateway=网通网关 check-gateway=ping distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
add dst-address=211.69.0.0/25 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 distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
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=no
add 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 distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
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=no
add 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 distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
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=no
add 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 distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
add dst-address=222.208.65.0/24 gateway=网通网关 check-gateway=ping distance=0 scope=255 target-scope=10 comment="CNC" disabled=no
add dst-address=0.0.0.0/0 gateway=电信网关 check-gateway=ping distance=0 scope=255 target-scope=10 comment="TEL" disabled=no
(最后这条的意义就是保证在上面找不到网通的网关后 IP包自动走电信的线路 如果想拷贝这个规则 就用替换功能 换上具体的IP就可以了)
-------------------------------------------------------------------------------------------------------
第3步 设置好监控的开关
/ tool netwatch
add host=电信网关 timeout=1s interval=1m up-script=dxup down-script=dxdown comment="TEL" disabled=no
add host=网通网关 timeout=1s interval=1m up-script=CNCup down-script=CNCdown comment="CNC" disabled=no
--------------------------------------------------------------------------------------------------------
第四写好脚本自动切换
/ system script
add name="dxup" source="/ip route set \[/ip route find comment=TEL\] gateway 电信网关\n" policy=ftp,reboot,read,write,policy,test,winbox,password
add name="CNCup" source="/ip route set \[/ip route find comment=CNC\] gateway 网通网关\n" policy=ftp,reboot,read,write,policy,test,winbox,password
add 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,password
add 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 在电信的 光纤断的 时候 判断1下 网通的光纤是否是断了 (如果也断了就换ADSL)
如果没有断就上 网通的光纤 (反过来 网通的断了也一样)
针对很多地方光纤晚上都会断线的情况
如果不用ADSL 就更简单了,自己看吧
欢迎访问最专业的网吧论坛,无盘论坛,网吧经营,网咖管理,网吧专业论坛https://bbs.txwb.com |
关注天下网吧微信,了解网吧网咖经营管理,安装维护:
本文来源:天下·网吧联盟论坛收集 作者:佚名