找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2606|回复: 1

[脚本] 求救 我的双ADSL做的ros脚本有问题,有高手能否解决

[复制链接]
发表于 2007-10-17 10:35:09 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
我的小网吧30台 2根ADSL宽带(动态IP猫重启IP就变),一根(ADSL1)6M一根2M(ADSL2),ros软路由
局域网状况:
网关192.168.1.254
192.168.1.1-192.168.1.20走ADSL1,192.168.1.21-192.168.1.30走ADSL2

以下是脚本,运行后能拨号成功但客户机上不了网,请高手我这脚本那里有不对的地方?有没有更好的脚本

/ interface ethernet
set LAN name="LAN" mtu=1500 mac-address=00:19:E0:1D:1E:09 arp=enabled \
    disable-running-check=yes auto-negotiation=yes full-duplex=yes \
    cable-settings=default speed=100Mbps comment="" disabled=no
set WAN01 name="WAN01" mtu=1500 mac-address=00:19:E0:6A0:38 arp=enabled \
    disable-running-check=yes auto-negotiation=yes full-duplex=yes \
    cable-settings=default speed=100Mbps comment="" disabled=no
set WAN02 name="WAN02" mtu=1500 mac-address=00:40:05:40:3B:79 arp=enabled \
    disable-running-check=yes auto-negotiation=yes full-duplex=yes \
    cable-settings=default speed=100Mbps comment="" disabled=no
/ interface pppoe-client
add name="ADSL-WAN1" max-mtu=1480 max-mru=1480 interface=WAN01 user="ksam7287" \
    password="123456" profile=default service-name="" ac-name="" \
    add-default-route=yes dial-on-demand=no use-peer-dns=yes \
    allow=pap,chap,mschap1,mschap2 disabled=no
add name="ADSL-WAN2" max-mtu=1480 max-mru=1480 interface=WAN02 user="ksam7287" \
    password="123456" profile=default service-name="" ac-name="" \
    add-default-route=yes dial-on-demand=no use-peer-dns=yes \
    allow=pap,chap,mschap1,mschap2 disabled=no
/ ip dns
set primary-dns=61.177.7.1 secondary-dns=221.228.255.1 allow-remote-requests=yes \
    cache-size=2048KiB cache-max-ttl=1w
/ ip address
add address=192.168.1.254/24 network=192.168.1.0 broadcast=192.168.1.255 \
    interface=LAN comment="" disabled=no
add address=192.168.6.250/24 network=192.168.3.0 broadcast=192.168.3.255 \
    interface=WAN01 comment="" disabled=no
add address=192.168.6.251/24 network=192.168.3.0 broadcast=192.168.3.255 \
    interface=WAN02 comment="" disabled=no
add address=192.168.2.252/32 network=192.168.2.252 broadcast=192.168.2.252 \
    interface=ADSL-WAN2 comment="2" disabled=no
add address=192.168.2.2/32 network=192.168.2.2 broadcast=192.168.2.2 \
    interface=ADSL-WAN1 comment="1" disabled=no
/ ip route
add dst-address=0.0.0.0/0 gateway=192.168.2.2,192.168.2.252 check-gateway=ping \
    distance=0 scope=255 target-scope=10 routing-mark=WAN01 comment="1" \
    disabled=no
add dst-address=0.0.0.0/0 gateway=192.168.2.252 check-gateway=ping scope=255 \
    target-scope=10 comment="2" disabled=no
/ ip firewall mangle
add chain=prerouting in-interface=LAN protocol=tcp dst-port=80 \
    action=mark-routing new-routing-mark=WAN01 passthrough=yes \
    comment="forward check" disabled=no
add chain=prerouting in-interface=LAN protocol=udp dst-port=80 \
    action=mark-routing new-routing-mark=WAN01 passthrough=yes comment="" \
    disabled=no
add chain=prerouting action=accept comment="Accept" disabled=no
add chain=forward protocol=tcp tcp-flags=syn action=change-mss \
    new-mss=clamp-to-pmtu comment="" disabled=no
/ ip firewall nat
add chain=srcnat action=masquerade comment="" disabled=no
/ system script
: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-WAN" . $i)] running]
    :if ($status=true) do={
    :set new-address [/ip address get [/ip address find dynamic=yes interface=("ADSL-WAN" . $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-WAN" . $i)] address]
    :set assign-address [:pick $assign-address 0 ([:len $assign-address] -3)]
        :if ($assign-address != $new-address) do={ \
        /ip address set [/ip address find comment=$i] address=$new-address network=$new-address broadcast=$new-address
        /ip route set [/ip route find comment=$i] gateway=$new-address
      }
  }
  
}



/system  scheduler add name="getadsl" on-event="getadsl"  interval=15s
routeros
发表于 2007-10-17 22:47:25 | 显示全部楼层
眼花...先搞通单ad可以上网先...
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-11-17 08:50 , Processed in 0.051430 second(s), 6 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表