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注册。

  • 相关阅读:
    水调歌头·1024
    网页开发方式-从静态页面到服务端渲染
    完美融合 nextjs 和 antd
    commanderJs编写命令行工具(cli)
    [信息安全] 05 X.509 公钥证书的格式标准
    [Cake] 3. dotnet 本地工具 cake & dotnet format
    [计算机网络] 00 概述
    [Cake] 2. dotnet 全局工具 cake
    [解读REST] 0.REST 相关参考资料
    [OIDC in Action] 3. 基于OIDC(OpenID Connect)的SSO(添加Github OAuth 2.0的支持)
  • 原文地址:https://www.cnblogs.com/lvcisco/p/4041935.html
Copyright © 2011-2022 走看看