This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
networking:router:mikrotik_resolve [2017/12/05 09:46] gcooper created |
networking:router:mikrotik_resolve [2017/12/05 09:57] (current) gcooper |
||
---|---|---|---|
Line 8: | Line 8: | ||
<note warning> | <note warning> | ||
+ | |||
+ | ===== Example Scripts ===== | ||
+ | |||
+ | ==== resolve_delivery.antispamcloud.com ==== | ||
+ | |||
+ | :!: This script is intended to resolve multiple hostnames in the '' | ||
+ | |||
+ | < | ||
+ | /system script | ||
+ | add comment=" | ||
+ | policy=ftp, | ||
+ | source=": | ||
+ | \n:foreach k,v in=\$hosts do={\r\ | ||
+ | \n :log info \" | ||
+ | \n :local listname \$v\r\ | ||
+ | \n :resolve \$v\r\ | ||
+ | \n :local iscname [/ip dns cache all find where name=\$v and type=\" | ||
+ | \n :if (\$iscname != \" | ||
+ | \n :local newname [/ip dns cache all get \$iscname data]\r\ | ||
+ | \n :log info \"\$v is CNAME to \$newname\" | ||
+ | \n :set v \$newname\r\ | ||
+ | \n }\r\ | ||
+ | \n :resolve \$v\r\ | ||
+ | \n /ip firewall address-list remove [/ip firewall address-list find where list=\$listname]\r\ | ||
+ | \n :foreach i in=[/ip dns cache all find where name=\$v and type=\" | ||
+ | \n :local ipaddr [/ip dns cache all get \$i data]\r\ | ||
+ | \n /ip firewall address-list add list=\$listname address=\$ipaddr comment=\$v\r\ | ||
+ | \n :log info \"IP address: \$ipaddr\" | ||
+ | \n }\r\ | ||
+ | \n /ipv6 firewall address-list remove [/ipv6 firewall address-list find where list=\$listname]\r\ | ||
+ | \n :foreach i in=[/ip dns cache all find where name=\$v and type=\" | ||
+ | \n :local ipaddr [/ip dns cache all get \$i data]\r\ | ||
+ | \n /ipv6 firewall address-list add list=\$listname address=\$ipaddr comment=\$v\r\ | ||
+ | \n :log info \"IPv6 address: \$ipaddr\" | ||
+ | \n }\r\ | ||
+ | \n}\r\ | ||
+ | \n:log info \" | ||
+ | </ |