找回密码
 注册

QQ登录

只需一步,快速开始

搜索
楼主: wanken

[负载平衡] 二条线路ADSL+光纤固定IP做PCC负载均衡及部分IP策略分流设定!

  [复制链接]
发表于 2010-12-25 16:56:03 | 显示全部楼层
查然是好教程!!
routeros
回复

使用道具 举报

发表于 2010-12-27 17:19:43 | 显示全部楼层
二条线路ADSL+光纤固定IP做PCC负载均衡及部分IP策略分流设定!
routeros
回复

使用道具 举报

发表于 2011-2-18 13:58:02 | 显示全部楼层
记下来并且按照实际要求改了,不知道实施了怎么样
routeros
回复

使用道具 举报

发表于 2011-2-19 08:43:59 | 显示全部楼层
学习了。。正需要这东西。。。
routeros
回复

使用道具 举报

发表于 2011-2-19 08:52:40 | 显示全部楼层
我给顶上,只是小弟才疏学浅。也不会把它改成双AD
routeros
回复

使用道具 举报

发表于 2011-2-19 08:57:53 | 显示全部楼层
您好 您能帮我看看我这个是为什么上不去网
ros3.30  hotspot 做双线ads的lPCc叠加脚本 导入后无法上网,能解析ip地址,只要把一个路由禁用就可以通过另一条单线上网!
这我提问的链接 http://bbs.routerclub.com/forum. ... &extra=page%3D1
ros3.30  hotspot 做双线ads的lPCc叠加脚本

/ip address add address=10.0.11.254/255.255.255.0 interface=lan comment=lan
/ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=2048KiB max-udp-packet-size=512 se=202.99.224.8,202.99.224.168

/ interface pppoe-client
add name="pppoe-out1" max-mtu=1440 max-mru=1440 interface=wlan \
    user="047202699487" password="222" profile=default \
    service="" ac-name="" add-default-route=yes dial-on-demand=no \
     allow=pap,chap,mschap1,mschap2 disabled=no

add name="pppoe-out2" max-mtu=1440 max-mru=1440 interface=wlan2 \
    user="047202536727" password="333^" profile=default \
     ac-name="" add-default-route=yes dial-on-demand=no \
     allow=pap,chap,mschap1,mschap2 disabled=no

/ ip firewall mangle
add chain=prerouting dst-address-type=!local in-interface=lan per-connection-classifier=both-addresses:2/0 \
    action=mark-connection new-connection-mark=1st_conn passthrough=yes comment="PCC1"
add chain=prerouting connection-mark=1st_conn in-interface=lan action=mark-routing new-routing-mark=1st_route

add chain=prerouting dst-address-type=!local in-interface=lan per-connection-classifier=both-addresses:2/1 \
    action=mark-connection new-connection-mark=2st_conn passthrough=yes comment="PCC2"
add chain=prerouting connection-mark=2st_conn in-interface=lan action=mark-routing new-routing-mark=2st_route

add chain=input in-interface=wlan2 action=mark-connection new-connection-mark=1st_conn

add chain=input in-interface=wlan action=mark-connection new-connection-mark=2st_conn

add chain=output connection-mark=1st_conn action=mark-routing new-routing-mark=1st_route

add chain=output connection-mark=2st_conn action=mark-routing new-routing-mark=2st_route

/ip route
add comment="" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\
    pppoe-out1 routing-mark=1st_route

add comment="" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\
    pppoe-out2 routing-mark=2st_route

/ip firewall nat
add action=masquerade chain=srcnat comment=1 out-interface=pppoe-out1

add action=masquerade chain=srcnat comment=2 out-interface=pppoe-out2

评分

参与人数 1铜板 +24 收起 理由
zooyo + 24

查看全部评分

routeros
回复

使用道具 举报

 楼主| 发表于 2011-2-19 11:23:56 | 显示全部楼层
/ interface pppoe-client
add name="pppoe-out1" max-mtu=1440 max-mru=1440 interface=wlan \
    user="047202699487" password="222" profile=default \
    service="" ac-name="" add-default-route=yes dial-on-demand=no \
     allow=pap,chap,mschap1,mschap2 disabled=no

add name="pppoe-out2" max-mtu=1440 max-mru=1440 interface=wlan2 \
    user="047202536727" password="333^" profile=default \
     ac-name="" add-default-route=yes dial-on-demand=no \
     allow=pap,chap,mschap1,mschap2 disabled=no

ROS拨号成功后就会获得adsl的动态IP和动态网关,获得的网关就是 ip->address 里interface=pppoe-out1的 network 项。
例如拨号获得的IP是address里的113.88.11.173 网关是network里的 113.88.10.1
注意一点一定要先把ADD DEFAULT ROUTE 前的打勾号去掉在点OK或应用否则他会自动把ISP的网关天加到MAIN路由表里你还要删除才行,改成  add-default-route=No  参考我的脚本有个地方是要设定自动换route的  


以下这一段你都是按照范例来做的,为何没依照我的来做呢!要改的太多你再多参考我的范例吧  
/ ip firewall mangle
add chain=prerouting dst-address-type=!local in-interface=lan per-connection-classifier=both-addresses:2/0 \
    action=mark-connection new-connection-mark=1st_conn passthrough=yes comment="PCC1"
add chain=prerouting connection-mark=1st_conn in-interface=lan action=mark-routing new-routing-mark=1st_route

add chain=prerouting dst-address-type=!local in-interface=lan per-connection-classifier=both-addresses:2/1 \
    action=mark-connection new-connection-mark=2st_conn passthrough=yes comment="PCC2"
add chain=prerouting connection-mark=2st_conn in-interface=lan action=mark-routing new-routing-mark=2st_route

add chain=input in-interface=wlan2 action=mark-connection new-connection-mark=1st_conn

add chain=input in-interface=wlan action=mark-connection new-connection-mark=2st_conn

add chain=output connection-mark=1st_conn action=mark-routing new-routing-mark=1st_route

add chain=output connection-mark=2st_conn action=mark-routing new-routing-mark=2st_route

/ip route
add comment="" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\
    pppoe-out1 routing-mark=1st_route

add comment="" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\
    pppoe-out2 routing-mark=2st_route

评分

参与人数 1铜板 +24 收起 理由
zooyo + 24 谢谢分享

查看全部评分

routeros
回复

使用道具 举报

发表于 2011-2-20 12:31:49 | 显示全部楼层
本帖最后由 qile 于 2011-2-20 12:49 编辑

二条线路ADSl
系统ros版本3.30
线路为俩条联通adsl 6m宽带

登录ros 系统 命令行输入如下
输入setup 选择r 后确定输入y 后系统恢复默认设置并从启动 这就变成一个全新安装的系统
现在我们来安装
二线Pcc频宽合并及部分IP策略分流做法如下:

从启动ros后用用户名:admin 密码空登录
开启winbox 后登录ros
image001.jpg

先把1网卡的名字改为Wan-1   comment="wan-1"
先把2网卡的名字改为Wan-2    comment="wan-2"
先把3网卡的名字改为Lan      comment="Lan"
image002.jpg
在/ip address 配置内网IP、光纤固定IP及ADSL的设定

/ ip address
add address=192.168.8.3      interface=Lan
add address=             interface=Wan-1   <--可以不用设定或(随便给)一会adsl拨接设定interface在Wan-1
image003.jpg

以上小字部分为为设置项,我没有设置adsl-的ip
/ip address DNS
设定DNS
IP-->DNS-->Settings Primary DNS  202.99.224.8  Seconday DNS  202.99.224.168        <--这里是宽带的DNS
image004.jpg

添加PPOE 拨号
拨号选网卡名为Wan-1的网卡
配置ADSL线路
/interface pppoe-client 配置ADSL拨号信息。让ADSL拔上去
/interface pppoe-client
add name=pppoe-out1 interface=Wan-1  user=帐号(adsl)   password=xxxxxx

image005.jpg image006.jpg
添加PPOE 拨号
拨号选网卡名为Wan-2的网卡
配置ADSL线路
/interface pppoe-client 配置ADSL拨号信息。让ADSL拔上去
/interface pppoe-client
add name=pppoe-out2 interface=Wan-2  user=帐号(adsl)   password=xxxxxx


image007.jpg image008.jpg

ROS拨号成功后就会获得adsl的动态IP和动态网关,获得的网关就是 ip->address 里interface=pppoe-out1的 network 项。
例如拨号获得的IP是address里的113.88.11.173 网关是network里的 113.88.10.1
   把ADD DEFAULT ROUTE 前的对号去掉注意一点一定要先把ADD DEFAULT ROUTE 前的对号去掉在点OK或
应用否则他会自动把ISP的网关天加到MAIN路由表里你还要删除才行

注意   per-connection-classifier= both-addresses   要选这个  both-addresses 选其他的工商银行网银会出问题,我试过其他的选项都不行!如src-address,src-port都不可以进入网银!

以下设定  192.168.8.1-192.168.8.17   PCC负载均衡
   /ip firewall mangle
add action=mark-connection chain=prerouting comment="make-adsl1-link" disabled=no new-connection-mark=adsl_conn1 passthrough=yes  per-connection-classifier= both-addresses:2/0  src-address=192.168.8.1-192.168.8.17
add action=mark-routing chain=prerouting comment="make-adsl1-route" connection-mark=adsl_conn1 disabled=no new-routing-mark=adsl_route1  passthrough=yes src-address=192.168.8.1-192.168.8.17



/ip firewall mangle
add action=mark-connection chain=prerouting comment="make-adsl2-link" disabled=no new-connection-mark=adsl_conn2 passthrough=yes  per-connection-classifier= both-addresses:2/1  src-address=192.168.8.1-192.168.8.17
add action=mark-routing chain=prerouting comment="make-adsl2-route" connection-mark=adsl_conn2 disabled=no new-routing-mark=adsl_route2  passthrough=yes src-address=192.168.8.1-192.168.8.17

---------------------------------------------------------------以上小字脚本运行有问题我修改后脚本添加正常--------------------------------------------------------正确脚本在下面----
/ip firewall mangle
add action=mark-connection chain=prerouting comment="make-adsl1-link" disabled=no new-connection-mark=adsl_conn1 passthrough=yes  per-connection-classifier= both-addresses:2/0  src-address=192.168.8.1-192.168.8.17
add action=mark-routing chain=prerouting comment="make-adsl1-route" connection-mark=adsl_conn1 disabled=no new-routing-mark=adsl_route1  passthrough=yes src-address=192.168.8.1-192.168.8.17



/ip firewall mangle
add action=mark-connection chain=prerouting comment="make-adsl2-link" disabled=no new-connection-mark=adsl_conn2 passthrough=yes  per-connection-classifier= both-addresses:2/1  src-address=192.168.8.1-192.168.8.17
add action=mark-routing chain=prerouting comment="make-adsl1-route" connection-mark=adsl_conn2 disabled=no new-routing-mark=adsl_route2  passthrough=yes src-address=192.168.8.1-192.168.8.17



更改  mss
add action=change-mss chain=forward comment="" disabled=no new-mss=1440 protocol=tcp tcp-flags=syn


添加路由表 固定IP   adsl
然后分别加网关
因为现在还不知道adsl网关所以可以随便填adsl路由表加网关为116.114.192.1
路由规则里添加相应的规则和平时设置一样关键是你的路由规则要按那张路由表走

配置路由(网关)
拨号成功后,PPPOE会自动添加IP地址和网关,我们要做的就是手动再添加一次这些地址。
adsl的网关随便填用防adsl掉线脚本来自动修改它手动添加1个和PPPOE自动添加出来一样的网关IP,并标记为comment="adsl"为ADSL的IP   设定 routing mark 为 adsl_route  interface 为 pppoe-out1

   添加光纖線路网关(固定IP)  210.75.27.62    设定 routing mark 为 IP_route  interface 为 Wan-2
并标记为 固定IP  comment="IP"  
小字没有添加
/ ip route
add dst-address=0.0.0.0/0 gateway=123.179.142.254  distance=1 comment="adsl"  
check-gateway=ping  routing-mark=adsl_route1    --------------------如图2

image009.jpg
/ ip route
add dst-address=0.0.0.0/0 gateway=123.179.142.254  distance=1 comment="adsl"  
check-gateway=ping  routing-mark=adsl_route2 --------------------如

image010.jpg
增加一个默认路由,这样ROS主机自己才可以连接外面做DDNS更新!
add dst-address=0.0.0.0/0 gateway=210.75.27.62  distance=1   comment="默認路由"  
check-gateway=ping  routing-mark=""                -----------------如   





添加脚本adsl-gateway取得adsl  ip address 的动态(network)网关 来修改 ip route 中的网关

取得 ip address 的动态(network)网关 来修改 ip route 中的网关用winbox到 / system script
add name="adsl-gateway"   
:global adslwg
:set adslwg [/ip address get [/ip address find dynamic=yes interface=pppoe-out1] network]
/ip route set [/ip route find comment=adsl] gateway=$adslwg

10秒钟运行一次script脚本,就是上面那个,来防adsl掉线后重新拨接网关没有及时更新!用winbox到
  / system scheduler
add name=" adsl-gateway " on-event=/system script run adsl-gateway" start-date=jMay/29/2010 start-time=00:00:00 interval=10s comment="" \
disabled=no



配置IP伪装 (共享上网)
/ip firewall nat
add action=masquerade chain=srcnat out-interface= pppoe-out2
add action=masquerade chain=srcnat out-interface=pppoe-out1



从启动下ros 后配置dns 点ip-dns –dns setup 选dhcp server interface =lan 后 一路next就可以

之后用其他系统无法上网可以自动获得ip地址
无法ping通网关!

现发ros备份请楼主帮看下什么问题,另启用hotspot后也无法上网



image011.jpg
image012.jpg
routeros
回复

使用道具 举报

 楼主| 发表于 2011-2-20 12:46:11 | 显示全部楼层
我写的是我做的过程,不是一次安装的脚本,重点是你要看过程改为你需要的,如 PCC  IP 192.4168.8.2-192.168.8.17 <-----你也一样吗?????

最后你的网关要用  script  去跑出来啊..............! 我都有写看看下面红字几行就是了!
添加脚本adsl-gateway取得adsl  ip address 的动态(network)网关 来修改 ip route 中的网关

取得 ip address 的动态(network)网关 来修改 ip route 中的网关用winbox到 / system script
add name="adsl-gateway"    source=
:global adslwg
:set adslwg [/ip address get [/ip address find dynamic=yes interface=pppoe-out1] network]
/ip route set [/ip route find comment=adsl] gateway=$adslwg

10秒钟运行一次script脚本,就是上面那个,来防adsl掉线后重新拨接网关没有及时更新!用winbox到
  / system scheduler
add name=" adsl-gateway " on-event=/system script run adsl-gateway" start-date=jMay/29/2010 start-time=00:00:00 interval=10s comment="" \
disabled=no  
routeros
回复

使用道具 举报

发表于 2011-2-20 12:52:48 | 显示全部楼层
/ip firewall mangle
add action=mark-connection chain=prerouting comment="make-adsl1-link" disabled=no new-connection-mark=adsl_conn1 passthrough=yes  per-connection-classifier= both-addresses:2/0  src-address=192.168.8.1-192.168.8.17
add action=mark-routing chain=prerouting comment="make-adsl1-route" connection-mark=adsl_conn1 disabled=no new-routing-mark=adsl_route1  passthrough=yes src-address=192.168.8.1-192.168.8.17



/ip firewall mangle
add action=mark-connection chain=prerouting comment="make-adsl2-link" disabled=no new-connection-mark=adsl_conn2 passthrough=yes  per-connection-classifier= both-addresses:2/1  src-address=192.168.8.1-192.168.8.17
add action=mark-routing chain=prerouting comment="make-adsl1-route" connection-mark=adsl_conn2 disabled=no new-routing-mark=adsl_route2  passthrough=yes src-address=192.168.8.1-192.168.8.17



我在ros里面把 src-address 删除也不好似 呵呵 这个是备份文件帮看看
另一台电脑ip地址为192.168.8.2应该在pcc控制范围 就是上不去网 MikroTik-20022011-1147.rar (5.02 KB, 下载次数: 12)
routeros
回复

使用道具 举报

发表于 2011-4-11 03:03:46 | 显示全部楼层
顶啊顶啊顶啊顶
routeros
回复

使用道具 举报

发表于 2011-4-11 03:30:17 | 显示全部楼层
楼主人很好。经常给新手们详细解释问题。受惠过了
呵呵,头像很给力~
routeros
回复

使用道具 举报

发表于 2011-4-18 20:45:41 | 显示全部楼层
支持原创教程,感谢LZ分享这么详细的教程
routeros
回复

使用道具 举报

发表于 2011-4-19 03:32:27 | 显示全部楼层
zbjxbnjx henhao
routeros
回复

使用道具 举报

发表于 2011-12-27 23:54:24 | 显示全部楼层
详细的教程一定要支持
routeros
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-18 17:53 , Processed in 0.092809 second(s), 10 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

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