Ros双ADSL、NTH负载均衡实际操作设置(脚本化操作)

上传人:枫** 文档编号:485034205 上传时间:2024-02-25 格式:DOC 页数:5 大小:151KB
返回 下载 相关 举报
Ros双ADSL、NTH负载均衡实际操作设置(脚本化操作)_第1页
第1页 / 共5页
Ros双ADSL、NTH负载均衡实际操作设置(脚本化操作)_第2页
第2页 / 共5页
Ros双ADSL、NTH负载均衡实际操作设置(脚本化操作)_第3页
第3页 / 共5页
Ros双ADSL、NTH负载均衡实际操作设置(脚本化操作)_第4页
第4页 / 共5页
Ros双ADSL、NTH负载均衡实际操作设置(脚本化操作)_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《Ros双ADSL、NTH负载均衡实际操作设置(脚本化操作)》由会员分享,可在线阅读,更多相关《Ros双ADSL、NTH负载均衡实际操作设置(脚本化操作)(5页珍藏版)》请在金锄头文库上搜索。

1、建立PPP拨号,把其中一条拨号名命名为 ADSL1 ,另一个命明为 ADSL2 ,并把内网网卡命 名为LAN,然后等待拨号成功,设置参考下图拨号成功后,PPPOE会自动添加IP地址和网关,找到地址和网关,复制下来,替换到下面脚本中把A1IP替换成ADSL1的IP, A1网关替换成ADSL1的网关,把A2IP替换成ADSL2的IP,A2网关替换成ADSL2的网关.之后慢慢添脚本,添完成功后,把拨号的Add Default Route的勾去掉,看负载均衡是否可以正常工作!1普通脚本设置程序代码/ip firewall natadd cha in=srcnat action=masquerade c

2、omme nt=3 disabled=yes/ ip addressadd address=A1IP in terface=ADSL1 comme nt=1 disabled=noadd address=A2IP in terface=ADSL2 comme nt=2 disabled=no/ ip routeadd dst-address=O.O.O.O/O gateway=A1 网关 routing-mark=1 comment=1 add dst-address=0.0.0.0/0 gateway= A2 网关 routing-mark=2 comment=2add dst-addres

3、s=0.0.0.0/0 gateway= A1 网关 comment=32. 添加 NAT ,NTH 脚本程序代码/ ip firewall mangleadd chain=prerouting in-interface=LAN protocol=tcp connection-state=new nth=1,1,0 action=mark-connection new-connection-mark=1 passthrough=yes comment=A1 NTH disabled=noadd chain=prerouting in-interface=LAN protocol=tcp con

4、nection-mark=1 action=mark-routing new-routing-mark=1 passthrough=no comment=A1 NTH disabled=noadd chain=prerouting in-interface=LAN protocol=tcp connection-state=new nth=1,1,1 action=mark-connection new-connection-mark=2 passthrough=yes comment=A2 NTH disabled=noadd chain=prerouting in-interface=LA

5、N protocol=tcp connection-mark=2 action=mark-routing new-routing-mark=2 passthrough=no comment=A2 NTH disabled=no/ ip firewall natadd chain=srcnat connection-mark=1 action=src-nat to-addresses= A1IP to-ports=0-65535 comment=1 disabled=noadd chain=srcnat connection-mark=2 action=src-nat to-addresses=

6、 A2IP to-ports=0-65535 comment=2 disabled=no3. 同步 NAT ,ADSL 动态 IP ,网关脚本 :位置 winbox-system-script 点“ +号,改name为sync,然后复制下面的脚本到source里程序代码:local assign-address:local new-address :local status:local x :set x 2:for i from=1 to=$x do=:set status /interface get /interface find name=(ADSL . $i) running:if (

7、$status=true) do=:set new-address /ip address get /ip address find dynamic=yes interface=(ADSL . $i) address:set new-address :pick $new-address 0 (:len $new-address -3):set assign-address /ip address get /ip address find dynamic=no interface=(ADSL . $i) address:set assign-address :pick $assign-addre

8、ss 0 (:len $assign-address -3):set new-gateway /ip address get /ip address find dynamic=yes interface=(ADSL . $i) network :set adckip /tool netwatch get /tool netwatch find comment=$i host:if ($assign-address != $new-address) do= /ip address set /ip address find comment=$i address=$new-address netwo

9、rk=$new-address broadcast=$new-address/ip route set /ip route find comment=$i gateway=$new-gateway/ip firewall nat set /ip firewall nat find comment=$i to-addresses=$new-address/ip route set /ip route find comment=$i gateway=$new-gateway:if ($new-gateway != $adckip) do=/tool netwatch set /tool netwa

10、tch find comment=$i host=$new-gateway4. 添加 ADSL1 当线脚本 A1Down ,自动停用 NTH 负载所需的参数, 并将标记 3 的网关设为 ADSL2 的网关位置 winbox-system-script 点 “+ 号”,改 name 为 A1Down ,然后复制下面的脚本到 source 里 程序代码:local new-gateway:set new-gateway / ip address get /ip address find dynamic=yes interface=ADSL2 network/ip route set /ip rou

11、te find comment=3 gateway=$new-gateway/ip route enable /ip route find comment=3/ip route disabled /ip route find comment=1/ip route disabled /ip route find comment=2/ip firewall nat enable /ip firewall nat find comment=3/ip firewall nat disabled /ip firewall nat find comment=1/ip firewall nat disabl

12、ed /ip firewall nat find comment=25. 添加 ADSL2 当线脚本 A2Down ,自动停用 NTH 负载所需的参数, 并将标记 3 的网关设为 ADSL1 的网关位置 winbox-system-script 点 “+ 号”,改 name 为 A2Down ,然后复制下面的脚本到 source 里 程序代码:local new-gateway:set new-gateway / ip address get /ip address find dynamic=yes interface=ADSL1 network/ip route set /ip route

13、find comment=3 gateway=$new-gateway/ip route enable /ip route find comment=3/ip route disabled /ip route find comment=1/ip route disabled /ip route find comment=2/ip firewall nat enable /ip firewall nat find comment=3/ip firewall nat disabled /ip firewall nat find comment=1/ip firewall nat disabled/

14、ip firewall nat find comment=26. 添加 ADSL 掉线判断 NETWATCH 程序代码/ tool netwatchadd host= A1 网关 timeout=1s interval=1m up-script= down-script=A1Downcomment=1 add host= A2 网关 timeout=1s interval=1m up-script= down-script=A2Down comment=27添加双线判断正常脚本allup。即两条线路 UP的时候开启NTH负载均衡。位置 winbox-system-script 点“ +号,改n

15、ame为allup,然后复制下面的脚本到source里程序代码:global a:global b:set a /tool netwatch get /tool netwatch find comment=1 status:set b /tool netwatch get /tool netwatch find comment=2 status:if ($a=up) & ($b=up) do=/ip route disabled /ip route find comment=3/ip route enable /ip route find comment=1/ip route enable /ip route find comment=2/ip firewall nat disabled /ip firewall nat find comment=3/ip firewall nat enable /ip firewall nat find comment=1/ip firewall

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 解决方案

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号