(转帖)单网卡PPPOE五次拨号带宽合并,零成本...2M变10M 分享全过程

                           单网卡PPPOE五次拨号带宽合并,零成本...2M变10M 分享全过程

 

网络环境:电信FTTB+LAN 可以多次PPPOE拨号(好像装了IPTV的ADSL也可以多次拨号,不清楚)
使用软件:1、“多特下载“VMware Workstation(虚拟机) V6.0.2 Build 59824 汉化版.exe
           序列号:JHXUR-G0M88-GA44V-4MRN6
          2、”狗狗下载“软路由RouterOS2.9.6破解版及安装动画(34动画)    包含有了软件安装及视频教程。
           学习论坛:中国路由论坛

简要安装过程:
1、新建虚拟机 自定义 linux 桥接 磁盘 IDE, 添加五块桥接网卡, 光驱使用ISO镜像就是RouterOS2.9.6破解版.iso ,启动,安
装完,镜像ISO不要了,启动login admin   ,setup  a  a  192.168.0.1/24  x x    。好了虚拟机好了,以后只需要后台运行
着即可,配置高的机器几乎不占用系统资源。
2、本机IP设为192.168.0.2 后 用 winbox 连接到192.168.0.1  。
new terminal 脚本

/ interface pppoe-client
add name="pppoe-out1" max-mtu=1480 max-mru=1480 interface=ether2 /
    user="拨号账号" password="拨号密码" profile=default service-name="" /
    ac-name="" add-default-route=no dial-on-demand=no use-peer-dns=no /
    allow=pap,chap,mschap1,mschap2 disabled=no
add name="pppoe-out2" max-mtu=1480 max-mru=1480 interface=ether3 /
    user="拨号账号" password="拨号密码" profile=default service-name="" /
    ac-name="" add-default-route=no dial-on-demand=no use-peer-dns=no /
    allow=pap,chap,mschap1,mschap2 disabled=no
add name="pppoe-out3" max-mtu=1480 max-mru=1480 interface=ether4 /
    user="拨号账号" password="拨号密码" profile=default service-name="" /
    ac-name="" add-default-route=no dial-on-demand=no use-peer-dns=no /
    allow=pap,chap,mschap1,mschap2 disabled=no
add name="pppoe-out4" max-mtu=1480 max-mru=1480 interface=ether5 /
    user="拨号账号" password="拨号密码" profile=default service-name="" /
    ac-name="" add-default-route=no dial-on-demand=no use-peer-dns=no /
    allow=pap,chap,mschap1,mschap2 disabled=no
add name="pppoe-out5" max-mtu=1480 max-mru=1480 interface=ether6 /
    user="拨号账号" password="拨号密码" profile=default service-name="" /
    ac-name="" add-default-route=no dial-on-demand=no use-peer-dns=no /
    allow=pap,chap,mschap1,mschap2 disabled=no
/ ip address
add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 /
    interface=ether1 comment="added by setup" disabled=no
add address=128.228.188.17/32 network=128.228.188.17 broadcast=128.228.188.17 /
    interface=pppoe-out1 comment="1" disabled=no
add address=128.228.191.73/32 network=128.228.191.73 broadcast=128.228.191.73 /
    interface=pppoe-out2 comment="2" disabled=no
add address=128.228.190.137/32 network=128.228.190.137 /
    broadcast=128.228.190.137 interface=pppoe-out3 comment="3" disabled=no
add address=128.228.189.121/32 network=128.228.189.121 /
    broadcast=128.228.189.121 interface=pppoe-out4 comment="4" disabled=no
add address=128.228.192.121/32 network=128.228.192.121 /
    broadcast=128.228.192.121 interface=pppoe-out5 comment="5" disabled=no

/ ip firewall mangle
add chain=prerouting in-interface=ether1 connection-state=new nth=4,1,0 /
    action=mark-connection new-connection-mark=1 passthrough=yes comment="" /
    disabled=no
add chain=prerouting in-interface=ether1 connection-mark=1 action=mark-routing /
    new-routing-mark=1 passthrough=no comment="" disabled=no
add chain=prerouting in-interface=ether1 connection-state=new nth=4,1,1 /
    action=mark-connection new-connection-mark=2 passthrough=yes comment="" /
    disabled=no
add chain=prerouting in-interface=ether1 connection-mark=2 action=mark-routing /
    new-routing-mark=2 passthrough=no comment="" disabled=no
add chain=prerouting in-interface=ether1 connection-state=new nth=4,1,2 /
    action=mark-connection new-connection-mark=3 passthrough=yes comment="" /
    disabled=no
add chain=prerouting in-interface=ether1 connection-mark=3 action=mark-routing /
    new-routing-mark=3 passthrough=no comment="" disabled=no
add chain=prerouting in-interface=ether1 connection-state=new nth=4,1,3 /
    action=mark-connection new-connection-mark=4 passthrough=yes comment="" /
    disabled=no
add chain=prerouting in-interface=ether1 connection-mark=4 action=mark-routing /
    new-routing-mark=4 passthrough=no comment="" disabled=no
add chain=prerouting in-interface=ether1 connection-state=new nth=4,1,4 /
    action=mark-connection new-connection-mark=5 passthrough=yes comment="" /
    disabled=no
add chain=prerouting in-interface=ether1 connection-mark=5 action=mark-routing /
    new-routing-mark=5 passthrough=no comment="" disabled=no

/ ip firewall nat
add chain=srcnat connection-mark=1 action=src-nat to-addresses=128.228.188.17 /
    to-ports=0-65535 comment="1" disabled=no
add chain=srcnat connection-mark=2 action=src-nat to-addresses=128.228.191.73 /
    to-ports=0-65535 comment="2" disabled=no
add chain=srcnat connection-mark=3 action=src-nat to-addresses=128.228.190.137 /
    to-ports=0-65535 comment="3" disabled=no
add chain=srcnat connection-mark=4 action=src-nat to-addresses=128.228.189.121 /
    to-ports=0-65535 comment="4" disabled=no
add chain=srcnat connection-mark=5 action=src-nat to-addresses=128.228.192.121 /
    to-ports=0-65535 comment="5" disabled=no

/ ip route
add dst-address=0.0.0.0/0 gateway=128.228.188.17 scope=255 target-scope=10 /
    routing-mark=1 comment="1" disabled=no
add dst-address=0.0.0.0/0 gateway=128.228.191.73 scope=255 target-scope=10 /
    routing-mark=2 comment="2" disabled=no
add dst-address=0.0.0.0/0 gateway=128.228.190.137 scope=255 target-scope=10 /
    routing-mark=3 comment="3" disabled=no
add dst-address=0.0.0.0/0 gateway=128.228.189.121 scope=255 target-scope=10 /
    routing-mark=4 comment="4" disabled=no
add dst-address=0.0.0.0/0 gateway=128.228.192.121 scope=255 target-scope=10 /
    routing-mark=5 comment="5" disabled=no
add dst-address=0.0.0.0/0 gateway=128.228.189.121 scope=255 target-scope=10 /
    comment="6" disabled=no

/ ip upnp interfaces
add interface=ether1 type=internal disabled=no
add interface=pppoe-out1 type=external disabled=no
add interface=pppoe-out2 type=external disabled=no
add interface=pppoe-out3 type=external disabled=no
add interface=pppoe-out4 type=external disabled=no
add interface=pppoe-out5 type=external disabled=no
/ ip upnp
set enabled=yes allow-disable-external-interface=yes show-dummy-rule=yes

 

在system schedule 粘入,设置为20秒自动更新
:local assign-address
:local new-address
:local status
:local x
:set x 5
: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 route set [/ip route find comment="6"] gateway=$new-address
        /ip fir nat set [/ip fir nat find comment=$i] to-addresses=$new-address
       }
   }
}


转贴:上面的脚本的解释
:local assign-address  #设本地变量名
:local new-address     #设本地变量名
:local status                #设本地变量名
:local x                        #设本地变量名
:set x 2                       #给变量赋值为2
:for i from=1 to=$x do={       #做x的循环x的数为多少就做多少次循环 $为变量调用符
    :set status /interface get [/interface find  name=("pppoe-out" . $i)] running]    #获取PPPOE-out $i是否为运行状态 每运行一次循环,i的值加1,现在i的值应为1,所以就是做PPPOE-out1的运行状态的获取。
    :if ($status=true) do={   #前一句得到了PPPOE-out1的状态情况,这句就是对其状态的处理,如果运行状态为运行,那么就去行do={里的命令,如果为false的直接结束。
     :set new-address /ip address get [/ip address find dynamic=yes interface=("pppoe-out" . $i)] address] #获取 PPPOE-out $1的动态IP地址。这个IP是带有掩码的
     :set new-address [:pick $new-address 0 ([:len $new-address] -3)]  #去除掉刚才得到的IP的掩码。得到一个纯IP地址。
     :set assign-address /ip address get [/ip address find dynamic=no interface=("pppoe-out" . $i)] address]   #获取pppoe-out的静态IP。
     :set assign-address [:pick $assign-address 0 ([:len $assign-address] -3)] 去除静态IP的掩码。
        :if ($assign-address != $new-address) do={ #对比PPPOE-out的静态IP和动态IP是否一样。一样就不修改。直接到结束
        /ip address set [/ip address find comment=$i] address=$new-address network=$new-address broadcast=$new-address #把动态IP写给静态IP。
        /ip route set [/ip route find comment=$i] gateway=$new-address #把动态IP写给标记了的网关 用comment号进行区别,第一次运行这条语句时$i为1所以就是修改comment=1的那个网关。
        /ip route set [/ip route find comment="3"] gateway=$new-address #这句话是我在原作者的基础上增加的,目的是将没有标记的线路指向最后一条adsl。
        /ip fir nat set [/ip fir nat find comment=$i] to-addresses=$new-address #把动态IP写向防火墙的net地址。
       }
   }
}


-------------------------------------------------------------------------------
-----------终于搞定了,理论速度可以五倍啊。。。。

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值