Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # define variables
- :local list
- :local comment
- :local newip
- # Loop through each entry in the address list.
- :foreach i in=[/ip firewall address-list find list="blocked-site" disabled=no] do={
- # Get the comment for this address list item (this is the host name to use)
- :set comment [/ip firewall address-list get $i comment]
- # Resolve it and set the address list entry accordingly.
- #:log info "dns resolve $comment"
- :do {
- :set newip [:resolve $comment]
- :if ( [:len [/ip firewall address-list find list="blocked-host" address=$newip]] = 0 ) do={
- /ip firewall address-list add address=$newip list=blocked-host comment=$comment
- }
- } on-error={
- :log error "dns normal resolve failure $comment"
- }
- :do {
- :set newip [:resolve $comment server=8.8.8.8]
- :if ( [:len [/ip firewall address-list find list="blocked-host" address=$newip]] = 0 ) do={
- /ip firewall address-list add address=$newip list=blocked-host comment=$comment
- }
- } on-error={
- :log error "dns google resolve failure $comment"
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement