Chinaunix首页 | 论坛 | 博客
  • 博客访问: 325129
  • 博文数量: 74
  • 博客积分: 4203
  • 博客等级: 上校
  • 技术积分: 875
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-30 17:42
文章分类

全部博文(74)

文章存档

2012年(3)

2011年(12)

2010年(9)

2009年(18)

2008年(5)

2007年(27)

我的朋友

分类: WINDOWS

2011-10-06 15:11:00

ROS 2.927 双线ADSL 负载均衡 双线叠加 教程 1+1>2
2011-08-22 22:16

今天终于做出 双线叠加

分享给广大朋友们:希望对大家有所帮助

ROS 有三张网卡 内网:lan 外网1:wan1  外网2:wan2

很简单只需要3步即可实现

1.安装 ROS 2.927 (略过,不懂网上大把教程)

 设置内网IP 方便 用winbox 访问

我的内网IP为192.168.1.7

 

2.增加刷新动态网关脚本

复制下面内容到 scheduler

: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=("pppoe-out" . $i)] running]
    :if ($status=true) do={
     :set new-address [/ip address get [/ip address find dynamic=yes interface=("pppoe-out" . $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=("pppoe-out" . $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
        /ip fir nat set [/ip fir nat find comment=$i] to-addresses=$new-address
        /ip route set [/ip route find comment=$i] gateway=$new-address
       }
   }
}

注意时间:填30秒 如下图:




3.复制以下脚本到 new terminal

/ip address add address=192.168.1.7/255.255.255.0 interface=lan comment=lan
/ip dns set primary-dns=202.96.128.86 secondary-dns=202.96.128.68 allow-remote-requests=yes
/ip firewall mangle add chain=forward protocol=tcp tcp-flags=syn action=change-mss new-mss=1440
/interface pppoe-client add name="pppoe-out1" interface=wan1 user="1" password="1" add-default-route=no disabled=no
/interface pppoe-client enable pppoe-out1
/ip address add address=58.58.58.1/32 interface=pppoe-out1 comment="1"
/ip route add gateway=58.58.58.1 routing-mark=1 comment="1"
/ip firewall mangle add chain=prerouting in-interface=lan connection-state=new nth=1,1,0 action=mark-connection new-connection-mark=1 passthrough=yes disabled=no
/ip firewall mangle add chain=prerouting in-interface=lan connection-mark=1 action=mark-routing new-routing-mark=1 passthrough=no disabled=no
/ip firewall nat add chain=srcnat connection-mark=1 action=src-nat to-addresses=58.58.58.1 to-ports=0-65535 comment="1" disabled=no
/interface pppoe-client add name="pppoe-out2" interface=wan2 user="2" password="2" add-default-route=no disabled=no
/interface pppoe-client enable pppoe-out2
/ip address add address=58.58.58.2/32 interface=pppoe-out2 comment="2"
/ip route add gateway=58.58.58.2 routing-mark=2 comment="2"
/ip firewall mangle add chain=prerouting in-interface=lan connection-state=new nth=1,1,1 action=mark-connection new-connection-mark=2 passthrough=yes disabled=no
/ip firewall mangle add chain=prerouting in-interface=lan connection-mark=2 action=mark-routing new-routing-mark=2 passthrough=no disabled=no
/ip firewall nat add chain=srcnat connection-mark=2 action=src-nat to-addresses=58.58.58.2 to-ports=0-65535 comment="2" disabled=no

 

OK,用迅雷下载试下,两条线都有流量了! 说明安装成功

 

From:http://hi.baidu.com/pzgm/blog/item/f2e680ca2d2dab53f31fe776.html


阅读(1256) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~