成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

完全手冊之ADSL負載均衡配置

網(wǎng)絡(luò) 網(wǎng)絡(luò)優(yōu)化 網(wǎng)絡(luò)運維
本文介紹了雙ADSL下的NTH的負載均衡設(shè)置問題。包括普通腳本,nat,還有IP等相關(guān)內(nèi)容。那么,具體的代碼,請從下文中參考。

說了很多關(guān)于數(shù)據(jù)庫,服務(wù)器等負載均衡問題。現(xiàn)在,我們來討論一下ADSL的負載均衡設(shè)置。主要我們需要對腳本進行“改造”,也就是NTH負載均衡的設(shè)置問題,文中包括很多腳本代碼,希望大家能仔細的瀏覽,幫大家解決問題。

建立PPP撥號,把其中一條撥號名命名為ADSL1,另一個命明為ADSL2,并把內(nèi)網(wǎng)網(wǎng)卡命名為LAN,然后等待撥號成功,設(shè)置參考下圖

完全手冊之ADSL負載均衡配置

撥號成功后,PPPOE會自動添加IP地址和網(wǎng)關(guān),找到地址和網(wǎng)關(guān),復(fù)制下來,替換到下面腳本中,把A1IP替換成ADSL1的IP,A1網(wǎng)關(guān)替換成ADSL1的網(wǎng)關(guān),把A2IP替換成ADSL2的IP,A2網(wǎng)關(guān)替換成ADSL2的網(wǎng)關(guān).之后慢慢添腳本,添完成功后,把撥號的Add Default Route的勾去掉,看負載均衡是否可以正常工作!#p#

1.普通腳本設(shè)置

  1. / ip firewall nat  
  2. add chain=srcnat action=masquerade comment="3" disabled=yes  
  3. / ip address  
  4. add address=A1IP interface=ADSL1 comment="1" disabled=no  
  5. add address=A2IP interface=ADSL2 comment="2" disabled=no  
  6. / ip route  
  7. add dst-address=0.0.0.0/0 gateway=A1網(wǎng)關(guān) routing-mark=1 comment="1" 
  8. add dst-address=0.0.0.0/0 gateway=A2網(wǎng)關(guān) routing-mark=2 comment="2" 
  9. add dst-address=0.0.0.0/0 gateway=A1網(wǎng)關(guān) comment="3" 

2.添加NAT,NTH腳本

  1. / ip firewall mangle  
  2. add chain=prerouting in-interface=LAN protocol=tcp connection-state=new nth=1,1,0 action=mark-connection \  
  3.     new-connection-mark=1 passthrough=yes comment="A1 NTH" disabled=no  
  4. add chain=prerouting in-interface=LAN protocol=tcp connection-mark=1 action=mark-routing new-routing-mark=1 \  
  5.     passthrough=no comment="A1 NTH" disabled=no  
  6. add chain=prerouting in-interface=LAN protocol=tcp connection-state=new nth=1,1,1 action=mark-connection \  
  7.     new-connection-mark=2 passthrough=yes comment="A2 NTH" disabled=no  
  8. add chain=prerouting in-interface=LAN protocol=tcp connection-mark=2 action=mark-routing new-routing-mark=2 \  
  9.     passthrough=no comment="A2 NTH" disabled=no  
  10. / ip firewall nat  
  11. add chain=srcnat connection-mark=1 action=src-nat to-addresses=A1IP to-ports=0-65535 comment="1" disabled=no  
  12. add chain=srcnat connection-mark=2 action=src-nat to-addresses=A2IP to-ports=0-65535 comment="2" disabled=no 

#p#3.同步NAT,ADSL動態(tài)IP,網(wǎng)關(guān)腳本:位置winbox-system-script 點“+ ”號,改name為sync,然后復(fù)制下面的腳本到source里

  1. :local assign-address  
  2. :local new-address  
  3. :local status  
  4. :local x  
  5. :set x 2  
  6. :for i from=1 to=$x do={  
  7.     :set status [/interface get [/interface find name=("ADSL" . $i)] running]  
  8.     :if ($status=truedo={  
  9.      :set new-address [/ip address get [/ip address find dynamic=yes interface=("ADSL" . $i)] address]  
  10.      :set new-address [:pick $new-address 0 ([:len $new-address] -3)]  
  11.      :set assign-address [/ip address get [/ip address find dynamic=no interface=("ADSL" . $i)] address]  
  12.      :set assign-address [:pick $assign-address 0 ([:len $assign-address] -3)]  
  13. :set new-gateway [/ip address get [/ip address find dynamic=yes interface=("ADSL" . $i)] network]  
  14. :set adckip [/tool netwatch get [/tool netwatch find comment=$i] host]  
  15.         :if ($assign-address != $new-address) do={ /ip address set [/ip address find comment=$i] address=$new-address network=$new-address broadcast=$new-address  
  16.         /ip route set [/ip route find comment=$i] gateway=$new-gateway]  
  17.         /ip firewall nat set [/ip firewall nat find comment=$i] to-addresses=$new-address  
  18.         /ip route set [/ip route find comment=$i] gateway=$new-gateway]  
  19.        }  
  20.     :if ($new-gateway != $adckip) do={/tool netwatch set [/tool netwatch find comment=$i] host=$new-gateway]  
  21. }  
  22.    }  

4.添加ADSL1當線腳本A1Down,自動停用NTH負載均衡所需的參數(shù),并將標記3的網(wǎng)關(guān)設(shè)為ADSL2的網(wǎng)關(guān),位置winbox-system-script 點“+ ”號,改name為A1Down,然后復(fù)制下面的腳本到source里

  1. :local new-gateway  
  2. :set new-gateway [/ ip address get [/ip address find dynamic=yes interface=ADSL2] network]  
  3. /ip route set [/ip route find comment=3] gateway=$new-gateway  
  4. /ip route enable [/ip route find comment=3]  
  5. /ip route disabled [/ip route find comment=1]  
  6. /ip route disabled [/ip route find comment=2]  
  7. /ip firewall nat enable [/ip firewall nat find comment=3]  
  8. /ip firewall nat disabled [/ip firewall nat find comment=1]  
  9. /ip firewall nat disabled [/ip firewall nat find comment=2] 

5.添加ADSL2當線腳本A2Down,自動停用NTH負載均衡所需的參數(shù),并將標記3的網(wǎng)關(guān)設(shè)為ADSL1的網(wǎng)關(guān),位置winbox-system-script 點“+ ”號,改name為A2Down,然后復(fù)制下面的腳本到source里

  1. :local new-gateway  
  2. :set new-gateway [/ ip address get [/ip address find dynamic=yes interface=ADSL1] network]  
  3. /ip route set [/ip route find comment=3] gateway=$new-gateway  
  4. /ip route enable [/ip route find comment=3]  
  5. /ip route disabled [/ip route find comment=1]  
  6. /ip route disabled [/ip route find comment=2]  
  7. /ip firewall nat enable [/ip firewall nat find comment=3]  
  8. /ip firewall nat disabled [/ip firewall nat find comment=1]  
  9. /ip firewall nat disabled[/ip firewall nat find comment=2] 

#p#6.添加ADSL掉線判斷NETWATCH

  1. / tool netwatch  
  2. add host=A1網(wǎng)關(guān) timeout=1s interval=1m up-script="" down-script="A1Down" comment="1" 
  3. add host=A2網(wǎng)關(guān) timeout=1s interval=1m up-script="" down-script="A2Down" comment="2" 

7.添加雙線判斷正常腳本allup。即兩條線路UP的時候開啟NTH負載均衡。位置winbox-system-script 點“+ ”號,改name為allup,然后復(fù)制下面的腳本到source里

  1. :global a  
  2. :global b  
  3. :set a [/tool netwatch get [/tool netwatch find comment=1] status]  
  4. :set b [/tool netwatch get [/tool netwatch find comment=2] status]  
  5. :if (($a="up") && ($b="up")) do={  
  6. /ip route disabled [/ip route find comment=3]  
  7. /ip route enable [/ip route find comment=1]  
  8. /ip route enable [/ip route find comment=2]  
  9. /ip firewall nat disabled [/ip firewall nat find comment=3]  
  10. /ip firewall nat enable [/ip firewall nat find comment=1]  
  11. /ip firewall nat enable [/ip firewall nat find comment=2]} 

8.添加腳本計劃任務(wù)

  1. / system scheduler  
  2. add name="tasksync" on-event=sync start-date=jan/01/1970 start-time=00:00:00 interval=10s comment="" 
  3. add name="taskup" on-event=allup start-date=jan/01/1970 start-time=00:00:00 interval=10s comment="" 

 

責(zé)任編輯:佟健 來源: 互聯(lián)網(wǎng)
相關(guān)推薦

2010-04-26 18:06:31

ADSL負載均衡設(shè)置

2019-03-18 10:44:41

負載均衡DNSUDP

2010-04-21 12:28:50

Oracle負載均衡

2010-04-22 12:45:05

2009-10-27 10:03:47

ADSL接入技術(shù)

2018-11-07 10:12:37

2010-04-22 16:05:46

網(wǎng)絡(luò)負載均衡配置

2018-07-30 13:19:05

網(wǎng)站HTTPHTTPS

2019-09-27 08:18:13

負載均衡核心Key

2010-05-10 14:20:24

負載均衡技術(shù)

2010-04-26 14:44:36

負載均衡設(shè)備

2021-01-26 05:35:24

負載均衡系統(tǒng)設(shè)計

2021-04-22 07:47:46

Linux進程管理

2010-04-28 12:24:42

網(wǎng)站負載均衡

2010-04-26 17:07:59

網(wǎng)絡(luò)負載均衡

2017-07-03 08:08:25

負載均衡分類

2010-04-20 22:19:29

tomcat負載均衡配

2014-07-28 11:37:49

NginxTomcat

2009-11-02 17:25:04

ADSL常見問題

2009-10-30 16:57:40

ADSL常見接入問題
點贊
收藏

51CTO技術(shù)棧公眾號

主站蜘蛛池模板: 国产精品日日做人人爱 | 九九九视频精品 | 欧美伊人久久久久久久久影院 | 日韩精品一区二区三区免费视频 | 国产一区二区三区不卡av | 亚洲欧美成人影院 | 一级网站| www国产成人免费观看视频,深夜成人网 | 做a视频在线观看 | 全部免费毛片在线播放网站 | 欧美激情在线一区二区三区 | 成人国产精品视频 | 中文字幕一区二区三区精彩视频 | 国产三级大片 | 不卡一二区 | 成人免费片| 久久久av中文字幕 | 精品久久一区 | 国产在线小视频 | 亚洲精品丝袜日韩 | 亚洲欧美国产毛片在线 | 日韩久草| 视频在线一区 | 欧美视频在线观看 | 爱爱免费视频 | 五月天婷婷综合 | 久久精品亚洲精品国产欧美 | 黄色欧美 | 亚洲网站在线观看 | 日韩精品视频中文字幕 | 欧美精品一区二区三区在线四季 | 亚洲欧美激情国产综合久久久 | 久久国产精99精产国高潮 | 91网站在线看 | 色婷婷精品国产一区二区三区 | 欧美日韩一二三区 | 欧美高清视频 | 激情欧美一区二区三区中文字幕 | 91视频在线网站 | 成人综合在线视频 | 亚洲人成人一区二区在线观看 |