zoukankan      html  css  js  c++  java
  • ROS单线多拨pppoe

    #设置内网IP地址
    / ip add add interface=ether1 address=192.168.0.254/255.255.255.0
    #设置共享上网
    / ip firewall nat add action=masquerade chain=srcnat src-address=192.168.0.0/255.255.255.0


    #设置ADSL拔号
    / interface pppoe-client add name="pppoe-out1" interface=ether2 user="wwwszwblmcom@163.gd" password="88888888" add-default-route=no disabled=no
    / interface pppoe-client enable pppoe-out1

    / interface pppoe-client add name="pppoe-out2" interface=ether3 user="wwwszwblmcom@163.gd" password="88888888" add-default-route=no disabled=no
    / interface pppoe-client enable pppoe-out2

    / interface pppoe-client add name="pppoe-out2" interface=ether4 user="wwwszwblmcom@163.gd" password="88888888" add-default-route=no disabled=no
    / interface pppoe-client enable pppoe-out3


    #设置ADSL虚拟IP
    / ip address add address=58.58.58.51/32 interface=pppoe-out1 comment="adsl1"
    / ip address add address=58.58.58.52/32 interface=pppoe-out2 comment="adsl2"
    / ip address add address=58.58.58.53/32 interface=pppoe-out3 comment="adsl3"

    #设置分流上网
    / ip firewall mangle add chain=prerouting src-address=192.168.0.1-192.168.0.20 action=mark-routing new-routing-mark=adsl1 comment=adsl1
    / ip firewall mangle add chain=prerouting src-address=192.168.0.21-192.168.0.30 action=mark-routing new-routing-mark=adsl2 comment=adsl2
    / ip firewall mangle add chain=prerouting src-address=192.168.0.31-192.168.0.40 action=mark-routing new-routing-mark=adsl3 comment=adsl3


    #设置路由表
    / ip route add gateway=58.58.58.51 routing-mark=adsl1 comment=adsl1
    / ip route add gateway=58.58.58.52 routing-mark=adsl2 comment=adsl2
    / ip route add gateway=58.58.58.53 routing-mark=adsl3 comment=adsl3

     

    #设置脚本
    :local assign-address
    :local new-address
    :local status
    :local x
    :set x 3
    :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 [:find $new-address "/"]]
    :set assign-address [/ip address get [/ip address find dynamic=no interface=("pppoe-out" . $i)] address]
    :set assign-address [:pick $assign-address 0 [:find $assign-address "/"]]
    :if ($assign-address != $new-address) do={
    /ip address set [/ip address find comment=("adsl" . $i)] address=$new-address network=$new-address broadcast=$new-address
    /ip route set [/ip route find comment=("adsl" . $i)] gateway=$new-address
    }
    }
    }

    本文使用Blog_Backup未注册版本导出,请到soft.pt42.com注册。

  • 相关阅读:
    HDU
    Groundhog Build Home
    The Moving Points
    Problem I. Count
    Problem E. TeaTree
    树的启发式合并
    Special Segments of Permutation
    网络流24题
    2015-2016 Northwestern European Regional Contest (NWERC 2015)
    The 2018 ACM-ICPC Asia Beijing Regional Contest
  • 原文地址:https://www.cnblogs.com/lvcisco/p/4041935.html
Copyright © 2011-2022 走看看