moonsee 发表于 2010-12-25 16:56:03

查然是好教程!!

cxw168 发表于 2010-12-27 17:19:43

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

xbklfdxm 发表于 2011-2-18 13:58:02

记下来并且按照实际要求改了,不知道实施了怎么样

yamqq2009 发表于 2011-2-19 08:43:59

学习了。。正需要这东西。。。:lol

qile 发表于 2011-2-19 08:52:40

我给顶上,只是小弟才疏学浅。也不会把它改成双AD

qile 发表于 2011-2-19 08:57:53

您好 您能帮我看看我这个是为什么上不去网
ros3.30hotspot 做双线ads的lPCc叠加脚本 导入后无法上网,能解析ip地址,只要把一个路由禁用就可以通过另一条单线上网!
这我提问的链接 http://bbs.routerclub.com/forum.php?mod=viewthread&tid=46355&extra=page%3D1
ros3.30hotspot 做双线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

wanken 发表于 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

qile 发表于 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


先把1网卡的名字改为Wan-1   comment="wan-1"
先把2网卡的名字改为Wan-2    comment="wan-2"
先把3网卡的名字改为Lan      comment="Lan"

在/ip address 配置内网IP、光纤固定IP及ADSL的设定

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


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


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


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




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=yesper-connection-classifier= both-addresses:2/0src-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_route1passthrough=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=yesper-connection-classifier= both-addresses:2/1src-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_route2passthrough=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=yesper-connection-classifier= both-addresses:2/0src-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_route1passthrough=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=yesper-connection-classifier= both-addresses:2/1src-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_route2passthrough=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_routeinterface 为 pppoe-out1

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


/ ip route
add dst-address=0.0.0.0/0 gateway=123.179.142.254distance=1 comment="adsl"
check-gateway=pingrouting-mark=adsl_route2 --------------------如


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





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

取得 ip address 的动态(network)网关 来修改 ip route 中的网关用winbox到 / system script
add name="adsl-gateway"   
:global adslwg
:set adslwg network]
/ip route set 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后也无法上网



wanken 发表于 2011-2-20 12:46:11

我写的是我做的过程,不是一次安装的脚本,重点是你要看过程改为你需要的,如 PCCIP 192.4168.8.2-192.168.8.17 <-----你也一样吗?????

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

取得 ip address 的动态(network)网关 来修改 ip route 中的网关用winbox到 / system script
add name="adsl-gateway"    source=
:global adslwg
:set adslwg network]
/ip route set 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

qile 发表于 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=yesper-connection-classifier= both-addresses:2/0src-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_route1passthrough=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=yesper-connection-classifier= both-addresses:2/1src-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_route2passthrough=yes src-address=192.168.8.1-192.168.8.17



我在ros里面把 src-address 删除也不好似 呵呵 这个是备份文件帮看看
另一台电脑ip地址为192.168.8.2应该在pcc控制范围 就是上不去网

jackey56 发表于 2011-4-11 03:03:46

顶啊顶啊顶啊顶

qyii 发表于 2011-4-11 03:30:17

楼主人很好。经常给新手们详细解释问题。受惠过了
呵呵,头像很给力~

wpsliu 发表于 2011-4-18 20:45:41

支持原创教程,感谢LZ分享这么详细的教程

wubingxin 发表于 2011-4-19 03:32:27

zbjxbnjx henhao

cg08 发表于 2011-12-27 23:54:24

详细的教程一定要支持
页: 1 [2] 3
查看完整版本: 二条线路ADSL+光纤固定IP做PCC负载均衡及部分IP策略分流设定!