资源描述
此文章绝对原创真实能用,无一错漏,不像有的人遮遮掩掩,因为我就是一边装一边截图的,上一贴的精华是我这一贴的动力啊,哈!生平第一次在TPY得到精华
首先安装好ROS不会安装的请进这里
准备工作:ROS一台 ADSL两条 还有十足的耐心。
这里一共分为三步,全部以脚本形式配置,避免了手动设置的繁琐。
进入WINBOX 确定你的网卡名字改成lan wan1 wan2了没
一、建立PPPOE服务器
点击New Terminal 复制以下脚本 ,拷贝到Terminal里面,拷贝到里面后按下回车。
/ ip pool add name=PPPoE_Pool ranges=10.10.10.2-10.10.10.254
/ interface pppoe-server server add service-name=PPPoE_Server interface=lan one-session-per-host=yes disabled=no
/ ppp profile add name="PPPoE_Profile" local-address=10.10.10.1 remote-address=PPPoE_Pool use-compression=yes use-vj-compression=yes use-encryption=yes ***ge-tcp-mss=no only-one=yes rate-limit=40000/800000 dns-server=202.96.128.86
注意这个10.10.10.2-10.10.10.254是下面需要导入双线账号中提到的局域网网段如果你这里如果的是10.10.10.2-10.10.10.254的话那么下面也必须按照这个网段,这个是PPPOE拨号后分配的IP段,如果你用其他网段同理,下面也要改成你这里设置的网段。
rate-limit=40000/800000是限制每个拨号用户的速度 这里限制的是上行5K下行100K
dns-server=202.96.128.86 这里是DNS
二、建立建立ADSL负载均衡
点击New Terminal 复制以下脚本 ,拷贝到Terminal里面,拷贝到里面后按下回车。
该改动的自己一定改动,这里需要改动的我加亮了,注意的是我附加解释的都打了()这括号不要混淆进去了。
这条脚本是专门给PPPOE服务器用的 是在IP情况下做出了修改的。
/ip address add address=10.66.0.1/255.255.255.0(这里是网关和掩码,必须改成你自己的网关,比如你的网关是192.168.1.1你就要改成192.168.1.1/255.255.255.0) interface=lan comment=lan
/ip dns set primary-dns=202.96.128.86(这里是DNS) secondary-dns= allow-remote-requests=yes
/ip firewall mangle add chain=forward protocol=tcp tcp-flags=syn action=***ge-mss new-mss=1440
/interface pppoe-client add name="pppoe-out1" interface=wan1 user=02012445@163.gz(第一条ADSL的账号) password="123456(第一条ADSL的密码)" 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 src-address=10.10.10.0/255.255.255.0(客户机拨上号后分配的IP,这里就是第一步那里所提到的两个地方导入脚本的网段一定要一样) connection-state=new nth=1,1,0 action=mark-connection new-connection-mark=1 passthrough=yes disabled=no
/ip firewall mangle add chain=prerouting src-address=10.10.10.0/255.255.255.0(客户机拨上号后分配的IP,这里就是第一步那里所提到的两个地方导入脚本的网段一定要一样) 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=0201252@163.gz(第二条ADSL的账号) password="456789(第二条ADSL的密码)" 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 src-address=10.10.10.0/255.255.255.0(客户机拨上号后分配的IP,这里就是第一步那里所提到的两个地方导入脚本的网段一定要一样) connection-state=new nth=1,1,1 action=mark-connection new-connection-mark=2 passthrough=yes disabled=no
/ip firewall mangle add chain=prerouting src-address=10.10.10.0/255.255.255.0(客户机拨上号后分配的IP,这里就是第一步那里所提到的两个地方导入脚本的网段一定要一样) 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
三、增加动态刷新网关脚本
导入完了继续吧这条增加动态刷新网关脚本 不需要修改任何东西。
点击主菜单System→Sheduler点+号Intervan改成30秒,然后粘贴到最下面的框框里,点OK。
: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
}
}
}
好了现在全部设置好了,万事具备,只欠东风,呵呵!
建立PPPOE账号!
主菜单上点PPP→Secrets然后点红色+号 NAMA输入你想建立的账号 PASSWORD输入你密码,Service那里选择PPPOE,PROFILE那里选择PPPOE_PROFILE,然后点OK
回到电脑,点击宽带连接 输入你刚建立的账号和密码,连接,成功。哈哈!
我这里是以两条1M的ADSL为例 负载均衡1+1=2 点击图片放大看吧
展开阅读全文