|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
我的小网吧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 |
|