找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 7569|回复: 8

[脚本] ROS3.3电信ADSL+联通adsl_PCC_负载脚本,掉线无法自动切换,您瞧瞧?

[复制链接]
发表于 2011-9-9 19:16:36 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
#===================================================================================
#        基本资料
#===================================================================================
#日期:
#        2011-09-09
#
# ros 版本:
#        3.30
#
# 设备环境:
#        HUAWEI Quidway S2024C SERIES 二层交换机        1台
#        HUAWEI Quidway S3526-AC 三层交换机        1台
#       HUAWEI Quidway S2016 二层交换机         1台
#        CISCO Catalyst 1900 SERIES 交换机        1台
#        CISCO 2610 路由器                        1台
#        C3-900/128M内存/128MCF卡(旧电脑)        2台
#        Intel 82559 PCI网卡                        3片
#        杂牌 8139 PCI网卡                        3片
#        54M无线路由器                                1台
#       Cisco 1231G                             1台
#
# 线路环境:
#        电信光纤拨号        1条        带宽        10M
#        联通ADSL拨号        1条        带宽        4M
#         
#                                         
# 实现目标:
#        *、电信、联通,PCC负载
#        *、策略路由:电信IP走电信,联通IP走联通
#        *、断线自动切换。
#            


#
#




#===================================================================================
#更换网卡的名称,方便后期设置,顺序为最近显卡为ether1 (同一品牌芯片批次,否则肯定乱)
#===================================================================================
#        ether1        ->        LAN
#        ether2        ->        WAN-DXGQ-ADSL-10M
#        ether3        ->        WAN-LT-ADSL-4M


/ interface

set ether1 name LAN
set ether2 name WAN-DXGQ-ADSL-10M
set ether3 name WAN-LT-ADSL-4M


#===================================================================================
#为内网卡分配IP地址
#===================================================================================
#        LAN        ->        192.168.88.254/24
#        comment        ->        做一个标记名字

/ ip address

add address=192.168.88.254/24 \
        interface=LAN \
        comment=LAN




#===================================================================================
#配置DNS服务器
#===================================================================================
#        primary-dns                ->        主DNS
#        secondary-dns                ->        副DNS
#        allow-remote-requests        ->        让ROS成为DNS服务器,建议为no

/ ip dns

set primary-dns=61.128.114.133 \
        secondary-dns=61.128.114.166 \
        allow-remote-requests=no



#===================================================================================
#添加 PPPoE Client
#===================================================================================
#        add-default-route        ->        加入默认路由
#        disabled                ->        是否禁止

/ interface pppoe-client
       
add name=pppoe-10M \
        interface=WAN-DXGQ-ADSL-10M \
        user=******\
        password=******\
        add-default-route=no \
        disabled=no
       
add name=pppoe-4M \
        interface=WAN-LT-ADSL-4M \
        user=******\
        password=******\
        add-default-route=no \
        disabled=no




#===================================================================================
#配置Mangle,及PPC
#===================================================================================
#per-connection-classifier        ->        src-address-and-port:2/0
#
#
#

/ ip firewall mangle

add chain=prerouting \
        in-interface=LAN \
        action=mark-connection \
        new-connection-mark="1st_conn" \
        passthrough=yes \
        per-connection-classifier=src-address-and-port:2/0

add chain=prerouting \
        in-interface=LAN \
        connection-mark=1st_conn \
        action=mark-routing \
        new-routing-mark="1st_route" \
        passthrough=no

add chain=prerouting \
        in-interface=LAN \
        action=mark-connection \
        new-connection-mark="2st_conn" \
        passthrough=yes \
        per-connection-classifier=src-address-and-port:2/1

add chain=prerouting \
        in-interface=LAN \
        connection-mark=2st_conn \
        action=mark-routing \
        new-routing-mark="2st_route" \
        passthrough=no


#===================================================================================
#配置路由
#===================================================================================
#
#主路由


/ ip route

add gateway=pppoe-10M \
        check-gateway=ping \
        distance=1 \
        routing-mark=1st_route

add gateway=pppoe-4M \
        check-gateway=ping \
        distance=1 \
        routing-mark=2st_route

#备用路由

/ ip route

add gateway=pppoe-10M \
        check-gateway=ping \
        distance=2

add gateway=pppoe-4M \
        check-gateway=ping \
        distance=2

#===================================================================================
#配置伪装
#===================================================================================
#

/ ip firewall nat

add chain=srcnat \
        out-interface=pppoe-10M \
        action=masquerade

add chain=srcnat \
        out-interface=pppoe-4M \
        action=masquerade


#===================================================================================
#配置 UPNP
#===================================================================================
#        使用winbox:ip-upnp
#        添加PPPoe连接(我是用ADSL),tpye选external,settings钩enable;
#        再添加内网连接,type选internal,settings钩enable,
#        完成后WINXP自动找到upnp设备MikroTik router




#===================================================================================
#配置PPPoe 服务端
#===================================================================================
#注意这个10.10.10.2-10.10.10.254是下面需要导入双线账号中提到的局域网网段,
#如果你这里如果的是10.10.10.2-10.10.10.254的话那么下面也必须按照这个网段,
#这个是PPPOE拨号后分配的IP段,如果你用其他网段同理,下面也要改成你这里设置的网段。
#rate-limit=4800000/4800000是限制每个拨号用户的速度 这里限制的是上行600K下行600K
#dns-server=61.128.114.166,61.128.114.133 这里是DNS


/ 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 \
        change-tcp-mss=no \
        only-one=yes \
        rate-limit=4800000/4800000 \
        dns-server=61.128.114.133,221.7.1.20





#===================================================================================
#添加 PPPoE 客户端账号
#===================================================================================
#        profile="PPPoE_Profile" 是PPPoE服务端 里设置的名称

/ ppp secret

add name="abc"         \
        password="abc"         \
        service="pppoe"        \
        profile="PPPoE_Profile"







现在的问题:



   1,  某一路掉线后,不能自动 切换到另一路.

   2,  下载的时候 不能 带宽叠加, 从ROS 中看 只是 4M 的线路 有用
routeros
发表于 2011-9-10 12:22:26 | 显示全部楼层
用Cisco的设备,有前途……
routeros
回复

使用道具 举报

发表于 2011-9-10 13:00:04 | 显示全部楼层
不明白,居然策略路由了(电信IP走电信线路,其余走联通),还要负载均衡干嘛?
routeros
回复

使用道具 举报

发表于 2011-10-21 00:26:39 | 显示全部楼层
不同ISP好像叠加没什么效果吧
routeros
回复

使用道具 举报

发表于 2011-10-21 00:57:00 | 显示全部楼层
看这阵式,楼主编程做的很规范,应该是个编程高手。
routeros
回复

使用道具 举报

 楼主| 发表于 2011-10-21 00:59:02 | 显示全部楼层



   Basic 的时候 学习过一段时间。



   代码的规范,现在就习惯了。
routeros
回复

使用道具 举报

发表于 2011-10-22 22:59:20 | 显示全部楼层
楼主你还是用策略路由的方式就可以了,我也是电信加联通的双ADSL,只需做策略路由就可以,开始我也是其中一条线路掉线了就不可以上网了,最后发现是因为DNS的配置有错,应该把DNS设为两条线路的DNS都有才可以了,
routeros
回复

使用道具 举报

发表于 2011-10-23 07:37:57 | 显示全部楼层
因为你用了PPC。一条掉线了PPC怎么正常工作???

加个PPC掉线脚本
routeros
回复

使用道具 举报

发表于 2011-10-23 07:39:10 | 显示全部楼层
电信、网通的双线用PPC合适吗???
routeros
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-6-2 08:40 , Processed in 0.054854 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

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