码迷,mamicode.com
首页 > 其他好文 > 详细

mikrotik/IPSec Dynamic End points Updater.rsc

时间:2015-04-14 01:58:47      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:

# 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

# ==================================================

mikrotik/IPSec Dynamic End points Updater.rsc

标签:

原文地址:http://www.cnblogs.com/wordgao/p/4423725.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!