zoukankan      html  css  js  c++  java
  • mikrotik/IPSec Dynamic End points Updater.rsc

    # IPSec Peer/Policy Updater for Dynamic WAN addresses
    
    # ==================================================
    
    # CONFIGURATION START
    
    # ==================================================
    
    :local localfqdn "local.fqdn-or-ip.domain.tld"
    
    :local remotefqdn "remote.fqdn-or-ip.domain.tld"
    
    :local peertag "peer-comment"
    
    :local policytag "policy-comment"
    
    # ==================================================
    
    # CONFIGURATION END
    
    # ==================================================
    
    /ip dns cache flush
    
    :local localsite "0.0.0.0"
    
    :local remotesite "0.0.0.0"
    
    :if ( [ :tostr [ :toip $localfqdn ] ] != $localfqdn ) do={
    
    :set localsite [ :resolve $localfqdn ]
    
    } else={
    
    :set localsite $localfqdn
    
    }
    
    :if ( [ :tostr [ :toip $remotefqdn ] ] != $remotefqdn ) do={
    
    :set remotesite [ :resolve $remotefqdn ]
    
    } else={
    
    :set remotesite $remotefqdn
    
    }
    
    :log info ( "IPSec: setting local to ". $localsite ." and remote to ". $remotesite ."." )
    
    /ip ipsec policy set [ /ip ipsec policy find comment="$policytag" ] sa-src-address=$localsite sa-dst-address=$remotesite
    
    /ip ipsec peer set [ /ip ipsec peer find comment="$peertag" ] address="$remotesite/32"
    
    # ==================================================
    
    # END OF SCRIPT
    
    # ==================================================
  • 相关阅读:
    slots属性(省内存,限制属性的定义)
    自定制格式化方式format
    改变对象的字符串显示__str__repr
    __getattribute__和item系列
    授权(类似)
    双下划线开头的attr方法
    动态导入模块
    反射
    python的单下划线和双下划线
    在子类中调用父类的方法
  • 原文地址:https://www.cnblogs.com/wordgao/p/4423725.html
Copyright © 2011-2022 走看看