|
楼主 |
发表于 2007-1-24 02:23:39
|
显示全部楼层
两动态ip+1静态ip 3网关分流+自动切换
- / interface ethernet
- set ether1 name="ether1_LAN"
- set ether2 name="ether2_WAN1"
- set ether3 name="ether3_WAN2"
- set ether4 name="ether4_WAN3"
- / interface pppoe-client
- add name="pppoe-out1" max-mtu=1480 max-mru=1480 interface=ether2_WAN1 \
- user="adsl01" password="123456" profile=default service-name="" ac-name="" \
- add-default-route=no dial-on-demand=no use-peer-dns=yes \
- allow=pap,chap,mschap1,mschap2 disabled=no
- add name="pppoe-out2" max-mtu=1480 max-mru=1480 interface=ether3_WAN2 \
- user="adsl02" password="654321" profile=default service-name="" ac-name="" \
- add-default-route=no dial-on-demand=no use-peer-dns=yes \
- allow=pap,chap,mschap1,mschap2 disabled=yes
- / ip address
- add address=192.168.1.254/24 network=192.168.1.0 broadcast=192.168.1.255 \
- interface=ether1_LAN comment="added by setup" disabled=no
- add address=15.12.11.1/32 network=15.12.11.1 broadcast=15.12.11.1 \
- interface=ether3_WAN2 comment="" disabled=yes
- add address=15.12.11.2/24 network=15.12.11.0 broadcast=15.12.11.255 \
- interface=ether1_LAN comment="wan" disabled=no
- / ip route
- add dst-address=0.0.0.0/0 gateway=192.168.100.186 scope=255 target-scope=10 \
- routing-mark=10 comment="wan1" disabled=no
- add dst-address=0.0.0.0/0 gateway=192.168.100.186 scope=255 target-scope=10 \
- routing-mark=20 comment="wan2" disabled=no
- add dst-address=0.0.0.0/0 gateway=192.168.100.186 scope=255 target-scope=10 \
- routing-mark=30 comment="wan3" disabled=no
- / ip firewall mangle
- add chain=prerouting src-address=192.168.1.146/31 action=mark-routing \
- new-routing-mark=10 passthrough=yes comment="wan1" disabled=no
- add chain=prerouting src-address=192.168.1.148/31 action=mark-routing \
- new-routing-mark=20 passthrough=yes comment="wan2" disabled=no
- add chain=prerouting src-address=192.168.1.150/31 action=mark-routing \
- new-routing-mark=30 passthrough=yes comment="wan3" disabled=no
- / ip firewall nat
- add chain=srcnat routing-mark=10 action=src-nat to-addresses=192.168.100.184 \
- to-ports=0-65535 comment="wan1" disabled=no
- add chain=srcnat routing-mark=20 action=src-nat to-addresses=192.168.100.184 \
- to-ports=0-65535 comment="wan2" disabled=no
- add chain=srcnat routing-mark=30 action=src-nat to-addresses=192.168.100.184 \
- to-ports=0-65535 comment="wan3" disabled=no
- / system script
- \n/ip firewall nat set \="/ip route set wan1 gateway=\$wan1
- \n/system scheduler dis wan1stat" \
- policy=ftp,reboot,read,write,policy,test,winbox,password
- \n:if \(\[/tool \2" source=":set chw1 \$wan2
- \n:if \(\[/tool netwatch get wan3 \) do={
- \n:set chw1 \$src3} else={
- \n/ip route set \disable wan1}
- \n/ip \ip route find dst-address=0.0.0.0/0 gateway=\$wan1\] gateway=\$chw1
- firewall nat set \[/ip firewall nat find action=src-nat to-addresses=\$src1\] \
- \n/system scheduler enable wan1stat" \
- policy=ftp,reboot,read,write,policy,test,winbox,password
- \n/ip firewall nat set \="/ip route set wan2 gateway=\$wan2
- \n/system scheduler dis wan2stat" \
- policy=ftp,reboot,read,write,policy,test,winbox,password
- \n:if \(\[/tool \3" source=":set chw2 \$wan3
- \n:if \(\[/tool netwatch get wan1 \) do={
- \n:set chw2 \$src1} else={
- \n/ip route set \disable wan2}
- \n/ip \ip route find dst-address=0.0.0.0/0 gateway=\$wan2\] gateway=\$chw2
- firewall nat set \[/ip firewall nat find action=src-nat to-addresses=\$src2\] \
- \n/system scheduler enable wan2stat" \
- policy=ftp,reboot,read,write,policy,test,winbox,password
- \n/ip firewall nat set \="/ip route set wan3 gateway=\$wan3
- \n/system scheduler disable wan3stat" \
- policy=ftp,reboot,read,write,policy,test,winbox,password
- \n:if \(\[/tool \1" source=":set chw3 \$wan1
- \n:if \(\[/tool netwatch get wan2 \) do={
- \n:set chw3 \$src2} else={
- \n/ip route set \[/ip route find \
- \n/ip firewall nat set \0 gateway=\$wan3\] gateway=\$chw3
- \[/ip firewall nat find action=src-nat to-addresses=\$src3\] \
- \n/system scheduler enable wan3stat" \
- policy=ftp,reboot,read,write,policy,test,winbox,password
- \n:global src3 \n" source=":global wan3 15.12.11.1
- \n:global wan2 \one0.0.1
- \n:global src1 \one
- \n:global chs2 \55.0.0.1
- \n:global \pp2 none
- \n/tool netwatch disable \
- \n/tool netwatch set wan3 host=\$wan3 \
- \n/system scheduler enable \an1stat
- \n" \stem scheduler enable wan3stat
- policy=ftp,reboot,read,write,policy,test,winbox,password
- add name="wan1stat" source="/interface pppoe-client monitor pppoe-out1 once \
- \n:set wan1 \[/ip \nnected"\) do={
- \n:set src1 \et \[/ip address find interface=pppoe-out1\] network\]
- \n/tool \ route get \[/ip route find dst-address=\$wan1\] pref-src\]
- \n/tool \10h set wan1 host=\$wan1 disabled=no
- netwatch enable wan1}" \
- policy=ftp,reboot,read,write,policy,test,winbox,password
- add name="wan2stat" source="/interface pppoe-client monitor pppoe-out2 once \
- \n:set wan2 \[/ip \nnected"\) do={
- \n:set src2 \et \[/ip address find interface=pppoe-out2\] network\]
- \n/tool \ route get \[/ip route find dst-address=\$wan2\] pref-src\]
- \n/tool \10h set wan2 host=\$wan2 disabled=no
- netwatch enable wan2}" \
- policy=ftp,reboot,read,write,policy,test,winbox,password
- \n:if \(\[/tool netwatch get wan1 \pc 0
- \n:if \(\[/tool netwatch get wan2 \$tmpc+1\)}
- \n/tool \$tmpc>0\) do={set tmpc \(\$tmpc+1\)}
- \n}" \ay 20h enable wan3
- policy=ftp,reboot,read,write,policy,test,winbox,password
- add name="local886" source=":set ppp2 \$status" \
- policy=ftp,reboot,read,write,policy,test,winbox,password
- / system scheduler
- add name="startup" on-event=autorun start-time=startup interval=0s \
- comment="autorun" disabled=no
- add name="startup1" on-event=wan1stat start-time=startup interval=0s comment="" \
- disabled=no
- add name="startup2" on-event=wan2stat start-time=startup interval=0s comment="" \
- disabled=no
- add name="wan1stat" on-event=wan1stat start-date=jan/01/1970 start-time=00:00:00 \
- interval=10s comment="wan1stat" disabled=yes
- add name="wan2stat" on-event=wan2stat start-date=jan/01/1970 start-time=00:00:00 \
- interval=10s comment="wan2stat" disabled=no
- add name="wan3stat" on-event=wan3stat start-date=jan/01/1970 start-time=00:00:00 \
- interval=20s comment="wan3stat" disabled=no
- / queue simple
- add name="queueA" target-addresses=192.168.1.146/32,192.168.1.147/32 \
- dst-address=0.0.0.0/0 interface=all parent=none direction=both priority=8 \
- queue=default-small/default-small limit-at=0/0 max-limit=64000/200000 \
- burst-limit=128000/400000 burst-threshold=64000/180000 burst-time=3s/10s \
- total-queue=default-small time=0s-1d,sun,mon,tue,wed,thu,fri,sat disabled=yes
- add name="queueB" target-addresses=192.168.1.148/32,192.168.1.149/32 \
- dst-address=0.0.0.0/0 interface=all parent=none direction=both priority=8 \
- queue=default-small/default-small limit-at=0/0 max-limit=128000/256000 \
- burst-limit=256000/512000 burst-threshold=100000/200000 burst-time=3s/10s \
- total-queue=default-small time=0s-1d,sun,mon,tue,wed,thu,fri,sat disabled=no
- add name="queueC" target-addresses=192.168.1.150/32,192.168.1.151/32 \
- dst-address=0.0.0.0/0 interface=all parent=none direction=both priority=8 \
- queue=default-small/default-small limit-at=0/0 max-limit=128000/256000 \
- burst-limit=256000/512000 burst-threshold=100000/200000 burst-time=3s/10s \
- total-queue=default-small time=0s-1d,sun,mon,tue,wed,thu,fri,sat disabled=yes
- / tool netwatch
- add host=192.168.100.186 timeout=30ms interval=1s up-script=wan1up \
- down-script=wan1down comment="wan1" disabled=no
- add host=192.168.100.188 timeout=30ms interval=1s up-script=wan2up \
- down-script=wan2down comment="wan2" disabled=no
- add host=15.12.11.1 timeout=30ms interval=1s up-script=wan3up down-script=wan3down \
- comment="wan3" disabled=no
复制代码 |
|